<feat>完善支付

This commit is contained in:
Rzy 2024-08-08 09:30:02 +08:00
parent f85d6cc410
commit f225fc0f8c
2 changed files with 21 additions and 5 deletions

View File

@ -60,7 +60,9 @@ const (
OrderTypeNotFount = 1403 OrderTypeNotFount = 1403
OrderIsDelete = 1405 OrderIsDelete = 1405
OrderStatusErr = 1406 OrderStatusErr = 1406
OrderClosed = 1407
OrderFailed = 1408
OrderPayed = 1409
//请求日志 //请求日志
RequestLogErrors = 1500 RequestLogErrors = 1500
RequestLogNotFound = 1501 RequestLogNotFound = 1501
@ -127,8 +129,10 @@ var MsgZH = map[int]string{
OrderTypeNotFount: "未知的支付方式", OrderTypeNotFount: "未知的支付方式",
OrderIsDelete: "订单已删除", OrderIsDelete: "订单已删除",
OrderStatusErr: "订单状态错误", OrderStatusErr: "订单状态错误",
OrderClosed: "订单已关闭,无法继续支付",
NotifySendFail: "回调发送失败", OrderFailed: "订单支付失败,请重新发起",
OrderPayed: "订单已支付成功,请勿重复支付",
NotifySendFail: "回调发送失败",
PrePayFail: "预支付失败", PrePayFail: "预支付失败",
} }

View File

@ -59,11 +59,23 @@ func (w *PayCheck) CheckMerchant() {
func (w *PayCheck) CheckOrder() { func (w *PayCheck) CheckOrder() {
cond := builder.NewCond() 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) order, code := services.OrderFindOne(&ordersmodel.Orders{}, cond)
if code == errorcode.SystemError { if code == errorcode.SystemError {
w.CheckCode = code 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 return
} }