当前位置: 首页>>代码示例>>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;未经允许,请勿转载。