7
0

新增pay项目微信工单图片上传接口、回复接口、完成接口

This commit is contained in:
明炜 卢 2024-06-04 10:09:26 +08:00
parent afb120c6f4
commit de3c82cbff
5 changed files with 188 additions and 0 deletions

56
services/pay/client.go Normal file
View File

@ -0,0 +1,56 @@
package pay
import (
"golib.gaore.com/GaoreGo/gaore-common-sdk-go/sdk"
"golib.gaore.com/GaoreGo/gaore-common-sdk-go/sdk/requests"
)
const (
VERSION = "2024-06-03"
)
var HOST requests.Host = requests.Host{
Default: "pay.gaore.com",
Func: func(s string) string {
var a = map[string]string{
requests.RELEASE: "pay.gaore.com",
requests.PRE: "pay.gaore.com",
requests.TEST: "pay.gaore.com",
}
return a[s]
},
}
type Client struct {
sdk.Client
}
func NewClientWithAccessKey(accesskey, secrect, source string) (client *Client, err error) {
client = &Client{}
err = client.InitWithAccessKey(accesskey, secrect, source)
return
}
func NewClientWithAliAppcode(accesskey, secrect string, env ...string) (client *Client, err error) {
client = &Client{}
err = client.InitWithAliAppcode(accesskey, secrect, env...)
return
}
func (c *Client) ComplaintReply(req *ComplaintReplyRequest) (response *ComplaintReplyResponse, err error) {
response = CreateComplaintReplyResponse()
err = c.DoAction(req, response)
return
}
func (c *Client) ComplaintComplete(req *ComplaintCompleteRequest) (response *ComplaintCompleteResponse, err error) {
response = CreateComplaintCompleteResponse()
err = c.DoAction(req, response)
return
}
func (c *Client) ComplaintUpload(req *ComplaintUploadRequest) (response *ComplaintUploadResponse, err error) {
response = CreateComplaintUploadResponse()
err = c.DoAction(req, response)
return
}

View File

@ -0,0 +1,27 @@
package pay
import (
"fmt"
"log"
"testing"
)
func TestClient_GetUserInfo(t *testing.T) {
c, err := NewClientWithAliAppcode("", "")
if err != nil {
t.Error(err)
}
req := CreateComplaintUploadRequest()
req.MchId = "3503"
req.ImageUrl = "https://img-blog.csdnimg.cn/20201014180756925.png?x-oss-process=image/resize,m_fixed,h_64,w_64"
resp, err := c.ComplaintUpload(req)
if err != nil {
log.Fatalln(err)
}
fmt.Println(resp.GetHttpContentString())
fmt.Println(resp.GetHttpHeaders())
}

View File

@ -0,0 +1,34 @@
package pay
import (
"golib.gaore.com/GaoreGo/gaore-common-sdk-go/sdk/requests"
"golib.gaore.com/GaoreGo/gaore-common-sdk-go/sdk/responses"
)
type ComplaintCompleteRequest struct {
*requests.RpcRequest
MchId string `position:"Body" field:"mch_id" default:"" `
ComplaintId string `position:"Body" field:"complaint_id" default:"" `
}
type ComplaintCompleteResponse struct {
*responses.BaseResponse
Code int `json:"code"`
Msg string `json:"msg"`
}
func CreateComplaintCompleteRequest() (req *ComplaintCompleteRequest) {
req = &ComplaintCompleteRequest{
RpcRequest: &requests.RpcRequest{},
}
req.InitWithApiInfo(HOST, VERSION, "/api/complaint/wxComplaintComplete")
req.Method = requests.POST
return
}
func CreateComplaintCompleteResponse() (response *ComplaintCompleteResponse) {
response = &ComplaintCompleteResponse{
BaseResponse: &responses.BaseResponse{},
}
return
}

View File

@ -0,0 +1,36 @@
package pay
import (
"golib.gaore.com/GaoreGo/gaore-common-sdk-go/sdk/requests"
"golib.gaore.com/GaoreGo/gaore-common-sdk-go/sdk/responses"
)
type ComplaintReplyRequest struct {
*requests.RpcRequest
MchId string `position:"Body" field:"mch_id" default:"" `
ComplaintId string `position:"Body" field:"complaint_id" default:"" `
Content string `position:"Body" field:"content" default:"" `
Images string `position:"Body" field:"images" default:"" `
}
type ComplaintReplyResponse struct {
*responses.BaseResponse
Code int `json:"code"`
Msg string `json:"msg"`
}
func CreateComplaintReplyRequest() (req *ComplaintReplyRequest) {
req = &ComplaintReplyRequest{
RpcRequest: &requests.RpcRequest{},
}
req.InitWithApiInfo(HOST, VERSION, "/api/complaint/wxComplaintReply")
req.Method = requests.POST
return
}
func CreateComplaintReplyResponse() (response *ComplaintReplyResponse) {
response = &ComplaintReplyResponse{
BaseResponse: &responses.BaseResponse{},
}
return
}

View File

@ -0,0 +1,35 @@
package pay
import (
"golib.gaore.com/GaoreGo/gaore-common-sdk-go/sdk/requests"
"golib.gaore.com/GaoreGo/gaore-common-sdk-go/sdk/responses"
)
type ComplaintUploadRequest struct {
*requests.RpcRequest
MchId string `position:"Body" field:"mch_id" default:"" `
ImageUrl string `position:"Body" field:"image_url" default:"" `
}
type ComplaintUploadResponse struct {
*responses.BaseResponse
Code int `json:"code"`
Msg string `json:"msg"`
Data map[string]string `json:"data"`
}
func CreateComplaintUploadRequest() (req *ComplaintUploadRequest) {
req = &ComplaintUploadRequest{
RpcRequest: &requests.RpcRequest{},
}
req.InitWithApiInfo(HOST, VERSION, "/api/complaint/wxComplaintUpload")
req.Method = requests.POST
return
}
func CreateComplaintUploadResponse() (response *ComplaintUploadResponse) {
response = &ComplaintUploadResponse{
BaseResponse: &responses.BaseResponse{},
}
return
}