|
|
@@ -124,15 +124,15 @@ func handleZhiosOrderSettleTotal(msg []byte) error { |
|
|
|
continue |
|
|
|
} |
|
|
|
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 { |
|
|
|
sess.Rollback() |
|
|
|
return err |
|
|
|
} |
|
|
|
if update1 == 0 { |
|
|
|
sess.Rollback() |
|
|
|
return errors.New("失败") |
|
|
|
} |
|
|
|
//if update1 == 0 { |
|
|
|
// sess.Rollback() |
|
|
|
// return errors.New("失败") |
|
|
|
//} |
|
|
|
|
|
|
|
var userStatistics2 model.UserMonthAmount |
|
|
|
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) |
|
|
|
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 { |
|
|
|
sess.Rollback() |
|
|
|
return err2 |
|
|
|
} |
|
|
|
if update2 == 0 { |
|
|
|
sess.Rollback() |
|
|
|
return errors.New("失败") |
|
|
|
} |
|
|
|
//if update2 == 0 { |
|
|
|
// sess.Rollback() |
|
|
|
// return errors.New("失败") |
|
|
|
//} |
|
|
|
} |
|
|
|
} |
|
|
|
sess.Commit() |
|
|
|