Przeglądaj źródła

Merge remote-tracking branch 'origin/master'

one_orenge
DengBiao 8 miesięcy temu
rodzic
commit
681959e447
1 zmienionych plików z 13 dodań i 2 usunięć
  1. +13
    -2
      consume/zhios_order_total_second.go

+ 13
- 2
consume/zhios_order_total_second.go Wyświetl plik

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


Ładowanie…
Anuluj
Zapisz