|
|
@@ -119,25 +119,36 @@ func handleZhiosOrderTotalSecond(msg []byte) error { |
|
|
|
Date: utils.StrToInt(now), |
|
|
|
Uid: v.Uid, |
|
|
|
} |
|
|
|
_, err := sess.Insert(&userStatistics) |
|
|
|
has, err := sess.Insert(&userStatistics) |
|
|
|
if err != nil { |
|
|
|
sess.Rollback() |
|
|
|
return err |
|
|
|
} |
|
|
|
if has == 0 { |
|
|
|
sess.Rollback() |
|
|
|
return errors.New("失败") |
|
|
|
} |
|
|
|
} |
|
|
|
isupdate := 0 |
|
|
|
if ordData.State == 4 && ordData.IsTotal == 1 { |
|
|
|
isupdate = 1 |
|
|
|
isTotal = 2 |
|
|
|
userStatistics.Amount = utils.Float64ToStrByPrec(utils.StrToFloat64(userStatistics.Amount)-v.Amount-utils.StrToFloat64(v.AdditionalSubsidy), 4) |
|
|
|
} |
|
|
|
if ordData.State != 4 && ordData.IsTotal == 0 { |
|
|
|
isupdate = 1 |
|
|
|
isTotal = 1 |
|
|
|
userStatistics.Amount = utils.Float64ToStrByPrec(utils.StrToFloat64(userStatistics.Amount)+v.Amount+utils.StrToFloat64(v.AdditionalSubsidy), 4) |
|
|
|
} |
|
|
|
_, err := sess.Where("id=?", userStatistics.Id).Cols("amount").Update(&userStatistics) |
|
|
|
update, err := sess.Where("id=?", userStatistics.Id).Cols("amount").Update(&userStatistics) |
|
|
|
if err != nil { |
|
|
|
sess.Rollback() |
|
|
|
return err |
|
|
|
} |
|
|
|
if update == 0 && isupdate == 1 { |
|
|
|
sess.Rollback() |
|
|
|
return errors.New("失败") |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} else { |
|
|
|