From f225fc0f8ce8d67b39409a144f5d5f200fae90e3 Mon Sep 17 00:00:00 2001 From: Rzy <465386466@qq.com> Date: Thu, 8 Aug 2024 09:30:02 +0800 Subject: [PATCH] =?UTF-8?q?=E5=AE=8C=E5=96=84=E6=94=AF=E4=BB=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/constants/errorcode/error_code.go | 10 +++++++--- app/services/thirdpay/do/pay_check.go | 16 ++++++++++++++-- 2 files changed, 21 insertions(+), 5 deletions(-) diff --git a/app/constants/errorcode/error_code.go b/app/constants/errorcode/error_code.go index bfdab8a..349d81b 100644 --- a/app/constants/errorcode/error_code.go +++ b/app/constants/errorcode/error_code.go @@ -60,7 +60,9 @@ const ( OrderTypeNotFount = 1403 OrderIsDelete = 1405 OrderStatusErr = 1406 - + OrderClosed = 1407 + OrderFailed = 1408 + OrderPayed = 1409 //请求日志 RequestLogErrors = 1500 RequestLogNotFound = 1501 @@ -127,8 +129,10 @@ var MsgZH = map[int]string{ OrderTypeNotFount: "未知的支付方式", OrderIsDelete: "订单已删除", OrderStatusErr: "订单状态错误", - - NotifySendFail: "回调发送失败", + OrderClosed: "订单已关闭,无法继续支付", + OrderFailed: "订单支付失败,请重新发起", + OrderPayed: "订单已支付成功,请勿重复支付", + NotifySendFail: "回调发送失败", PrePayFail: "预支付失败", } diff --git a/app/services/thirdpay/do/pay_check.go b/app/services/thirdpay/do/pay_check.go index c3116a1..d690c07 100644 --- a/app/services/thirdpay/do/pay_check.go +++ b/app/services/thirdpay/do/pay_check.go @@ -59,11 +59,23 @@ func (w *PayCheck) CheckMerchant() { func (w *PayCheck) CheckOrder() { cond := builder.NewCond() - cond = cond.And(builder.Eq{"out_tread_no": w.WebPayReqs.OutTradeNo}, builder.Eq{"app_id": w.AppCheck.AppId}, builder.Neq{"status": common.ORDER_STATUS_CLOSE}) + cond = cond.And(builder.Eq{"out_tread_no": w.WebPayReqs.OutTradeNo}, builder.Eq{"app_id": w.AppCheck.AppId}) order, code := services.OrderFindOne(&ordersmodel.Orders{}, cond) if code == errorcode.SystemError { w.CheckCode = code + return } - w.OldOrder = order + if code == errorcode.OrdersExist { + w.OldOrder = order + switch order.Status { + case common.ORDER_STATUS_CLOSE: + w.CheckCode = errorcode.OrderClosed + case common.ORDER_STATUS_FAILED: + w.CheckCode = errorcode.OrderFailed + case common.ORDER_STATUS_PAYED: + w.CheckCode = errorcode.OrderPayed + } + } + return }