+GetOrderPay

GetOrders添加参数isPurchase
This commit is contained in:
gazebo
2019-11-27 10:05:26 +08:00
parent 4b1b011459
commit 7410da75fd
10 changed files with 121 additions and 30 deletions

View File

@@ -99,15 +99,27 @@ func onWxpayRefund(msg *wxpay.RefundResultMsg) (err error) {
db := dao.GetDB()
if err = dao.GetEntity(db, orderPayRefund, "RefundID"); err == nil {
if msg.ResultCode == wxpay.ResponseCodeSuccess {
orderPayRefund.Status = model.PayStatusYes
orderPayRefund.Status = model.RefundStatusYes
} else {
orderPayRefund.Status = model.PayStatusFailed
orderPayRefund.Status = model.RefundStatusFailed
}
orderPayRefund.OriginalData = utils.Format4Output(msg, true)
dao.UpdateEntity(db, orderPayRefund)
} else if dao.IsNoRowsError(err) {
globals.SugarLogger.Warnf("收到异常的退款事件, msg:%s", utils.Format4Output(msg, true))
}
orderPay := &model.OrderPay{
VendorOrderID: orderPayRefund.VendorOrderID,
VendorID: jxutils.GetPossibleVendorIDFromVendorOrderID(orderPayRefund.VendorOrderID),
PayType: model.PayTypeWX,
Status: model.PayStatusYes,
}
orderPay.DeletedAt = utils.DefaultTimeValue
if err = dao.GetEntity(db, orderPay, "VendorOrderID", "VendorID", "PayType", "Status", "DeletedAt"); err == nil {
orderPay.Status = model.PayStatusRefund
dao.UpdateEntity(db, orderPay)
}
return err
}
@@ -125,7 +137,7 @@ func refundOrderByWX(ctx *jxcontext.Context, orderPay *model.OrderPay, refundID
VendorRefundID: result.RefundID,
VendorOrderID: orderPay.VendorOrderID,
VendorID: orderPay.VendorID,
Status: model.PayStatusNo,
Status: model.RefundStatusNo,
TransactionID: orderPay.TransactionID,
RefundFee: orderPay.TotalFee,
RefundCreatedAt: time.Now(),