修复 Context 改造后的编译问题

This commit is contained in:
yml2213
2026-06-10 09:43:49 +08:00
parent b377f8350b
commit 334436f381
13 changed files with 193 additions and 189 deletions
+8 -8
View File
@@ -37,7 +37,7 @@ func (h *Handler) Start(c *gin.Context) {
}
var req StartPaymentRequest
_ = c.ShouldBindJSON(&req)
item, err := h.service.Start(userID, orderID, req, c.ClientIP())
item, err := h.service.Start(c.Request.Context(), userID, orderID, req, c.ClientIP())
if err != nil {
writePaymentError(c, err)
return
@@ -55,7 +55,7 @@ func (h *Handler) Query(c *gin.Context) {
if !ok {
return
}
item, err := h.service.Query(userID, orderID)
item, err := h.service.Query(c.Request.Context(), userID, orderID)
if err != nil {
writePaymentError(c, err)
return
@@ -74,7 +74,7 @@ func (h *Handler) WalletRecharge(c *gin.Context) {
response.BadRequest(c, "充值金额不正确")
return
}
item, err := h.service.StartWalletRecharge(userID, req, c.ClientIP())
item, err := h.service.StartWalletRecharge(c.Request.Context(), userID, req, c.ClientIP())
if err != nil {
writePaymentError(c, err)
return
@@ -92,7 +92,7 @@ func (h *Handler) WalletRechargeQuery(c *gin.Context) {
if !ok {
return
}
item, err := h.service.QueryWalletRecharge(userID, paymentID)
item, err := h.service.QueryWalletRecharge(c.Request.Context(), userID, paymentID)
if err != nil {
writePaymentError(c, err)
return
@@ -105,7 +105,7 @@ func (h *Handler) QueryRefundStatus(c *gin.Context) {
if !ok {
return
}
item, err := h.service.QueryRefundStatus(orderID)
item, err := h.service.QueryRefundStatus(c.Request.Context(), orderID)
if err != nil {
writePaymentError(c, err)
return
@@ -118,7 +118,7 @@ func (h *Handler) AdminList(c *gin.Context) {
if !ok {
return
}
result, err := h.service.AdminList(query)
result, err := h.service.AdminList(c.Request.Context(), query)
if err != nil {
writePaymentError(c, err)
return
@@ -148,7 +148,7 @@ func (h *Handler) LeshuaNotify(c *gin.Context) {
contentType,
rawPayload,
)
result, err := h.service.HandleLeshuaNotify(params, rawPayload, contentType)
result, err := h.service.HandleLeshuaNotify(c.Request.Context(), params, rawPayload, contentType)
if err != nil || result == nil || !result.OK {
log.Printf("[payment] leshua notify failed third_order_id=%s err=%v", params["third_order_id"], err)
c.String(http.StatusOK, "FAIL")
@@ -181,7 +181,7 @@ func (h *Handler) LakalaNotify(c *gin.Context) {
contentType,
rawPayload,
)
result, err := h.service.HandleNotify("lakala", params, rawPayload, contentType, authorization)
result, err := h.service.HandleNotify(c.Request.Context(), "lakala", params, rawPayload, contentType, authorization)
if err != nil || result == nil || !result.OK {
log.Printf("[payment] lakala notify failed third_order_id=%s err=%v", params["third_order_id"], err)
c.JSON(http.StatusOK, gin.H{"code": "FAIL", "message": "失败"})