Documentation ¶
Index ¶
- type App
- func (app *App) CgiBinTicketGetTicket(Type string) *CgiBinTicketGetTicketResult
- func (app *App) CgiBinToken() *CgiBinTokenResult
- func (app *App) CgiBinUserGet(nextOpenid string) *CgiBinUserGetResult
- func (app *App) CgiBinUserInfo(openid string) *CgiBinUserInfoResult
- func (app *App) DebugCgiBinTicketCheck() *DebugCgiBinTicketCheckResult
- func (app *App) GetAccessToken() string
- func (app *App) GetAccessTokenMonitor() (string, error)
- func (app *App) GetCallBackIp() *GetCallBackIpResult
- func (app *App) GetJsapiTicket() string
- func (app *App) GetJsapiTicketMonitor() (string, error)
- func (app *App) MessageTemplateSend(notMustParams ...Params) *MessageTemplateSendResult
- func (app *App) NewParamsWith(params ...Params) Params
- func (app *App) Oauth2(redirectUri, state string) string
- func (app *App) Share(url string) *ShareResult
- func (app *App) SnsJsCode2session(jsCode string) *SnsJsCode2sessionResult
- func (app *App) SnsOauth2AccessToken(code string) *SnsOauth2AccessTokenResult
- func (app *App) SnsUserinfo(accessToken, openid string) *SnsUserinfoResult
- type CgiBinTicketGetTicketResponse
- type CgiBinTicketGetTicketResult
- type CgiBinTokenResponse
- type CgiBinTokenResult
- type CgiBinUserGetResponse
- type CgiBinUserGetResult
- type CgiBinUserInfoResponse
- type CgiBinUserInfoResult
- type DebugCgiBinTicketCheckResponse
- type DebugCgiBinTicketCheckResult
- type GetCallBackIpResponse
- type GetCallBackIpResult
- type MessageTemplateSendResponse
- type MessageTemplateSendResult
- type Params
- type ShareResponse
- type ShareResult
- type SnsJsCode2sessionResponse
- type SnsJsCode2sessionResult
- type SnsOauth2AccessTokenResponse
- type SnsOauth2AccessTokenResult
- type SnsUserinfoResponse
- type SnsUserinfoResult
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type App ¶
type App struct { AppId string // 小程序唯一凭证,即 AppID AppSecret string // 小程序唯一凭证密钥,即 AppSecret AccessToken string // 接口调用凭证 JsapiTicket string // 签名凭证 Redis goredis.App // 缓存数据库服务 Mongo gomongo.App // 日志数据库 }
App 微信公众号服务
func (*App) CgiBinTicketGetTicket ¶
func (app *App) CgiBinTicketGetTicket(Type string) *CgiBinTicketGetTicketResult
CgiBinTicketGetTicket 获取api_ticket https://developers.weixin.qq.com/doc/offiaccount/OA_Web_Apps/JS-SDK.html
func (*App) CgiBinToken ¶
func (app *App) CgiBinToken() *CgiBinTokenResult
CgiBinToken 接口调用凭证 https://developers.weixin.qq.com/miniprogram/dev/api-backend/open-api/access-token/auth.getAccessToken.html
func (*App) CgiBinUserGet ¶
func (app *App) CgiBinUserGet(nextOpenid string) *CgiBinUserGetResult
CgiBinUserGet 获取用户列表 https://developers.weixin.qq.com/doc/offiaccount/User_Management/Getting_a_User_List.html
func (*App) CgiBinUserInfo ¶
func (app *App) CgiBinUserInfo(openid string) *CgiBinUserInfoResult
CgiBinUserInfo 获取用户基本信息(UnionID机制) https://developers.weixin.qq.com/doc/offiaccount/User_Management/Get_users_basic_information_UnionID.html#UinonId
func (*App) DebugCgiBinTicketCheck ¶
func (app *App) DebugCgiBinTicketCheck() *DebugCgiBinTicketCheckResult
DebugCgiBinTicketCheck 判断ticket是否合法 https://mp.weixin.qq.com/debug/cgi-bin/sandbox?t=jsapisign
func (*App) GetAccessToken ¶
func (*App) GetAccessTokenMonitor ¶
func (*App) GetCallBackIp ¶
func (app *App) GetCallBackIp() *GetCallBackIpResult
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 (*App) GetJsapiTicketMonitor ¶
GetJsapiTicketMonitor 监控api_ticket
func (*App) MessageTemplateSend ¶
func (app *App) MessageTemplateSend(notMustParams ...Params) *MessageTemplateSendResult
MessageTemplateSend 模板消息 https://developers.weixin.qq.com/doc/offiaccount/Message_Management/Template_Message_Interface.html
func (*App) NewParamsWith ¶
func (*App) Oauth2 ¶
Oauth2 用户同意授权,获取code https://developers.weixin.qq.com/doc/offiaccount/OA_Web_Apps/Wechat_webpage_authorization.html#0
func (*App) Share ¶
func (app *App) Share(url string) *ShareResult
func (*App) SnsJsCode2session ¶
func (app *App) SnsJsCode2session(jsCode string) *SnsJsCode2sessionResult
func (*App) SnsOauth2AccessToken ¶
func (app *App) SnsOauth2AccessToken(code string) *SnsOauth2AccessTokenResult
SnsOauth2AccessToken 通过code换取网页授权access_token https://developers.weixin.qq.com/doc/offiaccount/OA_Web_Apps/Wechat_webpage_authorization.html#0
func (*App) SnsUserinfo ¶
func (app *App) SnsUserinfo(accessToken, openid string) *SnsUserinfoResult
SnsUserinfo 拉取用户信息(需scope为 snsapi_userinfo) https://developers.weixin.qq.com/doc/offiaccount/OA_Web_Apps/Wechat_webpage_authorization.html#0
type CgiBinTicketGetTicketResult ¶
type CgiBinTicketGetTicketResult struct { Result CgiBinTicketGetTicketResponse // 结果 Body []byte // 内容 Err error // 错误 }
func NewCgiBinTicketGetTicketResult ¶
func NewCgiBinTicketGetTicketResult(result CgiBinTicketGetTicketResponse, body []byte, err error) *CgiBinTicketGetTicketResult
type CgiBinTokenResponse ¶
type CgiBinTokenResult ¶
type CgiBinTokenResult struct { Result CgiBinTokenResponse // 结果 Body []byte // 内容 Err error // 错误 }
func NewCgiBinTokenResult ¶
func NewCgiBinTokenResult(result CgiBinTokenResponse, body []byte, err error) *CgiBinTokenResult
type CgiBinUserGetResponse ¶
type CgiBinUserGetResult ¶
type CgiBinUserGetResult struct { Result CgiBinUserGetResponse // 结果 Body []byte // 内容 Err error // 错误 }
func NewCgiBinUserGetResult ¶
func NewCgiBinUserGetResult(result CgiBinUserGetResponse, body []byte, err error) *CgiBinUserGetResult
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 // 内容 Err error // 错误 }
func NewCgiBinUserInfoResult ¶
func NewCgiBinUserInfoResult(result CgiBinUserInfoResponse, body []byte, err error) *CgiBinUserInfoResult
type DebugCgiBinTicketCheckResult ¶
type DebugCgiBinTicketCheckResult struct { Result DebugCgiBinTicketCheckResponse // 结果 Body []byte // 内容 Err error // 错误 }
func NewDebugCgiBinTicketCheckResult ¶
func NewDebugCgiBinTicketCheckResult(result DebugCgiBinTicketCheckResponse, body []byte, err error) *DebugCgiBinTicketCheckResult
type GetCallBackIpResponse ¶
type GetCallBackIpResponse struct {
IpList []string `json:"ip_list"`
}
type GetCallBackIpResult ¶
type GetCallBackIpResult struct { Result GetCallBackIpResponse // 结果 Body []byte // 内容 Err error // 错误 }
func NewGetCallBackIpResult ¶
func NewGetCallBackIpResult(result GetCallBackIpResponse, body []byte, err error) *GetCallBackIpResult
type MessageTemplateSendResult ¶
type MessageTemplateSendResult struct { Result MessageTemplateSendResponse // 结果 Body []byte // 内容 Err error // 错误 }
func NewMessageTemplateSendResult ¶
func NewMessageTemplateSendResult(result MessageTemplateSendResponse, body []byte, err error) *MessageTemplateSendResult
type ShareResponse ¶
type ShareResponse struct {}
type ShareResult ¶
type ShareResult struct {}
func NewShareResult ¶
func NewShareResult(result ShareResponse, err error) *ShareResult
type SnsJsCode2sessionResult ¶
type SnsJsCode2sessionResult struct { Result SnsJsCode2sessionResponse // 结果 Body []byte // 内容 Err error // 错误 }
func NewSnsJsCode2sessionResult ¶
func NewSnsJsCode2sessionResult(result SnsJsCode2sessionResponse, body []byte, err error) *SnsJsCode2sessionResult
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 // 内容 Err error // 错误 }
func NewSnsOauth2AccessTokenResult ¶
func NewSnsOauth2AccessTokenResult(result SnsOauth2AccessTokenResponse, body []byte, err error) *SnsOauth2AccessTokenResult
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 // 内容 Err error // 错误 }
func NewSnsUserinfoResult ¶
func NewSnsUserinfoResult(result SnsUserinfoResponse, body []byte, err error) *SnsUserinfoResult
Source Files ¶
- app.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
- debug.cgi-bin.ticket.check.go
- getcallbackip.go
- message.template.send.go
- mongodb.go
- oauth2.go
- params.go
- share.go
- sign.go
- sns.jscode2session.go
- sns.oauth2.access_token.go
- sns.userinfo.go