对接新供应链-唯品尚
This commit is contained in:
@@ -25,17 +25,17 @@ func NewWeiPinShangClient(host, channelType, key string) *WeiPinShangClient {
|
||||
}
|
||||
}
|
||||
|
||||
func (w *WeiPinShangClient) GetManyPostage(getManyPostageReq GetManyPostageReq) (res *GetManyPostageRes, err error) {
|
||||
func (w *WeiPinShangClient) GetManyPostage(getManyPostageReq *GetManyPostageReq) (res *GetManyPostageRes, err error) {
|
||||
fmt.Println("getManyPostageReq", getManyPostageReq)
|
||||
paramMap := make(map[string]any)
|
||||
|
||||
paramMap["goodsInfo"] = getManyPostageReq.GoodsInfo
|
||||
paramMap["goodInfo"] = getManyPostageReq.GoodsInfo
|
||||
paramMap["address"] = getManyPostageReq.Address
|
||||
paramMap["province"] = getManyPostageReq.Province
|
||||
paramMap["county"] = getManyPostageReq.County
|
||||
paramMap["city"] = getManyPostageReq.City
|
||||
|
||||
postRes, err := w.WPSPost("/mcang/Mcang/getManyPostage", paramMap)
|
||||
postRes, err := w.WPSPost("mcang/Mcang/getManyPostage", paramMap)
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
@@ -49,7 +49,7 @@ func (w *WeiPinShangClient) GetManyPostage(getManyPostageReq GetManyPostageReq)
|
||||
return
|
||||
}
|
||||
|
||||
func (w *WeiPinShangClient) PreOrder(preOrderReq PreOrderReq) (res *PreOrderRes, err error) {
|
||||
func (w *WeiPinShangClient) PreOrder(preOrderReq *PreOrderReq) (res *PreOrderRes, err error) {
|
||||
fmt.Println("preOrderReq", preOrderReq)
|
||||
paramMap := make(map[string]any)
|
||||
paramMap["lockCode"] = preOrderReq.LockCode
|
||||
@@ -61,9 +61,9 @@ func (w *WeiPinShangClient) PreOrder(preOrderReq PreOrderReq) (res *PreOrderRes,
|
||||
paramMap["area"] = preOrderReq.Area
|
||||
paramMap["city"] = preOrderReq.City
|
||||
|
||||
paramMap["goodsInfo"] = preOrderReq.GoodsInfo
|
||||
paramMap["goodInfo"] = preOrderReq.GoodsInfo
|
||||
paramMap["source"] = preOrderReq.Source
|
||||
postRes, err := w.WPSPost("/mcang/Order/preOrder", paramMap)
|
||||
postRes, err := w.WPSPost("mcang/Order/preOrder", paramMap)
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
@@ -77,13 +77,13 @@ func (w *WeiPinShangClient) PreOrder(preOrderReq PreOrderReq) (res *PreOrderRes,
|
||||
return
|
||||
}
|
||||
|
||||
func (w *WeiPinShangClient) CreateOrder(createOrderReq CreateOrderReq) (res *CreateOrderRes, err error) {
|
||||
func (w *WeiPinShangClient) CreateOrder(createOrderReq *CreateOrderReq) (res *CreateOrderRes, err error) {
|
||||
fmt.Println("createOrderReq", createOrderReq)
|
||||
paramMap := make(map[string]any)
|
||||
paramMap["lockCode"] = createOrderReq.LockCode
|
||||
paramMap["orderNo"] = createOrderReq.OrderNo
|
||||
paramMap["noticeUrl"] = createOrderReq.NoticeUrl
|
||||
postRes, err := w.WPSPost("/mcang/Order/createOrder", paramMap)
|
||||
postRes, err := w.WPSPost("mcang/Order/createOrder", paramMap)
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
@@ -101,7 +101,7 @@ func (w *WeiPinShangClient) GetOrderInfo(orderNo string) (res *GetOrderInfoRes,
|
||||
fmt.Println("orderNo", orderNo)
|
||||
paramMap := make(map[string]any)
|
||||
paramMap["orderNo"] = orderNo
|
||||
postRes, err := w.WPSPost("/mcang/Mcang/getOrderInfo", paramMap)
|
||||
postRes, err := w.WPSPost("mcang/Mcang/getOrderInfo", paramMap)
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
@@ -117,9 +117,12 @@ func (w *WeiPinShangClient) GetOrderInfo(orderNo string) (res *GetOrderInfoRes,
|
||||
|
||||
func (w *WeiPinShangClient) GetOrderInfoByItemNO(mcOrderNo string) (res *GetOrderInfoByItemNORes, err error) {
|
||||
fmt.Println("mcOrderNo", mcOrderNo)
|
||||
paramMap := make(map[string]any)
|
||||
paramMap["mcOrderNo"] = mcOrderNo
|
||||
postRes, err := w.WPSPost("/mcang/Mcang/getOrderInfoByItemNO", paramMap)
|
||||
//paramMap := make(map[string]any)
|
||||
//paramMap["mcOrderNo"] = mcOrderNo
|
||||
paramMap := map[string]any{
|
||||
"mcOrderNo": mcOrderNo,
|
||||
}
|
||||
postRes, err := w.WPSPost("mcang/Order/getOrderInfoByItemNO", paramMap)
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
@@ -133,11 +136,29 @@ func (w *WeiPinShangClient) GetOrderInfoByItemNO(mcOrderNo string) (res *GetOrde
|
||||
return
|
||||
}
|
||||
|
||||
func (w *WeiPinShangClient) GetOrderInfoByThirdNO(orderNo string) (res *GetOrderInfoByThirdNORes, err error) {
|
||||
fmt.Println("orderNo", orderNo)
|
||||
paramMap := make(map[string]any)
|
||||
paramMap["orderNo"] = orderNo
|
||||
postRes, err := w.WPSPost("mcang/Order/getOrderInfoByThirdNO", paramMap)
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
|
||||
err = json.Unmarshal(postRes, &res)
|
||||
if err != nil || res == nil {
|
||||
err = fmt.Errorf("转换GetOrderInfoByThirdNORes结构体失败: %s", string(postRes))
|
||||
return
|
||||
}
|
||||
|
||||
return
|
||||
}
|
||||
|
||||
func (w *WeiPinShangClient) IsRefund(mcOrderNo string) (res *IsRefundRes, err error) {
|
||||
fmt.Println("mcOrderNo", mcOrderNo)
|
||||
paramMap := make(map[string]any)
|
||||
paramMap["mcOrderNo"] = mcOrderNo
|
||||
postRes, err := w.WPSPost("/mcang/Refunds/IsRefund", paramMap)
|
||||
postRes, err := w.WPSPost("mcang/Refunds/IsRefund", paramMap)
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
@@ -150,7 +171,7 @@ func (w *WeiPinShangClient) IsRefund(mcOrderNo string) (res *IsRefundRes, err er
|
||||
return
|
||||
}
|
||||
|
||||
func (w *WeiPinShangClient) CreateAfsApply(createAfsApplyReq CreateAfsApplyReq) (res *CreateAfsApplyRes, err error) {
|
||||
func (w *WeiPinShangClient) CreateAfsApply(createAfsApplyReq *CreateAfsApplyReq) (res *CreateAfsApplyRes, err error) {
|
||||
fmt.Println("createAfsApplyReq", createAfsApplyReq)
|
||||
paramMap := make(map[string]any)
|
||||
|
||||
@@ -168,7 +189,7 @@ func (w *WeiPinShangClient) CreateAfsApply(createAfsApplyReq CreateAfsApplyReq)
|
||||
paramMap["pickwareCounty"] = createAfsApplyReq.PickwareCounty
|
||||
paramMap["pickwareAddress"] = createAfsApplyReq.PickwareAddress
|
||||
|
||||
postRes, err := w.WPSPost("/mcang/Refunds/IsRefund", paramMap)
|
||||
postRes, err := w.WPSPost("mcang/Refunds/IsRefund", paramMap)
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
@@ -185,7 +206,7 @@ func (w *WeiPinShangClient) OrderCancel(mcOrderNo string) (res *OrderCancelRes,
|
||||
fmt.Println("mcOrderNo", mcOrderNo)
|
||||
paramMap := make(map[string]any)
|
||||
paramMap["mcOrderNo"] = mcOrderNo
|
||||
postRes, err := w.WPSPost("/mcang/Refunds/IsRefund", paramMap)
|
||||
postRes, err := w.WPSPost("mcang/Refunds/IsRefund", paramMap)
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
@@ -207,7 +228,7 @@ func (w *WeiPinShangClient) Sign(paramMap map[string]any) (res string, err error
|
||||
}
|
||||
md5Sum := md5.Sum([]byte(sumParamString))
|
||||
md5Str := hex.EncodeToString(md5Sum[:])
|
||||
md5Str = strings.ToUpper(md5Str)
|
||||
md5Str = strings.ToLower(md5Str)
|
||||
return md5Str, nil
|
||||
}
|
||||
|
||||
@@ -246,7 +267,7 @@ func (w *WeiPinShangClient) WPSPost(url string, paramMap map[string]any) (res []
|
||||
return
|
||||
}
|
||||
|
||||
//fmt.Printf("res: %s\n", string(res))
|
||||
fmt.Printf("res: %s\n", string(res))
|
||||
|
||||
if !json.Valid(res) {
|
||||
return nil, fmt.Errorf("响应不是有效的JSON格式: %s", string(res))
|
||||
|
Reference in New Issue
Block a user