优化发货接口对接流程
This commit is contained in:
@@ -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,
|
||||
|
||||
@@ -14,7 +14,7 @@ import (
|
||||
"github.com/gin-gonic/gin"
|
||||
)
|
||||
|
||||
// OpenV1Handler 提供面向商户系统和履约器的通用开放接口。
|
||||
// OpenV1Handler 提供面向商户系统的客户侧开放接口。
|
||||
type OpenV1Handler struct {
|
||||
merchantSvc *service.MerchantService
|
||||
fulfillmentSvc *service.FulfillmentService
|
||||
|
||||
Reference in New Issue
Block a user