Documentation ¶
Index ¶
- Constants
- func GenerateXml(bm gopay.BodyMap) (reqXml string)
- func GetReleaseSign(apiKey string, signType string, bm gopay.BodyMap) (sign string)
- func ParseNotifyToBodyMap(req *http.Request) (bm gopay.BodyMap, err error)
- func VerifySign(apiKey, signType string, bean any) (ok bool, err error)
- type AccessToken
- type Client
- func (q *Client) AccRoll(ctx context.Context, bm gopay.BodyMap) (qqRsp string, err error)
- func (q *Client) AddCertFileContent(certFileContent, keyFileContent, pkcs12FileContent []byte) (err error)
- func (q *Client) AddCertFilePath(certFilePath, keyFilePath, pkcs12FilePath any) (err error)
- func (q *Client) CloseOrder(ctx context.Context, bm gopay.BodyMap) (qqRsp *CloseOrderResponse, err error)
- func (q *Client) DownloadRedListFile(ctx context.Context, bm gopay.BodyMap) (qqRsp string, err error)
- func (q *Client) MicroPay(ctx context.Context, bm gopay.BodyMap) (qqRsp *MicroPayResponse, err error)
- func (q *Client) OrderQuery(ctx context.Context, bm gopay.BodyMap) (qqRsp *OrderQueryResponse, err error)
- func (q *Client) PostQQAPISelf(ctx context.Context, bm gopay.BodyMap, url string, tlsConfig *tls.Config) (bs []byte, err error)
- func (q *Client) QueryRedInfo(ctx context.Context, bm gopay.BodyMap) (qqRsp *QueryRedInfoResponse, err error)
- func (q *Client) Refund(ctx context.Context, bm gopay.BodyMap, ...) (qqRsp *RefundResponse, err error)
- func (q *Client) RefundQuery(ctx context.Context, bm gopay.BodyMap) (qqRsp *RefundQueryResponse, err error)
- func (q *Client) Reverse(ctx context.Context, bm gopay.BodyMap) (qqRsp *ReverseResponse, err error)
- func (q *Client) SendCashRed(ctx context.Context, bm gopay.BodyMap) (qqRsp *SendCashRedResponse, err error)
- func (q *Client) SetBodySize(sizeMB int)
- func (q *Client) SetHttpClient(client *xhttp.Client)
- func (q *Client) SetLogger(logger xlog.XLogger)
- func (q *Client) SetTLSHttpClient(client *xhttp.Client)
- func (q *Client) StatementDown(ctx context.Context, bm gopay.BodyMap) (qqRsp string, err error)
- func (q *Client) UnifiedOrder(ctx context.Context, bm gopay.BodyMap) (qqRsp *UnifiedOrderResponse, err error)
- type CloseOrderResponse
- type Detail
- type MicroPayResponse
- type NotifyRequest
- type NotifyResponse
- type OpenIdInfo
- type OrderQueryResponse
- type QueryRedInfoResponse
- type RefundQueryResponse
- type RefundResponse
- type ReverseResponse
- type SendCashRedResponse
- type UnifiedOrderResponse
- type UserInfo
Constants ¶
const ( // 支付类型 TradeType_MicroPay = "MICROPAY" // 提交付款码支付 TradeType_JsApi = "JSAPI" // 公众号支付 TradeType_Native = "NATIVE" // 原生扫码支付 TradeType_App = "APP" // APP支付 TradeType_Mini = "MINIAPP" // QQ小程序支付 // 签名方式 SignType_MD5 = "MD5" SignType_HMAC_SHA256 = "HMAC-SHA256" )
Variables ¶
This section is empty.
Functions ¶
func GenerateXml ¶ added in v1.5.97
生成请求XML的Body体
func GetReleaseSign ¶ added in v1.5.65
获取QQ支付正式环境Sign值
func ParseNotifyToBodyMap ¶
ParseNotifyToBodyMap 解析QQ支付异步通知的结果到BodyMap req:*http.Request 返回参数bm:Notify请求的参数 返回参数err:错误信息
Types ¶
type AccessToken ¶ added in v1.5.60
type AccessToken struct { AccessToken string `json:"access_token,omitempty"` ExpiresIn string `json:"expires_in,omitempty"` RefreshToken string `json:"refresh_token,omitempty"` }
获取开放平台,access_token 返回结构体
func GetAccessToken ¶ added in v1.5.60
func GetAccessToken(ctx context.Context, appId, appSecret, code, redirectUri string) (accessToken *AccessToken, err error)
参数 是否必须 含义 grant_type 必须 授权类型,在本步骤中,此值为“authorization_code”。 client_id 必须 申请QQ登录成功后,分配给网站的appid。 client_secret 必须 申请QQ登录成功后,分配给网站的appkey。 code 必须 上一步返回的authorization code。 如果用户成功登录并授权,则会跳转到指定的回调地址,并在URL中带上Authorization Code。 例如,回调地址为www.qq.com/my.php,则跳转到: http://www.qq.com/my.php?code=520DD95263C1CFEA087****** 注意此code会在10分钟内过期。 redirect_uri 必须 与上面一步中传入的redirect_uri保持一致。 fmt 可选 因历史原因,默认是x-www-form-urlencoded格式,如果填写json,则返回json格式 文档:https://wiki.connect.qq.com/%E4%BD%BF%E7%94%A8authorization_code%E8%8E%B7%E5%8F%96access_token#Step2.EF.BC.9A.E9.80.9A.E8.BF.87AuthorizationCode.E8.8E.B7.E5.8F.96AccessToken
type Client ¶
type Client struct { MchId string ApiKey string IsProd bool DebugSwitch gopay.DebugSwitch // contains filtered or unexported fields }
func (*Client) AccRoll ¶
资金账单 文档地址:https://qpay.qq.com/buss/wiki/38/3089
func (*Client) AddCertFileContent ¶
func (q *Client) AddCertFileContent(certFileContent, keyFileContent, pkcs12FileContent []byte) (err error)
添加QQ证书内容 certFileContent:apiclient_cert.pem 内容 keyFileContent:apiclient_key.pem 内容 pkcs12FileContent:apiclient_cert.p12 内容 返回err
func (*Client) AddCertFilePath ¶
添加QQ证书 Path 路径 certFilePath:apiclient_cert.pem 路径 keyFilePath:apiclient_key.pem 路径 pkcs12FilePath:apiclient_cert.p12 路径 返回err
func (*Client) CloseOrder ¶
func (q *Client) CloseOrder(ctx context.Context, bm gopay.BodyMap) (qqRsp *CloseOrderResponse, err error)
关闭订单 文档地址:https://qpay.qq.com/buss/wiki/38/1206
func (*Client) DownloadRedListFile ¶
func (q *Client) DownloadRedListFile(ctx context.Context, bm gopay.BodyMap) (qqRsp string, err error)
DownloadRedListFile 对账单下载
注意:data类型为int类型,例如:date=20200909,2020年9月9日 文档:https://qpay.qq.com/buss/wiki/221/1224
func (*Client) MicroPay ¶
func (q *Client) MicroPay(ctx context.Context, bm gopay.BodyMap) (qqRsp *MicroPayResponse, err error)
提交付款码支付 文档地址:https://qpay.qq.com/buss/wiki/1/1122
func (*Client) OrderQuery ¶
func (q *Client) OrderQuery(ctx context.Context, bm gopay.BodyMap) (qqRsp *OrderQueryResponse, err error)
订单查询 文档地址:https://qpay.qq.com/buss/wiki/38/1205
func (*Client) PostQQAPISelf ¶
func (q *Client) PostQQAPISelf(ctx context.Context, bm gopay.BodyMap, url string, tlsConfig *tls.Config) (bs []byte, err error)
向QQ发送Post请求,对于本库未提供的QQ API,可自行实现,通过此方法发送请求 bm:请求参数的BodyMap url:完整url地址,例如:https://qpay.qq.com/cgi-bin/pay/qpay_unified_order.cgi tlsConfig:tls配置,如无需证书请求,传nil
func (*Client) QueryRedInfo ¶
func (q *Client) QueryRedInfo(ctx context.Context, bm gopay.BodyMap) (qqRsp *QueryRedInfoResponse, err error)
QueryRedInfo 查询红包详情
文档:https://qpay.qq.com/buss/wiki/221/2174
func (*Client) Refund ¶
func (q *Client) Refund(ctx context.Context, bm gopay.BodyMap, certFilePath, keyFilePath, pkcs12FilePath any) (qqRsp *RefundResponse, err error)
申请退款 注意:如已使用client.AddCertFilePath()添加过证书,参数certFilePath、keyFilePath、pkcs12FilePath全传空字符串 nil,否则,3证书Path均不可空 文档地址:https://qpay.qq.com/buss/wiki/38/1207
func (*Client) RefundQuery ¶
func (q *Client) RefundQuery(ctx context.Context, bm gopay.BodyMap) (qqRsp *RefundQueryResponse, err error)
退款查询 文档地址:https://qpay.qq.com/buss/wiki/38/1208
func (*Client) Reverse ¶
撤销订单 文档地址:https://qpay.qq.com/buss/wiki/1/1125
func (*Client) SendCashRed ¶
func (q *Client) SendCashRed(ctx context.Context, bm gopay.BodyMap) (qqRsp *SendCashRedResponse, err error)
SendCashRed 创建现金红包 注意:如已使用client.AddCertFilePath()添加过证书,参数certFilePath、keyFilePath、pkcs12FilePath全传 nil,否则,3证书Path均不可空 文档:https://qpay.qq.com/buss/wiki/221/1220
func (*Client) SetBodySize ¶ added in v1.5.82
SetBodySize 设置http response body size(MB)
func (*Client) SetHttpClient ¶ added in v1.5.103
SetHttpClient 设置自定义的xhttp.Client
func (*Client) SetTLSHttpClient ¶ added in v1.5.103
SetTLSHttpClient 设置自定义的xhttp.Client
func (*Client) StatementDown ¶
交易账单 文档地址:https://qpay.qq.com/buss/wiki/38/1209
func (*Client) UnifiedOrder ¶
func (q *Client) UnifiedOrder(ctx context.Context, bm gopay.BodyMap) (qqRsp *UnifiedOrderResponse, err error)
统一下单 文档地址:https://qpay.qq.com/buss/wiki/38/1203
type CloseOrderResponse ¶
type CloseOrderResponse struct { ReturnCode string `xml:"return_code,omitempty" json:"return_code,omitempty"` ReturnMsg string `xml:"return_msg,omitempty" json:"return_msg,omitempty"` RetCode string `xml:"retcode,omitempty" json:"retcode,omitempty"` RetMsg string `xml:"retmsg,omitempty" json:"retmsg,omitempty"` Appid string `xml:"appid,omitempty" json:"appid,omitempty"` MchId string `xml:"mch_id,omitempty" json:"mch_id,omitempty"` Sign string `xml:"sign,omitempty" json:"sign,omitempty"` ResultCode string `xml:"result_code,omitempty" json:"result_code,omitempty"` ErrCode string `xml:"err_code,omitempty" json:"err_code,omitempty"` ErrCodeDes string `xml:"err_code_des,omitempty" json:"err_code_des,omitempty"` NonceStr string `xml:"nonce_str,omitempty" json:"nonce_str,omitempty"` }
type MicroPayResponse ¶
type MicroPayResponse struct { ReturnCode string `xml:"return_code,omitempty" json:"return_code,omitempty"` ReturnMsg string `xml:"return_msg,omitempty" json:"return_msg,omitempty"` RetCode string `xml:"retcode,omitempty" json:"retcode,omitempty"` RetMsg string `xml:"retmsg,omitempty" json:"retmsg,omitempty"` Appid string `xml:"appid,omitempty" json:"appid,omitempty"` MchId string `xml:"mch_id,omitempty" json:"mch_id,omitempty"` Sign string `xml:"sign,omitempty" json:"sign,omitempty"` ResultCode string `xml:"result_code,omitempty" json:"result_code,omitempty"` ErrCode string `xml:"err_code,omitempty" json:"err_code,omitempty"` ErrCodeDes string `xml:"err_code_des,omitempty" json:"err_code_des,omitempty"` NonceStr string `xml:"nonce_str,omitempty" json:"nonce_str,omitempty"` DeviceInfo string `xml:"device_info,omitempty" json:"device_info,omitempty"` TradeType string `xml:"trade_type,omitempty" json:"trade_type,omitempty"` TradeState string `xml:"trade_state,omitempty" json:"trade_state,omitempty"` BankType string `xml:"bank_type,omitempty" json:"bank_type,omitempty"` FeeType string `xml:"fee_type,omitempty" json:"fee_type,omitempty"` TotalFee string `xml:"total_fee,omitempty" json:"total_fee,omitempty"` CashFee string `xml:"cash_fee,omitempty" json:"cash_fee,omitempty"` CouponFee string `xml:"coupon_fee,omitempty" json:"coupon_fee,omitempty"` CouponFee0 string `xml:"coupon_fee_0,omitempty" json:"coupon_fee_0,omitempty"` CouponFee1 string `xml:"coupon_fee_1,omitempty" json:"coupon_fee_1,omitempty"` TransactionId string `xml:"transaction_id,omitempty" json:"transaction_id,omitempty"` OutTradeNo string `xml:"out_trade_no,omitempty" json:"out_trade_no,omitempty"` Attach string `xml:"attach,omitempty" json:"attach,omitempty"` TimeEnd string `xml:"time_end,omitempty" json:"time_end,omitempty"` TradeStateDesc string `xml:"trade_state_desc,omitempty" json:"trade_state_desc,omitempty"` Openid string `xml:"openid,omitempty" json:"openid,omitempty"` }
type NotifyRequest ¶
type NotifyRequest struct { Appid string `xml:"appid,omitempty" json:"appid,omitempty"` MchId string `xml:"mch_id,omitempty" json:"mch_id,omitempty"` NonceStr string `xml:"nonce_str,omitempty" json:"nonce_str,omitempty"` Sign string `xml:"sign,omitempty" json:"sign,omitempty"` DeviceInfo string `xml:"device_info,omitempty" json:"device_info,omitempty"` TradeType string `xml:"trade_type,omitempty" json:"trade_type,omitempty"` TradeState string `xml:"trade_state,omitempty" json:"trade_state,omitempty"` BankType string `xml:"bank_type,omitempty" json:"bank_type,omitempty"` FeeType string `xml:"fee_type,omitempty" json:"fee_type,omitempty"` TotalFee string `xml:"total_fee,omitempty" json:"total_fee,omitempty"` CashFee string `xml:"cash_fee,omitempty" json:"cash_fee,omitempty"` CouponFee string `xml:"coupon_fee,omitempty" json:"coupon_fee,omitempty"` TransactionId string `xml:"transaction_id,omitempty" json:"transaction_id,omitempty"` OutTradeNo string `xml:"out_trade_no,omitempty" json:"out_trade_no,omitempty"` Attach string `xml:"attach,omitempty" json:"attach,omitempty"` TimeEnd string `xml:"time_end,omitempty" json:"time_end,omitempty"` Openid string `xml:"openid,omitempty" json:"openid,omitempty"` }
func ParseNotify ¶
func ParseNotify(req *http.Request) (notifyReq *NotifyRequest, err error)
Deprecated 推荐使用 ParseNotifyToBodyMap
type NotifyResponse ¶
type NotifyResponse struct { ReturnCode string `xml:"return_code"` ReturnMsg string `xml:"return_msg"` }
func (*NotifyResponse) ToXmlString ¶
func (w *NotifyResponse) ToXmlString() (xmlStr string)
ToXmlString 返回数据给QQ
type OpenIdInfo ¶ added in v1.5.60
type OpenIdInfo struct { ClientId string `json:"client_id,omitempty"` // 用户ClientID OpenId string `json:"openid,omitempty"` // 用户OpenID UnionId string `json:"unionid,omitempty"` // 用户UnionID Error int `json:"error,omitempty"` // 错误代码 ErrorDescription string `json:"error_description,omitempty"` // 错误描述 }
获取开放平台,access_token 返回结构体
func GetOpenId ¶ added in v1.5.60
func GetOpenId(ctx context.Context, accessToken string, lang ...string) (openid *OpenIdInfo, err error)
GetOpenId QQ开放平台:使用Access Token来获取用户的OpenID accessToken:接口调用凭据 openId:用户的OpenID oauthConsumerKey:AppID lang:默认为 zh_CN ,可选填 zh_CN 简体,zh_TW 繁体,en 英语 文档:https://wiki.open.qq.com/wiki/website/%E5%BC%80%E5%8F%91%E6%94%BB%E7%95%A5_Server-side#Step2.EF.BC.9A.E8.8E.B7.E5.8F.96Authorization_Code
type OrderQueryResponse ¶
type OrderQueryResponse struct { ReturnCode string `xml:"return_code,omitempty" json:"return_code,omitempty"` ReturnMsg string `xml:"return_msg,omitempty" json:"return_msg,omitempty"` RetCode string `xml:"retcode,omitempty" json:"retcode,omitempty"` RetMsg string `xml:"retmsg,omitempty" json:"retmsg,omitempty"` Appid string `xml:"appid,omitempty" json:"appid,omitempty"` MchId string `xml:"mch_id,omitempty" json:"mch_id,omitempty"` Sign string `xml:"sign,omitempty" json:"sign,omitempty"` ResultCode string `xml:"result_code,omitempty" json:"result_code,omitempty"` ErrCode string `xml:"err_code,omitempty" json:"err_code,omitempty"` ErrCodeDes string `xml:"err_code_des,omitempty" json:"err_code_des,omitempty"` NonceStr string `xml:"nonce_str,omitempty" json:"nonce_str,omitempty"` DeviceInfo string `xml:"device_info,omitempty" json:"device_info,omitempty"` TradeType string `xml:"trade_type,omitempty" json:"trade_type,omitempty"` TradeState string `xml:"trade_state,omitempty" json:"trade_state,omitempty"` BankType string `xml:"bank_type,omitempty" json:"bank_type,omitempty"` FeeType string `xml:"fee_type,omitempty" json:"fee_type,omitempty"` TotalFee string `xml:"total_fee,omitempty" json:"total_fee,omitempty"` CashFee string `xml:"cash_fee,omitempty" json:"cash_fee,omitempty"` CouponFee string `xml:"coupon_fee,omitempty" json:"coupon_fee,omitempty"` TransactionId string `xml:"transaction_id,omitempty" json:"transaction_id,omitempty"` OutTradeNo string `xml:"out_trade_no,omitempty" json:"out_trade_no,omitempty"` Attach string `xml:"attach,omitempty" json:"attach,omitempty"` TimeEnd string `xml:"time_end,omitempty" json:"time_end,omitempty"` TradeStateDesc string `xml:"trade_state_desc,omitempty" json:"trade_state_desc,omitempty"` Openid string `xml:"openid,omitempty" json:"openid,omitempty"` }
type QueryRedInfoResponse ¶
type QueryRedInfoResponse struct { Result string `xml:"result,omitempty" json:"result,omitempty"` ResInfo string `xml:"res_info,omitempty" json:"res_info,omitempty"` Listid string `xml:"listid,omitempty" json:"listid,omitempty"` State string `xml:"state,omitempty" json:"state,omitempty"` TotalNum string `xml:"total_num,omitempty" json:"total_num,omitempty"` RecvNum string `xml:"recv_num,omitempty" json:"recv_num,omitempty"` TotalAmount string `xml:"total_amount,omitempty" json:"total_amount,omitempty"` RecvAmount string `xml:"recv_amount,omitempty" json:"recv_amount,omitempty"` RecvDetails *Detail `xml:"recv_details,omitempty" json:"recv_details,omitempty"` }
type RefundQueryResponse ¶
type RefundQueryResponse struct { ReturnCode string `xml:"return_code,omitempty" json:"return_code,omitempty"` ReturnMsg string `xml:"return_msg,omitempty" json:"return_msg,omitempty"` RetCode string `xml:"retcode,omitempty" json:"retcode,omitempty"` RetMsg string `xml:"retmsg,omitempty" json:"retmsg,omitempty"` Appid string `xml:"appid,omitempty" json:"appid,omitempty"` MchId string `xml:"mch_id,omitempty" json:"mch_id,omitempty"` Sign string `xml:"sign,omitempty" json:"sign,omitempty"` ResultCode string `xml:"result_code,omitempty" json:"result_code,omitempty"` ErrCode string `xml:"err_code,omitempty" json:"err_code,omitempty"` ErrCodeDes string `xml:"err_code_des,omitempty" json:"err_code_des,omitempty"` NonceStr string `xml:"nonce_str,omitempty" json:"nonce_str,omitempty"` TransactionId string `xml:"transaction_id,omitempty" json:"transaction_id,omitempty"` OutTradeNo string `xml:"out_trade_no,omitempty" json:"out_trade_no,omitempty"` TotalFee string `xml:"total_fee,omitempty" json:"total_fee,omitempty"` CashFee string `xml:"cash_fee,omitempty" json:"cash_fee,omitempty"` FeeType string `xml:"fee_type,omitempty" json:"fee_type,omitempty"` OutRefundNo0 string `xml:"out_refund_no_0,omitempty" json:"out_refund_no_0,omitempty"` OutRefundNo1 string `xml:"out_refund_no_1,omitempty" json:"out_refund_no_1,omitempty"` RefundId0 string `xml:"refund_id_0,omitempty" json:"refund_id_0,omitempty"` RefundId1 string `xml:"refund_id_1,omitempty" json:"refund_id_1,omitempty"` RefundChannel0 string `xml:"refund_channel_0,omitempty" json:"refund_channel_0,omitempty"` RefundChannel1 string `xml:"refund_channel_1,omitempty" json:"refund_channel_1,omitempty"` RefundFee0 string `xml:"refund_fee_0,omitempty" json:"refund_fee_0,omitempty"` RefundFee1 string `xml:"refund_fee_1,omitempty" json:"refund_fee_1,omitempty"` CouponRefundFee0 string `xml:"coupon_refund_fee_0,omitempty" json:"coupon_refund_fee_0,omitempty"` CouponRefundFee1 string `xml:"coupon_refund_fee_1,omitempty" json:"coupon_refund_fee_1,omitempty"` CashRefundFee0 string `xml:"cash_refund_fee_0,omitempty" json:"cash_refund_fee_0,omitempty"` CashRefundFee1 string `xml:"cash_refund_fee_1,omitempty" json:"cash_refund_fee_1,omitempty"` RefundStatus0 string `xml:"refund_status_0,omitempty" json:"refund_status_0,omitempty"` RefundStatus1 string `xml:"refund_status_1,omitempty" json:"refund_status_1,omitempty"` RefundRecvAccout0 string `xml:"refund_recv_accout_0,omitempty" json:"refund_recv_accout_0,omitempty"` RefundRecvAccout1 string `xml:"refund_recv_accout_1,omitempty" json:"refund_recv_accout_1,omitempty"` }
type RefundResponse ¶
type RefundResponse struct { ReturnCode string `xml:"return_code,omitempty" json:"return_code,omitempty"` ReturnMsg string `xml:"return_msg,omitempty" json:"return_msg,omitempty"` RetCode string `xml:"retcode,omitempty" json:"retcode,omitempty"` RetMsg string `xml:"retmsg,omitempty" json:"retmsg,omitempty"` Appid string `xml:"appid,omitempty" json:"appid,omitempty"` MchId string `xml:"mch_id,omitempty" json:"mch_id,omitempty"` Sign string `xml:"sign,omitempty" json:"sign,omitempty"` ResultCode string `xml:"result_code,omitempty" json:"result_code,omitempty"` ErrCode string `xml:"err_code,omitempty" json:"err_code,omitempty"` ErrCodeDes string `xml:"err_code_des,omitempty" json:"err_code_des,omitempty"` NonceStr string `xml:"nonce_str,omitempty" json:"nonce_str,omitempty"` TransactionId string `xml:"transaction_id,omitempty" json:"transaction_id,omitempty"` OutTradeNo string `xml:"out_trade_no,omitempty" json:"out_trade_no,omitempty"` TotalFee string `xml:"total_fee,omitempty" json:"total_fee,omitempty"` OutRefundNo string `xml:"out_refund_no,omitempty" json:"out_refund_no,omitempty"` RefundId string `xml:"refund_id,omitempty" json:"refund_id,omitempty"` RefundChannel string `xml:"refund_channel,omitempty" json:"refund_channel,omitempty"` RefundFee string `xml:"refund_fee,omitempty" json:"refund_fee,omitempty"` }
type ReverseResponse ¶
type ReverseResponse struct { ReturnCode string `xml:"return_code,omitempty" json:"return_code,omitempty"` ReturnMsg string `xml:"return_msg,omitempty" json:"return_msg,omitempty"` RetCode string `xml:"retcode,omitempty" json:"retcode,omitempty"` RetMsg string `xml:"retmsg,omitempty" json:"retmsg,omitempty"` Appid string `xml:"appid,omitempty" json:"appid,omitempty"` SubAppid string `xml:"sub_appid,omitempty" json:"sub_appid,omitempty"` MchId string `xml:"mch_id,omitempty" json:"mch_id,omitempty"` SubMchId string `xml:"sub_mch_id,omitempty" json:"sub_mch_id,omitempty"` Sign string `xml:"sign,omitempty" json:"sign,omitempty"` ResultCode string `xml:"result_code,omitempty" json:"result_code,omitempty"` ErrCode string `xml:"err_code,omitempty" json:"err_code,omitempty"` ErrCodeDes string `xml:"err_code_des,omitempty" json:"err_code_des,omitempty"` NonceStr string `xml:"nonce_str,omitempty" json:"nonce_str,omitempty"` Recall string `json:"recall,omitempty"` }
type SendCashRedResponse ¶
type SendCashRedResponse struct { ReturnCode string `xml:"return_code,omitempty" json:"return_code,omitempty"` ReturnMsg string `xml:"return_msg,omitempty" json:"return_msg,omitempty"` RetCode string `xml:"retcode,omitempty" json:"retcode,omitempty"` RetMsg string `xml:"retmsg,omitempty" json:"retmsg,omitempty"` Listid string `xml:"listid,omitempty" json:"listid,omitempty"` }
type UnifiedOrderResponse ¶
type UnifiedOrderResponse struct { ReturnCode string `xml:"return_code,omitempty" json:"return_code,omitempty"` ReturnMsg string `xml:"return_msg,omitempty" json:"return_msg,omitempty"` RetCode string `xml:"retcode,omitempty" json:"retcode,omitempty"` RetMsg string `xml:"retmsg,omitempty" json:"retmsg,omitempty"` Appid string `xml:"appid,omitempty" json:"appid,omitempty"` MchId string `xml:"mch_id,omitempty" json:"mch_id,omitempty"` Sign string `xml:"sign,omitempty" json:"sign,omitempty"` ResultCode string `xml:"result_code,omitempty" json:"result_code,omitempty"` ErrCode string `xml:"err_code,omitempty" json:"err_code,omitempty"` ErrCodeDes string `xml:"err_code_des,omitempty" json:"err_code_des,omitempty"` NonceStr string `xml:"nonce_str,omitempty" json:"nonce_str,omitempty"` TradeType string `xml:"trade_type,omitempty" json:"trade_type,omitempty"` PrepayId string `xml:"prepay_id,omitempty" json:"prepay_id,omitempty"` CodeUrl string `xml:"code_url,omitempty" json:"code_url,omitempty"` }
type UserInfo ¶ added in v1.5.60
type UserInfo struct { Ret int `json:"sex,omitempty"` // 返回码 Msg string `json:"msg,omitempty"` // 如果ret<0,会有相应的错误信息提示,返回数据全部用UTF-8编码。 Nickname string `json:"nickname,omitempty"` // 用户在QQ空间的昵称。 Figureurl string `json:"figureurl,omitempty"` // 大小为30×30像素的QQ空间头像URL。 Figureurl1 string `json:"figureurl_1,omitempty"` // 大小为50×50像素的QQ空间头像URL。 Figureurl2 string `json:"figureurl_2,omitempty"` // 大小为100×100像素的QQ空间头像URL。 FigureurlQq1 string `json:"figureurl_qq_1,omitempty"` // 大小为40×40像素的QQ头像URL。 FigureurlQq2 string `json:"figureurl_qq_2,omitempty"` // 大小为100×100像素的QQ头像URL。需要注意,不是所有的用户都拥有QQ的100x100的头像,但40x40像素则是一定会有。 Gender string `json:"gender,omitempty"` // 性别。 如果获取不到则默认返回"男" IsYellowVip string `json:"is_yellow_vip,omitempty"` // 标识用户是否为黄钻用户(0:不是;1:是)。 Vip string `json:"vip,omitempty"` // 标识用户是否为黄钻用户(0:不是;1:是) YellowVipLevel string `json:"yellow_vip_level,omitempty"` // 黄钻等级 Level string `json:"level,omitempty"` // 黄钻等级 IsYellowYearVip string `json:"is_yellow_year_vip,omitempty"` // 标识是否为年费黄钻用户(0:不是; 1:是) }
QQ开放平台用户信息
func GetUserInfo ¶ added in v1.5.60
func GetUserInfo(ctx context.Context, accessToken, openId string, oauthConsumerKey string, lang ...string) (userInfo *UserInfo, err error)
GetUserInfo QQ开放平台:获取用户个人信息 accessToken:接口调用凭据 openId:用户的OpenID oauthConsumerKey:AppID lang:默认为 zh_CN ,可选填 zh_CN 简体,zh_TW 繁体,en 英语 文档:https://wiki.open.qq.com/wiki/website/get_user_info