Browse Source

更新

one_orenge
huangjiajun 7 months ago
parent
commit
303f9c5f37
1 changed files with 10 additions and 10 deletions
  1. +10
    -10
      consume/zhios_order_settle_total.go

+ 10
- 10
consume/zhios_order_settle_total.go View File

@@ -124,15 +124,15 @@ func handleZhiosOrderSettleTotal(msg []byte) error {
continue continue
} }
userStatistics1.Amount = utils.Float64ToStrByPrec(utils.StrToFloat64(userStatistics1.Amount)-v.Amount-utils.StrToFloat64(v.AdditionalSubsidy), 4) userStatistics1.Amount = utils.Float64ToStrByPrec(utils.StrToFloat64(userStatistics1.Amount)-v.Amount-utils.StrToFloat64(v.AdditionalSubsidy), 4)
update1, err1 := sess.Where("id=?", userStatistics1.Id).Cols("amount").Update(&userStatistics1)
_, err1 := sess.Where("id=?", userStatistics1.Id).Cols("amount").Update(&userStatistics1)
if err1 != nil { if err1 != nil {
sess.Rollback() sess.Rollback()
return err return err
} }
if update1 == 0 {
sess.Rollback()
return errors.New("失败")
}
//if update1 == 0 {
// sess.Rollback()
// return errors.New("失败")
//}


var userStatistics2 model.UserMonthAmount var userStatistics2 model.UserMonthAmount
if ordData.SettleAt == 0 { if ordData.SettleAt == 0 {
@@ -156,15 +156,15 @@ func handleZhiosOrderSettleTotal(msg []byte) error {
} }
} }
userStatistics2.SettleAmount = utils.Float64ToStrByPrec(utils.StrToFloat64(userStatistics2.SettleAmount)+v.Amount+utils.StrToFloat64(v.AdditionalSubsidy), 4) userStatistics2.SettleAmount = utils.Float64ToStrByPrec(utils.StrToFloat64(userStatistics2.SettleAmount)+v.Amount+utils.StrToFloat64(v.AdditionalSubsidy), 4)
update2, err2 := eg.Where("id=?", userStatistics2.Id).Cols("settle_amount").Update(&userStatistics2)
_, err2 := eg.Where("id=?", userStatistics2.Id).Cols("settle_amount").Update(&userStatistics2)
if err2 != nil { if err2 != nil {
sess.Rollback() sess.Rollback()
return err2 return err2
} }
if update2 == 0 {
sess.Rollback()
return errors.New("失败")
}
//if update2 == 0 {
// sess.Rollback()
// return errors.New("失败")
//}
} }
} }
sess.Commit() sess.Commit()


Loading…
Cancel
Save