當前位置: 首頁>>代碼示例>>Golang>>正文


Golang Client.GetJSON方法代碼示例

本文整理匯總了Golang中github.com/chanxuehong/wechat/v2/mp/core.Client.GetJSON方法的典型用法代碼示例。如果您正苦於以下問題:Golang Client.GetJSON方法的具體用法?Golang Client.GetJSON怎麽用?Golang Client.GetJSON使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在github.com/chanxuehong/wechat/v2/mp/core.Client的用法示例。


在下文中一共展示了Client.GetJSON方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Golang代碼示例。

示例1: Get

// Get 獲取用戶基本信息.
//  注意:
//  1. 需要判斷返回的 UserInfo.IsSubscriber 是等於 1 還是 0
//  2. lang 指定返回國家地區語言版本,zh_CN 簡體,zh_TW 繁體,en 英語, 默認為 zh_CN
func Get(clt *core.Client, openId string, lang string) (info *UserInfo, err error) {
	switch lang {
	case "":
		lang = LanguageZhCN
	case LanguageZhCN, LanguageZhTW, LanguageEN:
	default:
		lang = LanguageZhCN
	}

	var incompleteURL = "https://api.weixin.qq.com/cgi-bin/user/info?openid=" + url.QueryEscape(openId) +
		"&lang=" + lang + "&access_token="
	var result struct {
		core.Error
		UserInfo
	}
	if err = clt.GetJSON(incompleteURL, &result); err != nil {
		return
	}
	if result.ErrCode != core.ErrCodeOK {
		err = &result.Error
		return
	}
	info = &result.UserInfo
	return
}
開發者ID:btbxbob,項目名稱:wechat,代碼行數:29,代碼來源:user.go

示例2: Delete

// 刪除自定義菜單.
func Delete(clt *core.Client) (err error) {
	const incompleteURL = "https://api.weixin.qq.com/cgi-bin/menu/delete?access_token="

	var result core.Error
	if err = clt.GetJSON(incompleteURL, &result); err != nil {
		return
	}
	if result.ErrCode != core.ErrCodeOK {
		err = &result
		return
	}
	return
}
開發者ID:btbxbob,項目名稱:wechat,代碼行數:14,代碼來源:api.go

示例3: Delete

// Delete 刪除客服賬號
func Delete(clt *core.Client, kfAccount string) (err error) {
	// TODO
	//	incompleteURL := "https://api.weixin.qq.com/customservice/kfaccount/del?kf_account=" +
	//		url.QueryEscape(kfAccount) + "&access_token="
	incompleteURL := "https://api.weixin.qq.com/customservice/kfaccount/del?kf_account=" +
		kfAccount + "&access_token="

	var result core.Error
	if err = clt.GetJSON(incompleteURL, &result); err != nil {
		return
	}
	if result.ErrCode != core.ErrCodeOK {
		err = &result
		return
	}
	return
}
開發者ID:btbxbob,項目名稱:wechat,代碼行數:18,代碼來源:account.go

示例4: GetAllPrivateTemplate

// 獲取模板列表
func GetAllPrivateTemplate(clt *core.Client) (templateList []Template, err error) {
	const incompleteURL = "https://api.weixin.qq.com/cgi-bin/template/get_all_private_template?access_token="

	var result struct {
		core.Error
		TemplateList []Template `json:"template_list"`
	}
	if err = clt.GetJSON(incompleteURL, &result); err != nil {
		return
	}
	if result.ErrCode != core.ErrCodeOK {
		err = &result.Error
		return
	}
	templateList = result.TemplateList
	return
}
開發者ID:btbxbob,項目名稱:wechat,代碼行數:18,代碼來源:template.go

示例5: List

