7
0

封装wxwork获取客服二维码

This commit is contained in:
叶 茂新 2025-10-11 16:27:35 +08:00
parent b762daa17d
commit c2606d0a41
3 changed files with 106 additions and 0 deletions

View File

@ -0,0 +1,34 @@
package wx_work
import (
"golib.gaore.com/GaoreGo/gaore-common-sdk-go/sdk"
"golib.gaore.com/GaoreGo/gaore-common-sdk-go/sdk/requests"
)
const (
VERSION = "2025-10-10"
)
var HOST = requests.Host{
Default: "wx-work.api.gaore.com",
}
type Client struct {
sdk.Client
}
func NewClient() (client *Client, err error) {
client = new(Client)
err = client.Init()
return
}
// GetVipQrCode 获取大客户跟进人二维码
func (c *Client) GetVipQrCode(req *GetVipQrCodeReq) (resp *GetVipQrCodeResp, err error) {
resp = CreateGetVipQrCodeResp()
err = c.DoAction(req, resp)
if err != nil {
return
}
return
}

View File

@ -0,0 +1,27 @@
package wx_work
import (
"fmt"
"testing"
)
func TestClient_GetVipQrCode(t *testing.T) {
client, err := NewClient()
if err != nil {
panic(err)
}
req := CreateGetVipQrCodeReq(map[string]string{
"game_sign": "xlczg",
"user_name": "test",
"game_id": "1313",
"code": "561121",
"vip": "4",
})
resp, err := client.GetVipQrCode(req)
if err != nil {
panic(err)
}
fmt.Println(resp.Code, resp.Msg, resp.Data)
}

45
services/wx-work/vip.go Normal file
View File

@ -0,0 +1,45 @@
package wx_work
import (
"golib.gaore.com/GaoreGo/gaore-common-sdk-go/sdk/requests"
"golib.gaore.com/GaoreGo/gaore-common-sdk-go/sdk/responses"
)
type GetVipQrCodeReq struct {
*requests.RpcRequest
}
type GetVipQrCodeResp struct {
*responses.BaseResponse
Code int `json:"status_code"`
Msg string `json:"status_msg"`
Data QrCode `json:"data"`
}
type QrCode struct {
QrCode string `json:"qr_code"`
Status int `json:"status"`
FollowUser string `json:"follow_user"`
}
// CreateGetVipQrCodeReq 获取大客户跟进人二维码请求
func CreateGetVipQrCodeReq(data map[string]string) *GetVipQrCodeReq {
req := &GetVipQrCodeReq{
&requests.RpcRequest{},
}
req.InitWithApiInfo(HOST, VERSION, "/v1/vip/qr_code")
req.Method = requests.POST
req.FormParams = data
if req.FormParams == nil {
req.FormParams = make(map[string]string)
}
return req
}
// CreateGetVipQrCodeResp 获取大客户跟进人二维码
func CreateGetVipQrCodeResp() *GetVipQrCodeResp {
return &GetVipQrCodeResp{
BaseResponse: &responses.BaseResponse{},
}
}