data 透传闭环:发货数据回显、回调带回,并限制 2KB

- 「查询发货数据」响应新增 data(下单透传原样回显,供自建发货页预填/展示)
- 回调 payload 带回 data(下单传 → 回调收,商户对接免回查)
- 创建订单 data 限制最长 2048 字节
- 文档更新:data 用途(自建页预填/回调/上游查单约定字段)、发货数据与回调示例
- 单测覆盖 data 回显
This commit is contained in:
yml2213
2026-08-03 14:32:08 +08:00
parent a44f58cd0f
commit f95075e2e4
6 changed files with 36 additions and 5 deletions
+5
View File
@@ -58,6 +58,11 @@ func (h *OpenV1Handler) CreateOrder(c *gin.Context) {
}
var data interface{}
if len(req.Data) > 0 {
if len(req.Data) > 2048 {
openlog.Warn(c, "create_order data_too_large size=%d", len(req.Data))
response.BadRequest(c, "data 最长 2048 字节")
return
}
var decoded interface{}
if err := json.Unmarshal(req.Data, &decoded); err != nil {
openlog.Warn(c, "create_order bad_data err=%v", err)