优化发货接口对接流程

This commit is contained in:
yml2213
2026-07-30 23:44:50 +08:00
parent a16e518b6c
commit ee956e2e01
14 changed files with 428 additions and 141 deletions
+9 -3
View File
@@ -55,7 +55,7 @@ func (h *OpenHandler) QueryOrder(c *gin.Context) {
type shipNotifyReq struct {
OrderNo string `json:"order_no" binding:"required"`
ShipStatus string `json:"ship_status" binding:"required"` // success/failed/processing
ShipStatus string `json:"ship_status" binding:"required"` // success/failed
ProviderOrderNo string `json:"provider_order_no"`
ShippedAt string `json:"shipped_at"` // RFC3339 可选
FailReason string `json:"fail_reason"`
@@ -77,8 +77,14 @@ func (h *OpenHandler) ShipNotify(c *gin.Context) {
}
raw, _ := json.Marshal(req)
rawPayload := string(raw)
if body, ok := c.Get(openlog.CtxBody); ok {
if bodyText, ok := body.(string); ok && bodyText != "" {
rawPayload = bodyText
}
}
openlog.Info(c, "ship_notify start order_no=%s ship_status=%s provider_no=%s shipped_at=%s fail_reason=%q payload=%s",
req.OrderNo, req.ShipStatus, req.ProviderOrderNo, req.ShippedAt, req.FailReason, openlog.Truncate(string(raw), 800),
req.OrderNo, req.ShipStatus, req.ProviderOrderNo, req.ShippedAt, req.FailReason, openlog.Truncate(rawPayload, 800),
)
var shippedAt *time.Time
@@ -98,7 +104,7 @@ func (h *OpenHandler) ShipNotify(c *gin.Context) {
ProviderOrderNo: req.ProviderOrderNo,
ShippedAt: shippedAt,
FailReason: req.FailReason,
RawPayload: string(raw),
RawPayload: rawPayload,
GameChannel: req.GameChannel,
GameUID: req.GameUID,
RoleName: req.RoleName,