Documentation ¶
Index ¶
- Constants
- Variables
- func GetPhoneNumberOld(appId string, sessionKey string, encryptedData string, iv string) (string, error)
- type AccessToken
- type Code2Session
- type Data
- type MiniprogramState
- type PhoneInfo
- type PhoneNumber
- type PhoneNumberResponse
- type PhoneNumberScrypt
- type SnsApiWxUserInfo
- type TemplateMessage
- type TemplateSendResponse
- type TokenResult
- type UniformMessage
- type UniformMessageBody
- type Val
- type WXUserDataCrypt
- type Watermark
- type WeappTemplateMsg
- type WxUserInfo
Constants ¶
View Source
const ( Developer = MiniprogramState("developer") Trial = MiniprogramState("trial") Formal = MiniprogramState("formal") )
View Source
const WXErrorCode = errx.ErrCode(110002)
Variables ¶
Functions ¶
Types ¶
type AccessToken ¶
func GetAccessToken ¶
func GetAccessToken(appId, appSecret, accessTokenCacheKey string, client *redis.Redis) (*AccessToken, error)
GetAccessToken 获取微信访问token
type Code2Session ¶
type Code2Session struct { OpenId string `json:"openid"` SessionKey string `json:"session_key"` UnionId string `json:"unionid"` ErrCode int64 `json:"errcode"` ErrMsg string `json:"errmsg"` }
func GetCode2Session ¶
func GetCode2Session(code string, appId string, appSecret string) (*Code2Session, error)
GetCode2Session 登录凭证校验
type MiniprogramState ¶ added in v1.0.5
type MiniprogramState string
type PhoneNumber ¶
type PhoneNumberResponse ¶
type PhoneNumberResponse struct { ErrCode int64 `json:"errCode"` ErrMsg string `json:"errMsg"` PhoneInfo PhoneInfo `json:"phone_info"` }
func GetPhoneNumber ¶
func GetPhoneNumber(accessToken string, code string) (*PhoneNumberResponse, error)
type PhoneNumberScrypt ¶
type PhoneNumberScrypt struct {
// contains filtered or unexported fields
}
func NewPhoneNumberScrypt ¶
func NewPhoneNumberScrypt(appID, sessionKey string) *PhoneNumberScrypt
func (*PhoneNumberScrypt) Decrypt ¶
func (w *PhoneNumberScrypt) Decrypt(encryptedData, iv string) (*PhoneNumber, error)
type SnsApiWxUserInfo ¶
type SnsApiWxUserInfo struct { OpenId string `json:"openid"` NickName string `json:"nickname"` Sex int64 `json:"sex"` Province string `json:"province"` City string `json:"city"` Country string `json:"country"` HeadImgUrl string `json:"headimgurl"` Privilege string `json:"privilege"` UnionId string `json:"unionid"` }
func SnsApiUserInfo ¶
func SnsApiUserInfo(accessToken string, openId string) (*SnsApiWxUserInfo, error)
type TemplateMessage ¶ added in v1.0.2
type TemplateMessage struct {
// contains filtered or unexported fields
}
func NewTemplateMesage ¶ added in v1.0.2
func NewTemplateMesage(appId, appSecret, templateId, accessTokenKey string, redisConf redis.RedisConf) TemplateMessage
func (TemplateMessage) Send ¶ added in v1.0.2
func (msg TemplateMessage) Send(page, openId string, data Data, state MiniprogramState) (err error)
type TemplateSendResponse ¶ added in v1.0.2
type TemplateSendResponse struct{}
type TokenResult ¶ added in v1.0.2
type UniformMessage ¶ added in v1.0.3
type UniformMessage struct {
// contains filtered or unexported fields
}
func NewUniformMessage ¶ added in v1.0.4
func NewUniformMessage(appId, appSecret, templateId, accessTokenKey string, redisConf redis.RedisConf) UniformMessage
type UniformMessageBody ¶ added in v1.0.3
type UniformMessageBody struct { ToUser string `json:"touser"` WeappTemplateMsg WeappTemplateMsg `json:"weapp_template_msg"` }
type WXUserDataCrypt ¶
type WXUserDataCrypt struct {
// contains filtered or unexported fields
}
func NewWXUserDataCrypt ¶
func NewWXUserDataCrypt(appID, sessionKey string) *WXUserDataCrypt
func (*WXUserDataCrypt) Decrypt ¶
func (w *WXUserDataCrypt) Decrypt(encryptedData, iv string) (*WxUserInfo, error)
type WeappTemplateMsg ¶ added in v1.0.3
type WxUserInfo ¶
type WxUserInfo struct { OpenID string `json:"openId"` UnionID string `json:"unionId"` NickName string `json:"nickName"` Gender int `json:"gender"` City string `json:"city"` Province string `json:"province"` Country string `json:"country"` AvatarURL string `json:"avatarUrl"` Language string `json:"language"` Watermark struct { Timestamp int64 `json:"timestamp"` AppID string `json:"appid"` } `json:"watermark"` }
Click to show internal directories.
Click to hide internal directories.