Documentation ¶
Index ¶
- Variables
- type App
- func (app *App) AuthCode2Session(jsCode string) *AuthCode2SessionResult
- func (app *App) AuthGetAccessToken() *AuthGetAccessTokenResult
- func (app *App) AuthGetAccessTokenMonitor(qdType string) (string, error)
- func (app *App) AuthGetJsapiTicketMonitor(qdType string) (string, error)
- func (app *App) GetAccessTokenDb() string
- func (app *App) GetAccessTokenRDb() string
- func (app *App) GetCallBackIp() *GetCallBackIpResult
- func (app *App) GetJsapiTicketDb() string
- func (app *App) GetJsapiTicketRDb() string
- func (app *App) GetTicket(accessToken, Type string) *GetTicketResult
- 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) Oauth2AccessToken(code string) *Oauth2AccessTokenResult
- func (app *App) Share(url string) *ShareResult
- func (app *App) SnsUserinfo(accessToken, openid string) *SnsUserinfoResult
- type AuthCode2SessionResponse
- type AuthCode2SessionResult
- type AuthGetAccessTokenResponse
- type AuthGetAccessTokenResult
- type GetCallBackIpResponse
- type GetCallBackIpResult
- type GetTicketRespons
- type GetTicketResult
- type MessageTemplateSendResponse
- type MessageTemplateSendResult
- type Oauth2AccessTokenResponse
- type Oauth2AccessTokenResult
- type Params
- type ShareResponse
- type ShareResult
- type SnsUserinfoResponse
- type SnsUserinfoResult
- type WechatAccessTokenDbModel
- type WechatJsapiTicketDbModel
Constants ¶
This section is empty.
Variables ¶
var ( QdTypeDb = "DB" QdTypeRdb = "redis" )
Functions ¶
This section is empty.
Types ¶
type App ¶
type App struct { AppId string // 小程序唯一凭证,即 AppID AppSecret string // 小程序唯一凭证密钥,即 AppSecret AccessToken string // 接口调用凭证 JsapiTicket string // 签名凭证 ZapLog *zap.Logger // 日志服务 Db *gorm.DB // 关系数据库服务 RDb *redis.Client // 缓存数据库服务 MDb *mongo.Client // 非关系数据库服务 }
App 微信公众号服务
func (*App) AuthCode2Session ¶
func (app *App) AuthCode2Session(jsCode string) *AuthCode2SessionResult
func (*App) AuthGetAccessToken ¶
func (app *App) AuthGetAccessToken() *AuthGetAccessTokenResult
AuthGetAccessToken 接口调用凭证 https://developers.weixin.qq.com/miniprogram/dev/api-backend/open-api/access-token/auth.getAccessToken.html
func (*App) AuthGetAccessTokenMonitor ¶
func (*App) AuthGetJsapiTicketMonitor ¶
AuthGetJsapiTicketMonitor 监控api_ticket
func (*App) GetAccessTokenDb ¶
func (*App) GetAccessTokenRDb ¶
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) GetJsapiTicketDb ¶
GetJsapiTicketDb 获取api_ticket
func (*App) GetJsapiTicketRDb ¶
GetJsapiTicketRDb 获取api_ticket
func (*App) GetTicket ¶
func (app *App) GetTicket(accessToken, Type string) *GetTicketResult
GetTicket 获取api_ticket https://developers.weixin.qq.com/doc/offiaccount/OA_Web_Apps/JS-SDK.html
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) Oauth2AccessToken ¶
func (app *App) Oauth2AccessToken(code string) *Oauth2AccessTokenResult
Oauth2AccessToken 通过code换取网页授权access_token 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) 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 AuthCode2SessionResult ¶
type AuthCode2SessionResult struct { Result AuthCode2SessionResponse // 结果 Body []byte // 内容 Err error // 错误 }
func NewAuthCode2SessionResult ¶
func NewAuthCode2SessionResult(result AuthCode2SessionResponse, body []byte, err error) *AuthCode2SessionResult
type AuthGetAccessTokenResult ¶
type AuthGetAccessTokenResult struct { Result AuthGetAccessTokenResponse // 结果 Body []byte // 内容 Err error // 错误 }
func NewAuthGetAccessTokenResult ¶
func NewAuthGetAccessTokenResult(result AuthGetAccessTokenResponse, body []byte, err error) *AuthGetAccessTokenResult
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 GetTicketRespons ¶
type GetTicketResult ¶
type GetTicketResult struct { Result GetTicketRespons // 结果 Body []byte // 内容 Err error // 错误 }
func NewGetTicketResult ¶
func NewGetTicketResult(result GetTicketRespons, body []byte, err error) *GetTicketResult
type MessageTemplateSendResult ¶
type MessageTemplateSendResult struct { Result MessageTemplateSendResponse // 结果 Body []byte // 内容 Err error // 错误 }
func NewMessageTemplateSendResult ¶
func NewMessageTemplateSendResult(result MessageTemplateSendResponse, body []byte, err error) *MessageTemplateSendResult
type Oauth2AccessTokenResponse ¶
type Oauth2AccessTokenResponse 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 Oauth2AccessTokenResult ¶
type Oauth2AccessTokenResult struct { Result Oauth2AccessTokenResponse // 结果 Body []byte // 内容 Err error // 错误 }
func NewOauth2AccessTokenResult ¶
func NewOauth2AccessTokenResult(result Oauth2AccessTokenResponse, body []byte, err error) *Oauth2AccessTokenResult
type ShareResponse ¶
type ShareResponse struct {}
type ShareResult ¶
type ShareResult struct {}
func NewShareResult ¶
func NewShareResult(result ShareResponse, err error) *ShareResult
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
type WechatAccessTokenDbModel ¶
type WechatAccessTokenDbModel struct { ID int64 `json:"id"` AppID string `json:"app_id"` AppSecret string `json:"app_secret"` AccessToken string `json:"access_token"` ExpiresIn int `json:"expires_in"` ExpiresTime string `json:"expires_time"` CreateTime time.Time `gorm:"autoCreateTime" json:"-"` }
func (*WechatAccessTokenDbModel) TableName ¶
func (m *WechatAccessTokenDbModel) TableName() string
type WechatJsapiTicketDbModel ¶
type WechatJsapiTicketDbModel struct { ID int64 `json:"id"` AppID string `json:"app_id"` AppSecret string `json:"app_secret"` Ticket string `json:"ticket"` ExpiresIn int `json:"expires_in"` ExpiresTime string `json:"expires_time"` CreateTime time.Time `gorm:"autoCreateTime" json:"-"` }
func (*WechatJsapiTicketDbModel) TableName ¶
func (m *WechatJsapiTicketDbModel) TableName() string
Source Files ¶
- app.go
- auth.code2_session.go
- cgi-bin.token.db.go
- cgi-bin.token.go
- cgi-bin.token.monitor.go
- cgi-bin.token.rdb.go
- getcallbackip.go
- getticket.db.go
- getticket.go
- getticket.monitor.go
- getticket.rdb.go
- message.template.send.go
- oauth2.go
- params.go
- share.go
- sign.go
- sns.oauth2.access_token.go
- sns.userinfo.go