Ver código fonte

Merge remote-tracking branch 'origin/master'

one_orenge
DengBiao 8 meses atrás
pai
commit
681959e447
1 arquivos alterados com 13 adições e 2 exclusões
  1. +13
    -2
      consume/zhios_order_total_second.go

+ 13
- 2
consume/zhios_order_total_second.go Ver arquivo

@@ -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 {


Carregando…
Cancelar
Salvar