From 9e328b469becde2bf2ddd6b75dd85847ae214bee Mon Sep 17 00:00:00 2001 From: zhongqiang <15375399426> Date: Wed, 18 Jun 2025 10:09:44 +0800 Subject: [PATCH 1/3] =?UTF-8?q?=E5=AF=B9=E6=8E=A5=E6=96=B0=E4=BE=9B?= =?UTF-8?q?=E5=BA=94=E9=93=BE-=E5=94=AF=E5=93=81=E5=B0=9A?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- weipinshang_api/wei_pin_shang_client.go | 8 ++++++-- weipinshang_api/wei_pin_shang_client_test.go | 2 +- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/weipinshang_api/wei_pin_shang_client.go b/weipinshang_api/wei_pin_shang_client.go index 14a7c3c..558c00a 100644 --- a/weipinshang_api/wei_pin_shang_client.go +++ b/weipinshang_api/wei_pin_shang_client.go @@ -8,6 +8,7 @@ import ( "errors" "fmt" "io" + "log" "net/http" "strings" ) @@ -268,6 +269,7 @@ func (w *WeiPinShangClient) WPSPost(url string, paramMap map[string]any) (res [] if err != nil { return } + //req.Proto = "HTTP/2" req.Header.Set("Content-Type", "application/json") req.Header.Set("channelType", w.ChannelType) @@ -276,13 +278,15 @@ func (w *WeiPinShangClient) WPSPost(url string, paramMap map[string]any) (res [] return } req.Header.Set("md5", sign) - + log.Printf("WPSPost req: %+v\n", req) // 创建 HTTP 客户端 client := &http.Client{} - + log.Printf("WPSPost client: %+v\n", client) // 发送请求 resp, err := client.Do(req) + log.Printf("WPSPost resp: %+v\n", resp) if err != nil { + log.Printf("发送请求失败: %+v\n", err) return } defer func(Body io.ReadCloser) { diff --git a/weipinshang_api/wei_pin_shang_client_test.go b/weipinshang_api/wei_pin_shang_client_test.go index b583762..82e58a6 100644 --- a/weipinshang_api/wei_pin_shang_client_test.go +++ b/weipinshang_api/wei_pin_shang_client_test.go @@ -292,7 +292,7 @@ func TestWeiPinShangClient_GetOrderInfoByThirdNO(t *testing.T) { Key: "f654ea5bde7635c3f46191191e5c4c8e", }, args: args{ - orderNo: "570872619444771455", + orderNo: "570853643339733632", }, }, } From 842e6d94aae66bab65fb042991b53b4f8c76668e Mon Sep 17 00:00:00 2001 From: zhongqiang <15375399426> Date: Wed, 18 Jun 2025 16:09:08 +0800 Subject: [PATCH 2/3] =?UTF-8?q?=E5=AF=B9=E6=8E=A5=E6=96=B0=E4=BE=9B?= =?UTF-8?q?=E5=BA=94=E9=93=BE-=E5=94=AF=E5=93=81=E5=B0=9A?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- weipinshang_api/res.go | 4 ++-- weipinshang_api/wei_pin_shang_client_test.go | 8 ++++---- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/weipinshang_api/res.go b/weipinshang_api/res.go index 11f9ef4..b876abc 100644 --- a/weipinshang_api/res.go +++ b/weipinshang_api/res.go @@ -36,8 +36,8 @@ type SkuData struct { GoodSpecId string `json:"goodSpecId"` //商品ID(c_goods_id) GoodsId string `json:"goodsId"` //商品ID(c_father_goods_id) GoodName string `json:"goodName"` //商品名称 - //Num string `json:"num"` //数量 - Num int `json:"num"` //数量 + Num string `json:"num"` //数量 + //Num int `json:"num"` //数量 Price string `json:"price"` //单价 } diff --git a/weipinshang_api/wei_pin_shang_client_test.go b/weipinshang_api/wei_pin_shang_client_test.go index 82e58a6..9dac5e0 100644 --- a/weipinshang_api/wei_pin_shang_client_test.go +++ b/weipinshang_api/wei_pin_shang_client_test.go @@ -80,14 +80,14 @@ func TestWeiPinShangClient_PreOrder(t *testing.T) { Key: "f654ea5bde7635c3f46191191e5c4c8e", }, args: PreOrderReq{ - GoodsInfo: "[{\"goodsId\":\"WPS9_282520\",\"goodSpecId\":\"WPS9_1221183858889276\",\"num\":2}]", + GoodsInfo: "[{\"goodsId\":\"WPS2_1231155626421463\",\"goodSpecId\":\"WPS2_12311556265677476\",\"num\":1}]", Province: "广东省", Address: "奥园", City: "广州市", Area: "番禺区", ConsigneePhone: "15375390426", ConsigneeContacts: "张三", - LockCode: "L100000000", + LockCode: "L100000002", Source: "AILEHUI", }, }, @@ -135,8 +135,8 @@ func TestWeiPinShangClient_CreateOrder(t *testing.T) { Key: "f654ea5bde7635c3f46191191e5c4c8e", }, args: CreateOrderReq{ - LockCode: "L100000000", - OrderNo: "30000000000", + LockCode: "L100000002", + OrderNo: "2000000001", }, }, } From 12e627aac6085ef4eca87e6fe897bd9586a84fac Mon Sep 17 00:00:00 2001 From: zhongqiang <15375399426> Date: Wed, 18 Jun 2025 16:10:22 +0800 Subject: [PATCH 3/3] =?UTF-8?q?=E5=AF=B9=E6=8E=A5=E6=96=B0=E4=BE=9B?= =?UTF-8?q?=E5=BA=94=E9=93=BE-=E5=94=AF=E5=93=81=E5=B0=9A?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- weipinshang_api/wei_pin_shang_client.go | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/weipinshang_api/wei_pin_shang_client.go b/weipinshang_api/wei_pin_shang_client.go index 558c00a..e60cae2 100644 --- a/weipinshang_api/wei_pin_shang_client.go +++ b/weipinshang_api/wei_pin_shang_client.go @@ -278,10 +278,10 @@ func (w *WeiPinShangClient) WPSPost(url string, paramMap map[string]any) (res [] return } req.Header.Set("md5", sign) - log.Printf("WPSPost req: %+v\n", req) + //log.Printf("WPSPost req: %+v\n", req) // 创建 HTTP 客户端 client := &http.Client{} - log.Printf("WPSPost client: %+v\n", client) + //log.Printf("WPSPost client: %+v\n", client) // 发送请求 resp, err := client.Do(req) log.Printf("WPSPost resp: %+v\n", resp) @@ -299,7 +299,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, errors.New("响应体不是有效的JSON格式")