|
|
@@ -269,40 +269,38 @@ func handleZhiosOrderTotalSecond(msg []byte) error { |
|
|
|
sess.Rollback() |
|
|
|
return err |
|
|
|
} |
|
|
|
if ordData.CreateAt > 1711092953 { |
|
|
|
var userStatistics1 model.UserWaitAmount |
|
|
|
sess.Where("uid=? ", v.Uid).Get(&userStatistics1) |
|
|
|
if userStatistics1.Id == 0 { |
|
|
|
userStatistics1 = model.UserWaitAmount{ |
|
|
|
Uid: v.Uid, |
|
|
|
} |
|
|
|
has, err := sess.Insert(&userStatistics1) |
|
|
|
if err != nil { |
|
|
|
sess.Rollback() |
|
|
|
return err |
|
|
|
} |
|
|
|
if has == 0 { |
|
|
|
sess.Rollback() |
|
|
|
return errors.New("失败") |
|
|
|
} |
|
|
|
} |
|
|
|
if ordData.State == 4 && (ordData.IsTotal == 1 || ordData.IsTotal == 3) { |
|
|
|
isTotal = 2 |
|
|
|
userStatistics1.Amount = utils.Float64ToStrByPrec(utils.StrToFloat64(userStatistics1.Amount)-utils.StrToFloat64(v.AfterAmount), 4) |
|
|
|
} |
|
|
|
if ordData.State != 4 && (ordData.IsTotal == 0) { |
|
|
|
isTotal = 3 |
|
|
|
userStatistics1.Amount = utils.Float64ToStrByPrec(utils.StrToFloat64(userStatistics1.Amount)+utils.StrToFloat64(v.AfterAmount), 4) |
|
|
|
} |
|
|
|
if ordData.State != 4 && (ordData.IsTotal == 1) { |
|
|
|
isTotal = 3 |
|
|
|
userStatistics1.Amount = utils.Float64ToStrByPrec(utils.StrToFloat64(userStatistics1.Amount)-utils.StrToFloat64(v.Amount), 4) |
|
|
|
var userStatistics1 model.UserWaitAmount |
|
|
|
sess.Where("uid=? ", v.Uid).Get(&userStatistics1) |
|
|
|
if userStatistics1.Id == 0 { |
|
|
|
userStatistics1 = model.UserWaitAmount{ |
|
|
|
Uid: v.Uid, |
|
|
|
} |
|
|
|
_, err := sess.Where("id=?", userStatistics1.Id).Cols("amount").Update(&userStatistics) |
|
|
|
has, err := sess.Insert(&userStatistics1) |
|
|
|
if err != nil { |
|
|
|
sess.Rollback() |
|
|
|
return err |
|
|
|
} |
|
|
|
if has == 0 { |
|
|
|
sess.Rollback() |
|
|
|
return errors.New("失败") |
|
|
|
} |
|
|
|
} |
|
|
|
if ordData.State == 4 && (ordData.IsTotal == 1 || ordData.IsTotal == 3) { |
|
|
|
isTotal = 2 |
|
|
|
userStatistics1.Amount = utils.Float64ToStrByPrec(utils.StrToFloat64(userStatistics1.Amount)-utils.StrToFloat64(v.AfterAmount), 4) |
|
|
|
} |
|
|
|
if ordData.State != 4 && (ordData.IsTotal == 0) { |
|
|
|
isTotal = 3 |
|
|
|
userStatistics1.Amount = utils.Float64ToStrByPrec(utils.StrToFloat64(userStatistics1.Amount)+utils.StrToFloat64(v.AfterAmount), 4) |
|
|
|
} |
|
|
|
if ordData.State != 4 && (ordData.IsTotal == 1) { |
|
|
|
isTotal = 3 |
|
|
|
userStatistics1.Amount = utils.Float64ToStrByPrec(utils.StrToFloat64(userStatistics1.Amount)-utils.StrToFloat64(v.Amount), 4) |
|
|
|
} |
|
|
|
_, err = sess.Where("id=?", userStatistics1.Id).Cols("amount").Update(&userStatistics) |
|
|
|
if err != nil { |
|
|
|
sess.Rollback() |
|
|
|
return err |
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|