Documentation ¶
Index ¶
- func RequestCheck(token string, timestamp string, nonce string, msgSignature string, ...) error
- func RequestDecrypt(msgEncrypt string, encodingAESKey string) ([]byte, []byte, error)
- type Account
- type Component
- func (c *Component) GetAuthorizationInfo(componentAccessToken string, authorizationCode string) (GetAuthorizationInfoResp, error)
- func (c *Component) GetAuthorizerInfo(componentAccessToken string, authorizerAppID string) (GetAuthorizerInfoResp, error)
- func (c *Component) GetAuthorizerList(componentAccessToken string, offset int, count int) (GetAuthorizerListResp, error)
- func (c *Component) GetComponentAccessToken(componentVerifyTicket string) (GetComponentAccessTokenResp, error)
- func (c *Component) GetOAuthAccessToken(componentAccessToken string, appID string, code string) (GetOAuthAccessTokenResp, error)
- func (c *Component) GetOAuthUserInfo(accessToken string, openID string, lang string) (GetOAuthUserInfoResp, error)
- func (c *Component) GetPreAuthCode(componentAccessToken string) (GetPreAuthCodeResp, error)
- func (c *Component) RefreshAuthorizerAccessToken(componentAccessToken string, authorizerAppID string, ...) (RefreshAuthorizerAccessTokenResp, error)
- func (c *Component) RefreshOAuthAccessToken(componentAccessToken string, appID string, refreshToken string) (RefreshOAuthAccessTokenResp, error)
- type GetAuthorizationInfoResp
- type GetAuthorizerInfoResp
- type GetAuthorizerListResp
- type GetComponentAccessTokenResp
- type GetOAuthAccessTokenResp
- type GetOAuthUserInfoResp
- type GetPreAuthCodeResp
- type GetUserInfoResp
- type Merchant
- type RefreshAuthorizerAccessTokenResp
- type RefreshOAuthAccessTokenResp
- type SendCustomMessageResp
- type SendRedpackResp
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Account ¶ added in v0.1.3
Account 公众号
func (*Account) GetUserInfo ¶ added in v0.1.4
func (a *Account) GetUserInfo(accessToken string, openID string, lang string) (GetUserInfoResp, error)
GetUserInfo 获取用户基本信息 https://developers.weixin.qq.com/doc/offiaccount/User_Management/Get_users_basic_information_UnionID.html#UinonId
func (*Account) SendCustomMessage ¶ added in v0.1.3
func (a *Account) SendCustomMessage(accessToken string, toUser string, msgtype string, content map[string]interface{}) (SendCustomMessageResp, error)
SendCustomMessage 客服接口-发消息 https://developers.weixin.qq.com/doc/offiaccount/Message_Management/Service_Center_messages.html
type Component ¶
Component 第三方平台
func (*Component) GetAuthorizationInfo ¶
func (c *Component) GetAuthorizationInfo(componentAccessToken string, authorizationCode string) (GetAuthorizationInfoResp, error)
GetAuthorizationInfo 使用授权码获取授权信息 https://developers.weixin.qq.com/doc/oplatform/Third-party_Platforms/api/authorization_info.html
func (*Component) GetAuthorizerInfo ¶
func (c *Component) GetAuthorizerInfo(componentAccessToken string, authorizerAppID string) (GetAuthorizerInfoResp, error)
GetAuthorizerInfo 获取授权方的帐号基本信息 https://developers.weixin.qq.com/doc/oplatform/Third-party_Platforms/api/api_get_authorizer_info.html
func (*Component) GetAuthorizerList ¶
func (c *Component) GetAuthorizerList(componentAccessToken string, offset int, count int) (GetAuthorizerListResp, error)
GetAuthorizerList 拉取所有已授权的帐号信息 https://developers.weixin.qq.com/doc/oplatform/Third-party_Platforms/api/api_get_authorizer_list.html
func (*Component) GetComponentAccessToken ¶
func (c *Component) GetComponentAccessToken(componentVerifyTicket string) (GetComponentAccessTokenResp, error)
GetComponentAccessToken 获取令牌 https://developers.weixin.qq.com/doc/oplatform/Third-party_Platforms/api/component_access_token.html
func (*Component) GetOAuthAccessToken ¶
func (c *Component) GetOAuthAccessToken(componentAccessToken string, appID string, code string) (GetOAuthAccessTokenResp, error)
GetOAuthAccessToken 获取网页授权用户的 access_token https://developers.weixin.qq.com/doc/oplatform/Third-party_Platforms/Official_Accounts/official_account_website_authorization.html
func (*Component) GetOAuthUserInfo ¶ added in v0.1.5
func (c *Component) GetOAuthUserInfo(accessToken string, openID string, lang string) (GetOAuthUserInfoResp, error)
GetOAuthUserInfo 获取网页授权用户的基本信息 https://developers.weixin.qq.com/doc/oplatform/Third-party_Platforms/Official_Accounts/official_account_website_authorization.html
func (*Component) GetPreAuthCode ¶
func (c *Component) GetPreAuthCode(componentAccessToken string) (GetPreAuthCodeResp, error)
GetPreAuthCode 获取预授权码 https://developers.weixin.qq.com/doc/oplatform/Third-party_Platforms/api/pre_auth_code.html
func (*Component) RefreshAuthorizerAccessToken ¶
func (c *Component) RefreshAuthorizerAccessToken(componentAccessToken string, authorizerAppID string, authorizerRefreshToken string) (RefreshAuthorizerAccessTokenResp, error)
RefreshAuthorizerAccessToken 刷新接口调用令牌 https://developers.weixin.qq.com/doc/oplatform/Third-party_Platforms/api/api_authorizer_token.html
func (*Component) RefreshOAuthAccessToken ¶ added in v0.1.5
func (c *Component) RefreshOAuthAccessToken(componentAccessToken string, appID string, refreshToken string) (RefreshOAuthAccessTokenResp, error)
RefreshOAuthAccessToken 刷新网页授权用户的 access_token https://developers.weixin.qq.com/doc/oplatform/Third-party_Platforms/Official_Accounts/official_account_website_authorization.html
type GetAuthorizationInfoResp ¶
type GetAuthorizationInfoResp struct { AuthorizationInfo struct { ExpiresIn int `json:"expires_in"` AppID string `json:"authorizer_appid"` AccessToken string `json:"authorizer_access_token"` RefreshToken string `json:"authorizer_refresh_token"` FunInfo []struct { FuncscopeCategory struct { ID int `json:"id"` } `json:"funcscope_category"` } `json:"func_info"` } `json:"authorization_info" validate:"required"` }
GetAuthorizationInfoResp GetAuthorizationInfoResp
type GetAuthorizerInfoResp ¶
type GetAuthorizerInfoResp struct { AuthorizerInfo struct { NickName string `json:"nick_name"` HeadImg string `json:"head_img"` ServiceTypeInfo struct { ID int `json:"id"` } `json:"service_type_info"` VerifyTypeInfo struct { ID int `json:"id"` } `json:"verify_type_info"` UserName string `json:"user_name"` PrincipalName string `json:"principal_name"` Alias string `json:"alias"` BusinessInfo struct { OpenStore int `json:"open_store"` OpenScan int `json:"open_scan"` OpenPay int `json:"open_pay"` OpenCard int `json:"open_card"` OpenShake int `json:"open_shake"` } `json:"business_info"` QrcodeURL string `json:"qrcode_url"` } `json:"authorizer_info" validate:"required"` AuthorizationInfo struct { AuthorizationAppID string `json:"authorization_appid"` FuncInfo []struct { FuncscopeCategory struct { ID int `json:"id"` } `json:"funcscope_category"` } `json:"func_info"` } `json:"authorization_info" validate:"required"` }
GetAuthorizerInfoResp GetAuthorizerInfoResp
type GetAuthorizerListResp ¶
type GetAuthorizerListResp struct { TotalCount int `json:"total_count" validate:"required"` List struct { AuthorizerAppID string `json:"authorizer_appid"` RefreshToken string `json:"refresh_token"` AuthTime int `json:"auth_time"` } `json:"list" validate:"required"` }
GetAuthorizerListResp GetAuthorizerListResp
type GetComponentAccessTokenResp ¶
type GetComponentAccessTokenResp struct { ComponentAccessToken string `json:"component_access_token" validate:"required"` ExpiresIn int `json:"expires_in" validate:"required"` }
GetComponentAccessTokenResp GetComponentAccessTokenResp
type GetOAuthAccessTokenResp ¶
type GetOAuthAccessTokenResp struct { AccessToken string `json:"access_token" validate:"required"` ExpiresIn int `json:"expires_in" validate:"required"` RefreshToken string `json:"refresh_token" validate:"required"` OpenID string `json:"openid" validate:"required"` Scope string `json:"scope" validate:"required"` }
GetOAuthAccessTokenResp GetOAuthAccessTokenResp
type GetOAuthUserInfoResp ¶ added in v0.1.5
type GetOAuthUserInfoResp struct { Openid string `json:"openid" validate:"required"` Nickname string `json:"nickname" validate:"required"` Sex int `json:"sex" validate:"required"` Province string `json:"province" validate:"required"` City string `json:"city" validate:"required"` Country string `json:"country" validate:"required"` Headimgurl string `json:"headimgurl" validate:"required"` Privilege []string `json:"privilege" validate:"required"` Unionid string `json:"unionid" validate:"required"` }
GetOAuthUserInfoResp GetOAuthUserInfoResp
type GetPreAuthCodeResp ¶
type GetPreAuthCodeResp struct { PreAuthCode string `json:"pre_auth_code" validate:"required"` ExpiresIn int `json:"expires_in" validate:"required"` }
GetPreAuthCodeResp GetPreAuthCodeResp
type GetUserInfoResp ¶ added in v0.1.4
type GetUserInfoResp struct { Subscribe int `json:"subscribe" validate:"required"` OpenID string `json:"openid" validate:"required"` Nickname string `json:"nickname" validate:"required"` Sex int `json:"sex" validate:"required"` Language string `json:"language" validate:"required"` City string `json:"city" validate:"required"` Province string `json:"province" validate:"required"` Country string `json:"country" validate:"required"` HeadImgURL string `json:"headimgurl" validate:"required"` SubscribeTime int `json:"subscribe_time" validate:"required"` UnionID string `json:"unionid" validate:"required"` Remark string `json:"remark" validate:"required"` GroupID int `json:"groupid" validate:"required"` TagidList []int `json:"tagid_list" validate:"required"` SubscribeScene string `json:"subscribe_scene" validate:"required"` QrScene int `json:"qr_scene" validate:"required"` QrSceneStr string `json:"qr_scene_str" validate:"required"` }
GetUserInfoResp GetUserInfoResp
type Merchant ¶
type Merchant struct { MchID string // 商户号 AppID string // 公众号 Key string // 密钥 ClientCert string // 客户端证书 ClientKey string // 客户端证书 Client *http.Client // 配置了证书的 HTTP 客户端 }
Merchant 商户
func NewMerchant ¶
func NewMerchant(mchID string, appID string, key string, clientCert string, clientKey string) Merchant
NewMerchant 构造方法
func (*Merchant) SendredpackResp ¶ added in v0.1.3
func (m *Merchant) SendredpackResp(totalAmount int, totalNum int, mchBillno string, sendName string, reOpenID string, wishing string, clientIP string, actName string, remark string, sceneID string, riskInfo string) (SendRedpackResp, error)
SendredpackResp 现金红包 https://pay.weixin.qq.com/wiki/doc/api/tools/cash_coupon.php?chapter=13_1
type RefreshAuthorizerAccessTokenResp ¶
type RefreshAuthorizerAccessTokenResp struct { AuthorizerAccessToken string `json:"authorizer_access_token" validate:"required"` AuthorizerRefreshToken string `json:"authorizer_refresh_token" validate:"required"` ExpiresIn int `json:"expires_in" validate:"required"` }
RefreshAuthorizerAccessTokenResp RefreshAuthorizerAccessTokenResp
type RefreshOAuthAccessTokenResp ¶ added in v0.1.5
type RefreshOAuthAccessTokenResp struct { AccessToken string `json:"access_token" validate:"required"` ExpiresIn int `json:"expires_in" validate:"required"` RefreshToken string `json:"refresh_token" validate:"required"` OpenID string `json:"openid" validate:"required"` Scope string `json:"scope" validate:"required"` }
RefreshOAuthAccessTokenResp RefreshOAuthAccessTokenResp
type SendCustomMessageResp ¶ added in v0.1.3
type SendCustomMessageResp struct { ErrCode int `json:"errcode" validate:"required"` ErrMsg string `json:"errmsg" validate:"required"` }
SendCustomMessageResp SendCustomMessageResp
type SendRedpackResp ¶
type SendRedpackResp struct { ReturnCode string `xml:"return_code" validate:"required"` ReturnMsg string `xml:"return_msg" validate:"required"` ResultCode string `xml:"result_code" validate:"required"` ErrCode string `xml:"err_code" validate:"required"` ErrCodeDes string `xml:"err_code_des" validate:"required"` MchBillno string `xml:"mch_billno" validate:"required"` MchID string `xml:"mch_id" validate:"required"` WxappID string `xml:"wxappid" validate:"required"` ReOpenID string `xml:"re_openid" validate:"required"` TotalAmount string `xml:"total_amount" validate:"required"` SendListID string `xml:"send_listid" validate:"required"` }
SendRedpackResp SendRedpackResp