Documentation ¶
Index ¶
- Constants
- type CgiBinTicketGetTicketResponse
- type CgiBinTicketGetTicketResult
- type CgiBinTokenResponse
- type CgiBinTokenResult
- type CgiBinUserGetResponse
- type CgiBinUserGetResult
- type CgiBinUserInfoResponse
- type CgiBinUserInfoResult
- type Client
- func (c *Client) CgiBinTicketGetTicket(ctx context.Context, Type string, notMustParams ...gorequest.Params) (*CgiBinTicketGetTicketResult, error)
- func (c *Client) CgiBinToken(ctx context.Context, notMustParams ...gorequest.Params) (*CgiBinTokenResult, error)
- func (c *Client) CgiBinUserGet(ctx context.Context, nextOpenid string, notMustParams ...gorequest.Params) (*CgiBinUserGetResult, error)
- func (c *Client) CgiBinUserInfo(ctx context.Context, openid string, notMustParams ...gorequest.Params) (*CgiBinUserInfoResult, error)
- func (c *Client) ConfigApp(appId, appSecret string) *Client
- func (c *Client) ConfigSLogClientFun(apiSLogFun golog.ApiSLogFun)
- func (c *Client) DebugCgiBinTicketCheck(ctx context.Context, notMustParams ...gorequest.Params) (*DebugCgiBinTicketCheckResult, error)
- func (c *Client) DefaultHttp()
- func (c *Client) Get(ctx context.Context, _method string, notMustParams ...gorequest.Params) ([]byte, error)
- func (c *Client) GetAccessToken(ctx context.Context) string
- func (c *Client) GetAccessTokenMonitor(ctx context.Context) (string, error)
- func (c *Client) GetAppId() string
- func (c *Client) GetAppSecret() string
- func (c *Client) GetCallBackIp(ctx context.Context, notMustParams ...gorequest.Params) (*GetCallBackIpResult, error)
- func (c *Client) GetJsapiTicket(ctx context.Context) string
- func (c *Client) GetJsapiTicketMonitor(ctx context.Context) (string, error)
- func (c *Client) MessageTemplateSend(ctx context.Context, notMustParams ...gorequest.Params) (*MessageTemplateSendResult, error)
- func (c *Client) Oauth2(ctx context.Context, redirectUri, state string) string
- func (c *Client) Post(ctx context.Context, _method string, notMustParams ...gorequest.Params) ([]byte, error)
- func (c *Client) SetHttp(app *gorequest.App)
- func (c *Client) Share(ctx context.Context, url string) *ShareResult
- func (c *Client) SnsJsCode2session(ctx context.Context, jsCode string, notMustParams ...gorequest.Params) (*SnsJsCode2sessionResult, error)
- func (c *Client) SnsOauth2AccessToken(ctx context.Context, code string, notMustParams ...gorequest.Params) (*SnsOauth2AccessTokenResult, error)
- func (c *Client) SnsUserinfo(ctx context.Context, accessToken, openid string, ...) (*SnsUserinfoResult, error)
- type ClientConfig
- type DebugCgiBinTicketCheckResponse
- type DebugCgiBinTicketCheckResult
- type GetCallBackIpResponse
- type GetCallBackIpResult
- type MessageTemplateSendResponse
- type MessageTemplateSendResult
- type ShareResponse
- type ShareResult
- type SnsJsCode2sessionResponse
- type SnsJsCode2sessionResult
- type SnsOauth2AccessTokenResponse
- type SnsOauth2AccessTokenResult
- type SnsUserinfoResponse
- type SnsUserinfoResult
Constants ¶
const (
LogTable = "wechatoffice"
)
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type CgiBinTicketGetTicketResult ¶
type CgiBinTicketGetTicketResult struct { Result CgiBinTicketGetTicketResponse // 结果 Body []byte // 内容 Http gorequest.Response // 请求 }
type CgiBinTokenResponse ¶
type CgiBinTokenResult ¶
type CgiBinTokenResult struct { Result CgiBinTokenResponse // 结果 Body []byte // 内容 Http gorequest.Response // 请求 }
type CgiBinUserGetResponse ¶
type CgiBinUserGetResult ¶
type CgiBinUserGetResult struct { Result CgiBinUserGetResponse // 结果 Body []byte // 内容 Http gorequest.Response // 请求 }
type CgiBinUserInfoResponse ¶
type CgiBinUserInfoResponse struct { Subscribe int `json:"subscribe"` // 用户是否订阅该公众号标识,值为0时,代表此用户没有关注该公众号,拉取不到其余信息 Openid string `json:"openid"` // 用户的标识,对当前公众号唯一 Language string `json:"language"` // 用户的语言,简体中文为zh_CN SubscribeTime int `json:"subscribe_time"` // 用户关注时间,为时间戳。如果用户曾多次关注,则取最后关注时间 Unionid string `json:"unionid"` // 只有在用户将公众号绑定到微信开放平台帐号后,才会出现该字段 Remark string `json:"remark"` // 公众号运营者对粉丝的备注,公众号运营者可在微信公众平台用户管理界面对粉丝添加备注 Groupid int `json:"groupid"` // 用户所在的分组ID(兼容旧的用户分组接口) TagidList []interface{} `json:"tagid_list"` // 用户被打上的标签ID列表 SubscribeScene string `json:"subscribe_scene"` // 返回用户关注的渠道来源,ADD_SCENE_SEARCH 公众号搜索,ADD_SCENE_ACCOUNT_MIGRATION 公众号迁移,ADD_SCENE_PROFILE_CARD 名片分享,ADD_SCENE_QR_CODE 扫描二维码,ADD_SCENE_PROFILE_LINK 图文页内名称点击,ADD_SCENE_PROFILE_ITEM 图文页右上角菜单,ADD_SCENE_PAID 支付后关注,ADD_SCENE_WECHAT_ADVERTISEMENT 微信广告,ADD_SCENE_REPRINT 他人转载 ,ADD_SCENE_LIVESTREAM 视频号直播,ADD_SCENE_CHANNELS 视频号 , ADD_SCENE_OTHERS 其他 QrScene int `json:"qr_scene"` // 二维码扫码场景(开发者自定义) QrSceneStr string `json:"qr_scene_str"` // 二维码扫码场景描述(开发者自定义) Nickname string `json:"nickname"` // 用户昵称 Sex int `json:"sex"` // 用户的性别,值为1时是男性,值为2时是女性,值为0时是未知 Province string `json:"province"` // 用户个人资料填写的省份 City string `json:"city"` // 普通用户个人资料填写的城市 Country string `json:"country"` // 国家,如中国为CN Headimgurl string `json:"headimgurl"` // 用户头像,最后一个数值代表正方形头像大小(有0、46、64、96、132数值可选,0代表640*640正方形头像),用户没有头像时该项为空。若用户更换头像,原有头像URL将失效 }
type CgiBinUserInfoResult ¶
type CgiBinUserInfoResult struct { Result CgiBinUserInfoResponse // 结果 Body []byte // 内容 Http gorequest.Response // 请求 }
type Client ¶ added in v1.0.47
type Client struct {
// contains filtered or unexported fields
}
Client 实例
func NewClient ¶ added in v1.0.47
func NewClient(config *ClientConfig) (*Client, error)
NewClient 创建实例化
func (*Client) CgiBinTicketGetTicket ¶ added in v1.0.47
func (c *Client) CgiBinTicketGetTicket(ctx context.Context, Type string, notMustParams ...gorequest.Params) (*CgiBinTicketGetTicketResult, error)
CgiBinTicketGetTicket 获取api_ticket https://developers.weixin.qq.com/doc/offiaccount/OA_Web_Apps/JS-SDK.html
func (*Client) CgiBinToken ¶ added in v1.0.47
func (c *Client) CgiBinToken(ctx context.Context, notMustParams ...gorequest.Params) (*CgiBinTokenResult, error)
CgiBinToken 接口调用凭证 https://developers.weixin.qq.com/miniprogram/dev/api-backend/open-api/access-token/auth.getAccessToken.html
func (*Client) CgiBinUserGet ¶ added in v1.0.47
func (c *Client) CgiBinUserGet(ctx context.Context, nextOpenid string, notMustParams ...gorequest.Params) (*CgiBinUserGetResult, error)
CgiBinUserGet 获取用户列表 https://developers.weixin.qq.com/doc/offiaccount/User_Management/Getting_a_User_List.html
func (*Client) CgiBinUserInfo ¶ added in v1.0.47
func (c *Client) CgiBinUserInfo(ctx context.Context, openid string, notMustParams ...gorequest.Params) (*CgiBinUserInfoResult, error)
CgiBinUserInfo 获取用户基本信息(UnionID机制) https://developers.weixin.qq.com/doc/offiaccount/User_Management/Get_users_basic_information_UnionID.html#UinonId
func (*Client) ConfigSLogClientFun ¶ added in v1.0.162
func (c *Client) ConfigSLogClientFun(apiSLogFun golog.ApiSLogFun)
ConfigSLogClientFun 日志配置
func (*Client) DebugCgiBinTicketCheck ¶ added in v1.0.47
func (c *Client) DebugCgiBinTicketCheck(ctx context.Context, notMustParams ...gorequest.Params) (*DebugCgiBinTicketCheckResult, error)
DebugCgiBinTicketCheck 判断ticket是否合法 https://mp.weixin.qq.com/debug/cgi-bin/sandbox?t=jsapisign
func (*Client) GetAccessToken ¶ added in v1.0.47
func (*Client) GetAccessTokenMonitor ¶ added in v1.0.47
func (*Client) GetAppSecret ¶ added in v1.0.47
func (*Client) GetCallBackIp ¶ added in v1.0.47
func (c *Client) GetCallBackIp(ctx context.Context, notMustParams ...gorequest.Params) (*GetCallBackIpResult, error)
GetCallBackIp 获取微信callback IP地址 callback IP即微信调用开发者服务器所使用的出口IP。 https://developers.weixin.qq.com/doc/offiaccount/Basic_Information/Get_the_WeChat_server_IP_address.html#2.%20%E8%8E%B7%E5%8F%96%E5%BE%AE%E4%BF%A1callback%20IP%E5%9C%B0%E5%9D%80
func (*Client) GetJsapiTicket ¶ added in v1.0.47
GetJsapiTicket 获取api_ticket
func (*Client) GetJsapiTicketMonitor ¶ added in v1.0.47
GetJsapiTicketMonitor 监控api_ticket
func (*Client) MessageTemplateSend ¶ added in v1.0.47
func (c *Client) MessageTemplateSend(ctx context.Context, notMustParams ...gorequest.Params) (*MessageTemplateSendResult, error)
MessageTemplateSend 模板消息 https://developers.weixin.qq.com/doc/offiaccount/Message_Management/Template_Message_Interface.html
func (*Client) Oauth2 ¶ added in v1.0.47
Oauth2 用户同意授权,获取code https://developers.weixin.qq.com/doc/offiaccount/OA_Web_Apps/Wechat_webpage_authorization.html#0
func (*Client) Share ¶ added in v1.0.47
func (c *Client) Share(ctx context.Context, url string) *ShareResult
func (*Client) SnsJsCode2session ¶ added in v1.0.47
func (*Client) SnsOauth2AccessToken ¶ added in v1.0.47
func (c *Client) SnsOauth2AccessToken(ctx context.Context, code string, notMustParams ...gorequest.Params) (*SnsOauth2AccessTokenResult, error)
SnsOauth2AccessToken 通过code换取网页授权access_token https://developers.weixin.qq.com/doc/offiaccount/OA_Web_Apps/Wechat_webpage_authorization.html#0
func (*Client) SnsUserinfo ¶ added in v1.0.47
func (c *Client) SnsUserinfo(ctx context.Context, accessToken, openid string, notMustParams ...gorequest.Params) (*SnsUserinfoResult, error)
SnsUserinfo 拉取用户信息(需scope为 snsapi_userinfo) https://developers.weixin.qq.com/doc/offiaccount/OA_Web_Apps/Wechat_webpage_authorization.html#0
type ClientConfig ¶ added in v1.0.52
type ClientConfig struct { AppId string `json:"app_id"` // 小程序唯一凭证,即 appId AppSecret string // 小程序唯一凭证密钥,即 appSecret RedisClient *dorm.RedisClient // 缓存数据库 RedisCachePrefixFun redisCachePrefixFun // 缓存前缀 }
ClientConfig 实例配置
type DebugCgiBinTicketCheckResult ¶
type DebugCgiBinTicketCheckResult struct { Result DebugCgiBinTicketCheckResponse // 结果 Body []byte // 内容 Http gorequest.Response // 请求 }
type GetCallBackIpResponse ¶
type GetCallBackIpResponse struct {
IpList []string `json:"ip_list"`
}
type GetCallBackIpResult ¶
type GetCallBackIpResult struct { Result GetCallBackIpResponse // 结果 Body []byte // 内容 Http gorequest.Response // 请求 }
type MessageTemplateSendResult ¶
type MessageTemplateSendResult struct { Result MessageTemplateSendResponse // 结果 Body []byte // 内容 Http gorequest.Response // 请求 }
type ShareResponse ¶
type ShareResponse struct {}
type ShareResult ¶
type ShareResult struct {}
type SnsJsCode2sessionResult ¶
type SnsJsCode2sessionResult struct { Result SnsJsCode2sessionResponse // 结果 Body []byte // 内容 Http gorequest.Response // 请求 }
type SnsOauth2AccessTokenResponse ¶
type SnsOauth2AccessTokenResponse struct { AccessToken string `json:"access_token"` // 网页授权接口调用凭证,注意:此access_token与基础支持的access_token不同 ExpiresIn int `json:"expires_in"` // access_token接口调用凭证超时时间,单位(秒) RefreshToken string `json:"refresh_token"` // 用户刷新access_token Openid string `json:"openid"` // 用户唯一标识 Scope string `json:"scope"` // 用户授权的作用域,使用逗号(,)分隔 }
type SnsOauth2AccessTokenResult ¶
type SnsOauth2AccessTokenResult struct { Result SnsOauth2AccessTokenResponse // 结果 Body []byte // 内容 Http gorequest.Response // 请求 }
type SnsUserinfoResponse ¶
type SnsUserinfoResponse struct { Openid string `json:"openid"` // 用户的唯一标识 Nickname string `json:"nickname"` // 用户昵称 Sex int `json:"sex"` // 用户的性别,值为1时是男性,值为2时是女性,值为0时是未知 Province string `json:"province"` // 用户个人资料填写的省份 City string `json:"city"` // 普通用户个人资料填写的城市 Country string `json:"country"` // 国家,如中国为CN Headimgurl string `json:"headimgurl"` // 用户头像,最后一个数值代表正方形头像大小(有0、46、64、96、132数值可选,0代表640*640正方形头像),用户没有头像时该项为空。若用户更换头像,原有头像URL将失效。 Privilege []string `json:"privilege"` // 用户特权信息,json 数组,如微信沃卡用户为(chinaunicom) Unionid string `json:"unionid,omitempty"` // 只有在用户将公众号绑定到微信开放平台帐号后,才会出现该字段。 }
type SnsUserinfoResult ¶
type SnsUserinfoResult struct { Result SnsUserinfoResponse // 结果 Body []byte // 内容 Http gorequest.Response // 请求 }
Source Files ¶
- api.go
- cgi-bin.ticket.getticket.go
- cgi-bin.ticket.getticket.monitor.go
- cgi-bin.ticket.getticket.rdb.go
- cgi-bin.token.go
- cgi-bin.token.monitor.go
- cgi-bin.token.rdb.go
- cgi-bin.user.get.go
- cgi-bin.user.info.go
- client.go
- config.go
- const.go
- debug.cgi-bin.ticket.check.go
- error.go
- get.go
- getcallbackip.go
- message.template.send.go
- oauth2.go
- request.go
- share.go
- sign.go
- sns.jscode2session.go
- sns.oauth2.access_token.go
- sns.userinfo.go