fix:修复上传
This commit is contained in:
parent
db5b576799
commit
5f1a07f737
|
@ -76,16 +76,17 @@ func (l *UserOrderCancelLogic) UserOrderCancel(req *types.UserOrderCancelReq, us
|
||||||
var nowTime = time.Now().Unix()
|
var nowTime = time.Now().Unix()
|
||||||
var payList []handlers.PayInfo
|
var payList []handlers.PayInfo
|
||||||
// 事务处理
|
// 事务处理
|
||||||
err = orderModel.Trans(l.ctx, func(ctx context.Context, connGorm *gorm.DB) (err error) {
|
ctx := l.ctx
|
||||||
|
err = l.svcCtx.MysqlConn.Transaction(func(tx *gorm.DB) error {
|
||||||
// 修改订单信息
|
// 修改订单信息
|
||||||
orderModelTS := gmodel.NewFsOrderModel(connGorm)
|
orderModelTS := gmodel.NewFsOrderModel(tx)
|
||||||
err = orderModelTS.Update(ctx, orderInfo)
|
err = orderModelTS.Update(ctx, orderInfo)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
// 新增退款记录
|
// 新增退款记录
|
||||||
var isRefund int64 = 0
|
var isRefund int64 = 0
|
||||||
refundReasonModelTS := gmodel.NewFsRefundReasonModel(connGorm)
|
refundReasonModelTS := gmodel.NewFsRefundReasonModel(tx)
|
||||||
refundReasonModelTS.CreateOrUpdate(ctx, &gmodel.FsRefundReason{
|
refundReasonModelTS.CreateOrUpdate(ctx, &gmodel.FsRefundReason{
|
||||||
IsRefund: &isRefund,
|
IsRefund: &isRefund,
|
||||||
RefundReasonId: &req.RefundReasonId,
|
RefundReasonId: &req.RefundReasonId,
|
||||||
|
@ -95,7 +96,7 @@ func (l *UserOrderCancelLogic) UserOrderCancel(req *types.UserOrderCancelReq, us
|
||||||
})
|
})
|
||||||
// 退款申请
|
// 退款申请
|
||||||
// 退款申请--查询支付信息
|
// 退款申请--查询支付信息
|
||||||
fsPayModelTS := gmodel.NewFsPayModel(connGorm)
|
fsPayModelTS := gmodel.NewFsPayModel(tx)
|
||||||
rbFsPay := fsPayModelTS.RowSelectBuilder(nil).Where("order_number = ?", orderInfo.Sn).Where("pay_status =?", constants.PAYSTATUS_SUCCESS).Where("is_refund =?", 0)
|
rbFsPay := fsPayModelTS.RowSelectBuilder(nil).Where("order_number = ?", orderInfo.Sn).Where("pay_status =?", constants.PAYSTATUS_SUCCESS).Where("is_refund =?", 0)
|
||||||
payInfoList, err := fsPayModelTS.FindAll(ctx, rbFsPay, nil, "")
|
payInfoList, err := fsPayModelTS.FindAll(ctx, rbFsPay, nil, "")
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|
|
@ -107,7 +107,8 @@ func (l *OrderPaymentIntentLogic) OrderPaymentIntent(req *types.OrderPaymentInte
|
||||||
|
|
||||||
var resData types.OrderPaymentIntentRes
|
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 payStatus int64 = 0
|
||||||
var orderSource int64 = 1
|
var orderSource int64 = 1
|
||||||
|
|
|
@ -153,13 +153,13 @@ func (l *StripeWebhookLogic) HandlePayEventCreate(fsPayEvent *gmodel.FsPayEvent)
|
||||||
func (l *StripeWebhookLogic) HandleChargeRefunded(chargeRefunded *stripe.Charge) (err error) {
|
func (l *StripeWebhookLogic) HandleChargeRefunded(chargeRefunded *stripe.Charge) (err error) {
|
||||||
// 退款成功
|
// 退款成功
|
||||||
if chargeRefunded.Status == "succeeded" {
|
if chargeRefunded.Status == "succeeded" {
|
||||||
orderModel := gmodel.NewFsOrderModel(l.svcCtx.MysqlConn)
|
ctx := l.ctx
|
||||||
err = orderModel.Trans(l.ctx, func(ctx context.Context, connGorm *gorm.DB) (err error) {
|
err = l.svcCtx.MysqlConn.Transaction(func(connGorm *gorm.DB) error {
|
||||||
// 查询支付记录
|
// 查询支付记录
|
||||||
payModelT := gmodel.NewFsPayModel(connGorm)
|
payModelT := gmodel.NewFsPayModel(connGorm)
|
||||||
payModelTRSB := payModelT.RowSelectBuilder(nil)
|
payModelTRSB := payModelT.RowSelectBuilder(nil)
|
||||||
payModelTRSB1 := payModelTRSB.Where("trade_no = ?", chargeRefunded.PaymentIntent.ID).Where("pay_status = ?", constants.PAYSTATUS_SUCCESS).Where("is_refund = ?", 0)
|
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 {
|
if err != nil {
|
||||||
return err
|
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)
|
payModelT := gmodel.NewFsPayModel(connGorm)
|
||||||
*payInfo.PayStatus = 1
|
*payInfo.PayStatus = 1
|
||||||
|
|
|
@ -64,8 +64,8 @@ func (l *UploadCallbackLogic) UploadCallback(req *types.UploadCallbackReq, useri
|
||||||
bucketName = basic.StorageBucketName
|
bucketName = basic.StorageBucketName
|
||||||
}
|
}
|
||||||
|
|
||||||
resourceModel := gmodel.NewFsResourceModel(l.svcCtx.MysqlConn)
|
ctx := l.ctx
|
||||||
err := resourceModel.Trans(l.ctx, func(ctx context.Context, connGorm *gorm.DB) (err error) {
|
err := l.svcCtx.MysqlConn.Transaction(func(connGorm *gorm.DB) error {
|
||||||
resourceModelTS := gmodel.NewFsResourceModel(l.svcCtx.MysqlConn)
|
resourceModelTS := gmodel.NewFsResourceModel(l.svcCtx.MysqlConn)
|
||||||
resourceInfo, err := resourceModelTS.FindOneById(ctx, req.ResourceId)
|
resourceInfo, err := resourceModelTS.FindOneById(ctx, req.ResourceId)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|
|
@ -163,8 +163,8 @@ func (upload *Upload) UploadFileByByte(req *UploadBaseReq) (*UploadBaseRes, erro
|
||||||
var resourceId string = req.FileHash
|
var resourceId string = req.FileHash
|
||||||
|
|
||||||
var uploadBaseRes = UploadBaseRes{}
|
var uploadBaseRes = UploadBaseRes{}
|
||||||
resourceModel := gmodel.NewFsResourceModel(upload.MysqlConn)
|
ctx := upload.Ctx
|
||||||
err := resourceModel.Trans(upload.Ctx, func(ctx context.Context, connGorm *gorm.DB) error {
|
err := upload.MysqlConn.Transaction(func(connGorm *gorm.DB) error {
|
||||||
resourceModelTS := gmodel.NewFsResourceModel(connGorm)
|
resourceModelTS := gmodel.NewFsResourceModel(connGorm)
|
||||||
resourceInfo, err := resourceModelTS.FindOneById(ctx, resourceId)
|
resourceInfo, err := resourceModelTS.FindOneById(ctx, resourceId)
|
||||||
if err == nil && resourceInfo.ResourceId != "" {
|
if err == nil && resourceInfo.ResourceId != "" {
|
||||||
|
|
Loading…
Reference in New Issue
Block a user