物料下单测试,微信发票
This commit is contained in:
5
platformapi/weixinapi/card.go
Normal file
5
platformapi/weixinapi/card.go
Normal file
@@ -0,0 +1,5 @@
|
||||
package weixinapi
|
||||
|
||||
func GetAuthUrl() {
|
||||
|
||||
}
|
||||
1
platformapi/weixinapi/card_test.go
Normal file
1
platformapi/weixinapi/card_test.go
Normal file
@@ -0,0 +1 @@
|
||||
package weixinapi
|
||||
@@ -4,6 +4,9 @@ import "git.rosy.net.cn/baseapi/utils"
|
||||
|
||||
const (
|
||||
MaxRemarkByteCount = 30
|
||||
|
||||
ticketType = "wx_card"
|
||||
authType = 0 //Int 是 授权类型,0:开票授权,1:填写字段开票授权,2:领票授权
|
||||
)
|
||||
|
||||
type CBUserInfo struct {
|
||||
@@ -25,6 +28,13 @@ type CBUserInfo struct {
|
||||
QRSceneStr string `json:"qr_scene_str"`
|
||||
}
|
||||
|
||||
type CBTicketInfo struct {
|
||||
Errcode int `json:"errcode"`
|
||||
Errmsg string `json:"errmsg"`
|
||||
Ticket string `json:"ticket"`
|
||||
ExpiresIn int `json:"expires_in"`
|
||||
}
|
||||
|
||||
func (a *API) CBSetToken(newToken string) bool {
|
||||
curToken := a.CBGetToken()
|
||||
if curToken != newToken {
|
||||
@@ -93,3 +103,15 @@ func (a *API) CBGetUserInfo(userOpenID string) (userInfo *CBUserInfo, err error)
|
||||
}
|
||||
return userInfo, err
|
||||
}
|
||||
|
||||
//获取授权页ticket
|
||||
func (a *API) CBGetTicketInfo() (ticketInfo *CBTicketInfo, err error) {
|
||||
bodyJson := map[string]interface{}{
|
||||
"type": ticketType,
|
||||
}
|
||||
result, err := a.AccessAPI("cgi-bin/ticket/getticket", bodyJson, "")
|
||||
if err == nil {
|
||||
err = utils.Map2StructByJson(result, &ticketInfo, false)
|
||||
}
|
||||
return ticketInfo, err
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user