Merge branch 'develop' into feature/auth

This commit is contained in:
eson
2023-08-10 17:31:03 +08:00
20 changed files with 276 additions and 233 deletions

View File

@@ -107,7 +107,8 @@ func (l *OrderPaymentIntentLogic) OrderPaymentIntent(req *types.OrderPaymentInte
var resData types.OrderPaymentIntentRes
// 事务处理
err = orderModel.Trans(l.ctx, func(ctx context.Context, connGorm *gorm.DB) error {
ctx := l.ctx
err = l.svcCtx.MysqlConn.Transaction(func(connGorm *gorm.DB) error {
// 支付记录--处理 //支付记录改为一条订单多条,分首款尾款
var payStatus int64 = 0
var orderSource int64 = 1

View File

@@ -153,13 +153,13 @@ func (l *StripeWebhookLogic) HandlePayEventCreate(fsPayEvent *gmodel.FsPayEvent)
func (l *StripeWebhookLogic) HandleChargeRefunded(chargeRefunded *stripe.Charge) (err error) {
// 退款成功
if chargeRefunded.Status == "succeeded" {
orderModel := gmodel.NewFsOrderModel(l.svcCtx.MysqlConn)
err = orderModel.Trans(l.ctx, func(ctx context.Context, connGorm *gorm.DB) (err error) {
ctx := l.ctx
err = l.svcCtx.MysqlConn.Transaction(func(connGorm *gorm.DB) error {
// 查询支付记录
payModelT := gmodel.NewFsPayModel(connGorm)
payModelTRSB := payModelT.RowSelectBuilder(nil)
payModelTRSB1 := payModelTRSB.Where("trade_no = ?", chargeRefunded.PaymentIntent.ID).Where("pay_status = ?", constants.PAYSTATUS_SUCCESS).Where("is_refund = ?", 0)
payInfo, err := payModelT.FindOneByQuery(l.ctx, payModelTRSB1, nil)
payInfo, err := payModelT.FindOneByQuery(ctx, payModelTRSB1, nil)
if err != nil {
return err
}
@@ -295,7 +295,8 @@ func (l *StripeWebhookLogic) HandlePaymentIntentSucceeded(paymentIntent *stripe.
}
}
err = orderModel.Trans(l.ctx, func(ctx context.Context, connGorm *gorm.DB) (err error) {
ctx := l.ctx
err = l.svcCtx.MysqlConn.Transaction(func(connGorm *gorm.DB) error {
// 更新支付信息
payModelT := gmodel.NewFsPayModel(connGorm)
*payInfo.PayStatus = 1