// List 查詢所有分組.
func List(clt *core.Client) (groups []Group, err error) {
	const incompleteURL = "https://api.weixin.qq.com/cgi-bin/groups/get?access_token="

	var result struct {
		core.Error
		Groups []Group `json:"groups"`
	}
	if err = clt.GetJSON(incompleteURL, &result); err != nil {
		return
	}
	if result.ErrCode != core.ErrCodeOK {
		err = &result.Error
		return
	}
	groups = result.Groups
	return
}
開發者ID:btbxbob,項目名稱:wechat,代碼行數:18,代碼來源:group.go

示例6: GetCallbackIP

// 獲取微信服務器IP地址.
//  如果公眾號基於安全等考慮,需要獲知微信服務器的IP地址列表,以便進行相關限製,可以通過該接口獲得微信服務器IP地址列表。
func GetCallbackIP(clt *core.Client) (ipList []string, err error) {
	const incompleteURL = "https://api.weixin.qq.com/cgi-bin/getcallbackip?access_token="

	var result struct {
		core.Error
		List []string `json:"ip_list"`
	}
	if err = clt.GetJSON(incompleteURL, &result); err != nil {
		return
	}
	if result.ErrCode != core.ErrCodeOK {
		err = &result.Error
		return
	}
	ipList = result.List
	return
}
開發者ID:btbxbob,項目名稱:wechat,代碼行數:19,代碼來源:getcallbackip.go

示例7: GetMaterialCount

// 獲取素材總數數據.
func GetMaterialCount(clt *core.Client) (info *MaterialCountInfo, err error) {
	const incompleteURL = "https://api.weixin.qq.com/cgi-bin/material/get_materialcount?access_token="

	var result struct {
		core.Error
		MaterialCountInfo
	}
	if err = clt.GetJSON(incompleteURL, &result); err != nil {
		return
	}
	if result.ErrCode != core.ErrCodeOK {
		err = &result.Error
		return
	}
	info = &result.MaterialCountInfo
	return
}
開發者ID:btbxbob,項目名稱:wechat,代碼行數:18,代碼來源:material.go

示例8: OnlineKfList

// OnlineKfList 獲取在線客服接待信息.
func OnlineKfList(clt *core.Client) (list []OnlineKfInfo, err error) {
	const incompleteURL = "https://api.weixin.qq.com/cgi-bin/customservice/getonlinekflist?access_token="

	var result struct {
		core.Error
		OnlineKfInfoList []OnlineKfInfo `json:"kf_online_list"`
	}
	if err = clt.GetJSON(incompleteURL, &result); err != nil {
		return
	}
	if result.ErrCode != core.ErrCodeOK {
		err = &result.Error
		return
	}
	list = result.OnlineKfInfoList
	return
}
開發者ID:btbxbob,項目名稱:wechat,代碼行數:18,代碼來源:kf_list.go

示例9: CategoryList

// CategoryList 獲取門店類目表.
func CategoryList(clt *core.Client) (list []string, err error) {
	const incompleteURL = "https://api.weixin.qq.com/cgi-bin/api_getwxcategory?access_token="

	var result struct {
		core.Error
		CategoryList []string `json:"category_list"`
	}
	if err = clt.GetJSON(incompleteURL, &result); err != nil {
		return
	}
	if result.ErrCode != core.ErrCodeOK {
		err = &result.Error
		return
	}
	list = result.CategoryList
	return
}
開發者ID:btbxbob,項目名稱:wechat,代碼行數:18,代碼來源:category.go

示例10: WaitCaseList

// WaitCaseList 獲取未接入會話列表.
func WaitCaseList(clt *core.Client) (rslt *WaitCaseListResult, err error) {
	const incompleteURL = "https://api.weixin.qq.com/customservice/kfsession/getwaitcase?access_token="

	var result struct {
		core.Error
		WaitCaseListResult
	}
	if err = clt.GetJSON(incompleteURL, &result); err != nil {
		return
	}
	if result.ErrCode != core.ErrCodeOK {
		err = &result.Error
		return
	}
	result.WaitCaseListResult.ItemCount = len(result.WaitCaseListResult.Items)
	rslt = &result.WaitCaseListResult
	return
}
開發者ID:btbxbob,項目名稱:wechat,代碼行數:19,代碼來源:sesson.go

