简化开放下单幂等参数

This commit is contained in:
yml2213
2026-07-31 15:25:26 +08:00
parent 71cde7e32b
commit 30362f14bd
5 changed files with 5 additions and 26 deletions
-5
View File
@@ -56,11 +56,6 @@ func (h *OpenV1Handler) CreateOrder(c *gin.Context) {
response.BadRequest(c, "参数错误:client_order_no 与 sku 必填")
return
}
if key := c.GetHeader("Idempotency-Key"); key != "" && key != req.ClientOrderNo {
openlog.Warn(c, "create_order idempotency_key_mismatch header=%s body=%s", key, req.ClientOrderNo)
response.BadRequest(c, "Idempotency-Key 必须与 client_order_no 一致")
return
}
var data interface{}
if len(req.Data) > 0 {
var decoded interface{}
+1 -1
View File
@@ -36,7 +36,7 @@ func Setup(h *Handlers) *gin.Engine {
r.Use(cors.New(cors.Config{
AllowOrigins: []string{"*"},
AllowMethods: []string{"GET", "POST", "PUT", "PATCH", "DELETE", "OPTIONS"},
AllowHeaders: []string{"Origin", "Content-Type", "Authorization", "X-Merchant-ID", "X-App-Key", "X-Api-Key", "X-Timestamp", "X-Nonce", "X-Sign", "Idempotency-Key", "X-Request-ID"},
AllowHeaders: []string{"Origin", "Content-Type", "Authorization", "X-Merchant-ID", "X-App-Key", "X-Api-Key", "X-Timestamp", "X-Nonce", "X-Sign", "X-Request-ID"},
ExposeHeaders: []string{"Content-Length", "X-Request-ID"},
AllowCredentials: true,
}))