From 417cd73afadf108716c7d385ac348fd0a2285923 Mon Sep 17 00:00:00 2001 From: chengma Date: Wed, 19 Aug 2026 11:28:18 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E5=9B=9E=E5=86=99=E6=A1=A3=E5=8F=A3?= =?UTF-8?q?=E5=85=A5=E5=BA=93=E7=A0=81=E6=97=B6=20t=20=E5=9B=BA=E5=AE=9A?= =?UTF-8?q?=E4=B8=BA=200=20(#278)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 顺运宝把 t 绑成 Java Integer,毫秒时间戳溢出后 19 号回写全部失败。 Co-authored-by: Cursor --- admin/syb/client.go | 6 +++++- admin/syb/client_test.go | 8 +++++++- docs/admin/08-顺运宝接口.md | 10 ++++++++-- 3 files changed, 20 insertions(+), 4 deletions(-) diff --git a/admin/syb/client.go b/admin/syb/client.go index 4392551..32a80cf 100644 --- a/admin/syb/client.go +++ b/admin/syb/client.go @@ -795,8 +795,12 @@ func (c *Client) UpdateDetailCode(ctx context.Context, stockID, detailID int64, return fmt.Errorf("code 不能包含控制字符") } } + // t 固定传 "0"。顺运宝把查询参数 t 绑成 Java Integer(上限 2147483647)。 + // #250 改成当前毫秒时间戳后,19 号全部回写被拒:msg=Can not parse the + // parameter "1787108752485" to Integer value。不得改回 UnixMilli,也不得 + // 改成 Unix 秒——秒目前能进 Integer,2038 年仍会溢出;#234 已用 t=0 通过参数绑定。 _, err := c.do(ctx, http.MethodPost, "/am/stock/detail/updateDetailCode", url.Values{ - "t": {strconv.FormatInt(time.Now().UnixMilli(), 10)}, "id": {strconv.FormatInt(stockID, 10)}, + "t": {"0"}, "id": {strconv.FormatInt(stockID, 10)}, "detailId": {strconv.FormatInt(detailID, 10)}, "code": {code}, }, nil) return classifyInnerCodeWriteError(err) diff --git a/admin/syb/client_test.go b/admin/syb/client_test.go index 2d7073b..a2d067d 100644 --- a/admin/syb/client_test.go +++ b/admin/syb/client_test.go @@ -582,7 +582,13 @@ func TestClient_InnerCodeWrite_单件码参数和路径正确且只发送一次( } case "/am/stock/detail/updateDetailCode": query := r.URL.Query() - if r.Method != http.MethodPost || query.Get("t") == "" || query.Get("id") != "11" || query.Get("detailId") != "22" || query.Get("code") != targetCode { + if r.Method != http.MethodPost { + t.Errorf("update method=%s", r.Method) + } + if query.Get("t") != "0" { + t.Errorf("t 必须固定为 0 以适配顺运宝 Integer,实际 %q", query.Get("t")) + } + if query.Get("id") != "11" || query.Get("detailId") != "22" || query.Get("code") != targetCode { t.Errorf("update query=%v", query) } default: diff --git a/docs/admin/08-顺运宝接口.md b/docs/admin/08-顺运宝接口.md index 97cbe96..27f3b5d 100644 --- a/docs/admin/08-顺运宝接口.md +++ b/docs/admin/08-顺运宝接口.md @@ -410,7 +410,7 @@ SKU(平均每商品 1.17 个),**查无此 SKU 是常态**,不是异常 `[建议]` 登录后**只调 `/am/user/get` 验证会话**,其余几个是网页自己的初始化请求, Go 侧不用跟着调。 -### 7.1 档口入库码逐件写入(工单 #234、#250) +### 7.1 档口入库码逐件写入(工单 #234、#250、#278) 档口入库码最终写入货运明细的 `innerExpCode`(页面名称“快递单号”)。接口来自 现有 Python 流程和 HAR 响应样本: @@ -418,9 +418,15 @@ Go 侧不用跟着调。 ```text GET /am/stock/detail/deleteInnerCode?detailId={detailID} POST /am/stock/detail/createDetail -POST /am/stock/detail/updateDetailCode?t={当前毫秒时间戳}&id={stockID}&detailId={detailID}&code={单件innerCode} +POST /am/stock/detail/updateDetailCode?t=0&id={stockID}&detailId={detailID}&code={单件innerCode} ``` +`[必须]` `t` 固定为 `0`。顺运宝把该参数绑成 Java `Integer`(上限 `2147483647`)。 +`#250` 改成当前毫秒时间戳后,2026-08-19 全部回写被拒: +`Can not parse the parameter "1787108752485" to Integer value`。不得再传毫秒, +也不得改成 Unix 秒——秒目前能进 Integer,2038 年仍会溢出。`#234` 的 `t=0` +已通过参数绑定;`#250` 保留的 POST 方法不要改回 GET。 + `createDetail` 使用 JSON 请求体:`id=null`、稳定占位标题、`productSpec=null`、 `productQty=1`、`productPrice=0`、`stockId`;成功响应的 `data` 是新 `detailId`。