Quellcode durchsuchen

更新

one_orenge
huangjiajun vor 8 Monaten
Ursprung
Commit
05c4ed77ef
1 geänderte Dateien mit 31 neuen und 0 gelöschten Zeilen
  1. +31
    -0
      consume/zhios_order_settle_total.go

+ 31
- 0
consume/zhios_order_settle_total.go Datei anzeigen

@@ -134,6 +134,37 @@ func handleZhiosOrderSettleTotal(msg []byte) error {
return errors.New("失败")
}

var userStatistics2 model.UserMonthAmount
if ordData.SettleAt == 0 {
ordData.SettleAt = int(time.Now().Unix())
}
now := time.Unix(int64(ordData.SettleAt), 0).Format("200601")
sess.Where("uid=? and date=?", v.Uid, now).Get(&userStatistics2)
if userStatistics2.Id == 0 {
userStatistics2 = model.UserMonthAmount{
Date: utils.StrToInt(now),
Uid: v.Uid,
}
has, err := sess.Insert(&userStatistics2)
if err != nil {
sess.Rollback()
return err
}
if has == 0 {
sess.Rollback()
return errors.New("失败")
}
}
userStatistics2.Amount = utils.Float64ToStrByPrec(utils.StrToFloat64(userStatistics2.SettleAmount)+v.Amount+utils.StrToFloat64(v.AdditionalSubsidy), 4)
update2, err2 := eg.Where("id=?", userStatistics2.Id).Cols("settle_amount").Update(&userStatistics2)
if err2 != nil {
sess.Rollback()
return err2
}
if update2 == 0 {
sess.Rollback()
return errors.New("失败")
}
}
}
sess.Commit()


Laden…
Abbrechen
Speichern