|
|
|
@ -366,12 +366,13 @@ func payDeposit(tx *gorm.DB, orderInfo order.Information, wallet *jyy.UserWallet
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if orderInfo.ActualTotalAmount.GreaterThan(decimal.NewFromFloat(0.0)) {
|
|
|
|
|
if r := tx.Model(&wallet).Where("version = ?", wallet.Version).Updates(map[string]interface{}{
|
|
|
|
|
if r := tx.Model(wallet).Where("version = ?", wallet.Version).Updates(map[string]interface{}{
|
|
|
|
|
"deposit": gorm.Expr("deposit - ?", orderInfo.ActualTotalAmount),
|
|
|
|
|
"version": gorm.Expr("version + 1"),
|
|
|
|
|
}).RowsAffected; r == 0 {
|
|
|
|
|
return errors.New("账户扣款失败")
|
|
|
|
|
}
|
|
|
|
|
fmt.Println(wallet.Deposit)
|
|
|
|
|
if e := tx.Create(&jyy.UserWalletRecord{
|
|
|
|
|
WalletID: wallet.ID,
|
|
|
|
|
UserID: int(orderInfo.UserID),
|
|
|
|
|