示例11: GetAuditStatus

// 查詢審核狀態
func GetAuditStatus(clt *core.Client) (status *AuditStatus, err error) {
	var result struct {
		core.Error
		AuditStatus `json:"data"`
	}

	incompleteURL := "https://api.weixin.qq.com/shakearound/account/auditstatus?access_token="
	if err = clt.GetJSON(incompleteURL, &result); err != nil {
		return
	}

	if result.ErrCode != core.ErrCodeOK {
		err = &result.Error
		return
	}
	status = &result.AuditStatus
	return
}
開發者ID:btbxbob,項目名稱:wechat,代碼行數:19,代碼來源:account.go

示例12: GetColors

// 獲取卡券最新的顏色列表.
func GetColors(clt *core.Client) (colors []Color, err error) {
	var result struct {
		core.Error
		Colors []Color `json:"colors"`
	}

	incompleteURL := "https://api.weixin.qq.com/card/getcolors?access_token="
	if err = clt.GetJSON(incompleteURL, &result); err != nil {
		return
	}

	if result.ErrCode != core.ErrCodeOK {
		err = &result.Error
		return
	}
	colors = result.Colors
	return
}
開發者ID:btbxbob,項目名稱:wechat,代碼行數:19,代碼來源:color.go

示例13: GetIndustry

// 獲取設置的行業信息
func GetIndustry(clt *core.Client) (primaryIndustry, secondaryIndustry Industry, err error) {
	const incompleteURL = "https://api.weixin.qq.com/cgi-bin/template/get_industry?access_token="

	var result struct {
		core.Error
		PrimaryIndustry   Industry `json:"primary_industry"`
		SecondaryIndustry Industry `json:"secondary_industry"`
	}
	if err = clt.GetJSON(incompleteURL, &result); err != nil {
		return
	}
	if result.ErrCode != core.ErrCodeOK {
		err = &result.Error
		return
	}
	primaryIndustry = result.PrimaryIndustry
	secondaryIndustry = result.SecondaryIndustry
	return
}
開發者ID:btbxbob,項目名稱:wechat,代碼行數:20,代碼來源:template.go

示例14: Get

// Get 獲取客戶的會話
func Get(clt *core.Client, openId string) (ss *Session, err error) {
	incompleteURL := "https://api.weixin.qq.com/customservice/kfsession/getsession?openid=" +
		url.QueryEscape(openId) + "&access_token="

	var result struct {
		core.Error
		Session
	}
	if err = clt.GetJSON(incompleteURL, &result); err != nil {
		return
	}
	if result.ErrCode != core.ErrCodeOK {
		err = &result.Error
		return
	}
	result.Session.OpenId = openId
	ss = &result.Session
	return
}
開發者ID:btbxbob,項目名稱:wechat,代碼行數:20,代碼來源:sesson.go

示例15: Get

// 查詢自定義菜單.
func Get(clt *core.Client) (menu *Menu, conditionalMenus []Menu, err error) {
	const incompleteURL = "https://api.weixin.qq.com/cgi-bin/menu/get?access_token="

	var result struct {
		core.Error
		Menu             Menu   `json:"menu"`
		ConditionalMenus []Menu `json:"conditionalmenu"`
	}
	if err = clt.GetJSON(incompleteURL, &result); err != nil {
		return
	}
	if result.ErrCode != core.ErrCodeOK {
		err = &result.Error
		return
	}
	menu = &result.Menu
	conditionalMenus = result.ConditionalMenus
	return
}
開發者ID:btbxbob,項目名稱:wechat,代碼行數:20,代碼來源:api.go


注:本文中的github.com/chanxuehong/wechat/v2/mp/core.Client.GetJSON方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。