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