对接新供应链-唯品尚

This commit is contained in:
zhongqiang 2025-05-26 09:53:44 +08:00
parent c5b73fb675
commit 96c87f015d
3 changed files with 47 additions and 46 deletions

View File

@ -2,17 +2,12 @@ package weipinshang_api
type CreateAfsApplyReq struct {
McOrderNo int `json:"mcOrderNo"` // 子订单号 是 int 下单时候返回子订单号 20190704124955600363
CustomerExpect int `json:"customerExpect"` // 售后类型 是 int [退货(10)、仅退款(40)] 10
QuestionDesc string `json:"questionDesc"` // 原因描述 否 String [产品问题描述最多600字符] 看下面请求示例
QuestionPic string `json:"questionPic"` //问题描述图片 否 String [问题描述图片.最多2000字符] 支持多张图片,用逗号分隔(英文逗号)
CustomerContactName string `json:"customerContactName"` // 用户姓名 是 String [用户姓名] 张三
CustomerTel string `json:"customerTel"` // 用户电话 是 String [用户电话] 18533136240
CustomerMobilePhone string `json:"customerMobilePhone"` // 用户手机 是 String [用户手机] 18533136240
PickwareProvince string `json:"pickwareProvince"` //省份 是 String [省份] 湖南
PickwareCity string `json:"pickwareCity"` // 城市 是 String [城市] 长沙
PickwareCounty string `json:"pickwareCounty"` // 县区 是 String [县区] 芙蓉区

View File

@ -3,21 +3,15 @@ package weipinshang_api
type GetOrderInfoRes struct {
Code int `json:"code"` // 0为成功其它为失败
Msg string `json:"msg"` // 请求接口消息
Data []Data `json:"data"` // 返回数据 data array
}
type Data struct {
CThirdUserCode string `json:"c_third_user_code"` // 用户编码
COrderNoThird string `json:"c_order_no_third"` // 渠道订单号
COrderNoPayservice string `json:"c_order_no_payservice"` //支付订单号
CSendStatus string `json:"c_send_status"` // 订单状态 订单所处阶段【CHECKED订单被创建,INSTOCK已备货,SENDED已发货,RECEIVED已收货
CIsPay int `json:"c_is_pay"` // 支付状态(0-未支付1-已支付)
CIsClose int `json:"c_is_close"` // 关闭状态 c_is_close 是否关闭【0未关闭1,已经关闭】
CShouldPay float64 `json:"c_should_pay"` // 订单应付金额 单位:元
CRealPay float64 `json:"c_real_pay"` // 实际支付金额 c_real_pay 单位:元
CMessage string `json:"c_message"` // 订单留言
@ -30,7 +24,6 @@ type Data struct {
CReceiveDatetime string `json:"c_receive_datetime"` // 订单确认收货时间
CReceiverName string `json:"c_receiver_name"` // 收货人姓名
CReceiverMobile string `json:"c_receiver_mobile"` // 收货人联系方式
}
type IsRefundRes struct {
@ -38,7 +31,6 @@ type IsRefundRes struct {
Msg string `json:"msg"` // 请求接口消息
ResultType []Param `json:"resultType"` // 售后类型
WareReturn []Param `json:"wareReturn"` // 服务类型
}
type Param struct {

View File

@ -17,7 +17,7 @@ type WeiPinShangClient struct {
Key string
}
func NewWeiPinShangClient(host string, channelType, key string) *WeiPinShangClient {
func NewWeiPinShangClient(host, channelType, key string) *WeiPinShangClient {
return &WeiPinShangClient{
Host: host,
ChannelType: channelType,
@ -25,7 +25,7 @@ func NewWeiPinShangClient(host string, channelType, key string) *WeiPinShangClie
}
}
func (w *WeiPinShangClient) GetOrderInfo(orderNo string) (res any, err error) {
func (w *WeiPinShangClient) GetOrderInfo(orderNo string) (res *GetOrderInfoRes, err error) {
fmt.Println("orderNo", orderNo)
paramMap := make(map[string]any)
paramMap["orderNo"] = orderNo
@ -36,14 +36,14 @@ func (w *WeiPinShangClient) GetOrderInfo(orderNo string) (res any, err error) {
err = json.Unmarshal(postRes, &res)
if err != nil || res == nil {
err = fmt.Errorf("转换结构体失败: %s", string(postRes))
err = fmt.Errorf("转换GetOrderInfoRes结构体失败: %s", string(postRes))
return
}
return
}
func (w *WeiPinShangClient) IsRefund(mcOrderNo string) (res any, err error) {
func (w *WeiPinShangClient) IsRefund(mcOrderNo string) (res *IsRefundRes, err error) {
fmt.Println("mcOrderNo", mcOrderNo)
paramMap := make(map[string]any)
paramMap["mcOrderNo"] = mcOrderNo
@ -60,10 +60,24 @@ func (w *WeiPinShangClient) IsRefund(mcOrderNo string) (res any, err error) {
return
}
func (w *WeiPinShangClient) CreateAfsApply(createAfsApplyReq CreateAfsApplyReq) (res any, err error) {
func (w *WeiPinShangClient) CreateAfsApply(createAfsApplyReq CreateAfsApplyReq) (res *CreateAfsApplyRes, err error) {
fmt.Println("createAfsApplyReq", createAfsApplyReq)
paramMap := make(map[string]any)
paramMap["createAfsApplyReq"] = createAfsApplyReq
paramMap["mcOrderNo"] = createAfsApplyReq.McOrderNo
paramMap["customerExpect"] = createAfsApplyReq.CustomerExpect
paramMap["questionDesc"] = createAfsApplyReq.QuestionDesc
paramMap["questionPic"] = createAfsApplyReq.QuestionPic
paramMap["customerContactName"] = createAfsApplyReq.CustomerContactName
paramMap["customerMobilePhone"] = createAfsApplyReq.CustomerMobilePhone
paramMap["customerTel"] = createAfsApplyReq.CustomerTel
paramMap["pickwareProvince"] = createAfsApplyReq.PickwareProvince
paramMap["pickwareCity"] = createAfsApplyReq.PickwareCity
paramMap["pickwareCounty"] = createAfsApplyReq.PickwareCounty
paramMap["pickwareAddress"] = createAfsApplyReq.PickwareAddress
postRes, err := w.WPSPost("/mcang/Refunds/IsRefund", paramMap)
if err != nil {
return
@ -77,7 +91,7 @@ func (w *WeiPinShangClient) CreateAfsApply(createAfsApplyReq CreateAfsApplyReq)
return
}
func (w *WeiPinShangClient) OrderCancel(mcOrderNo string) (res any, err error) {
func (w *WeiPinShangClient) OrderCancel(mcOrderNo string) (res *OrderCancelRes, err error) {
fmt.Println("mcOrderNo", mcOrderNo)
paramMap := make(map[string]any)
paramMap["mcOrderNo"] = mcOrderNo