Selaa lähdekoodia

update

master
dengbiao 4 päivää sitten
vanhempi
commit
c3cb68deeb
1 muutettua tiedostoa jossa 35 lisäystä ja 2 poistoa
  1. +35
    -2
      app/hdl/hdl_add_friend.go

+ 35
- 2
app/hdl/hdl_add_friend.go Näytä tiedosto

@@ -106,7 +106,7 @@ func EggEnergyDetails(c *gin.Context) {
list = append(list, tmp)
}

//3、获取当前用户 蛋蛋能量(可用+结算)、 预估总价值
//3、获取当前用户 蛋蛋能量(可用+结算+预估)、 预估总价值
virtualAmountDb := implement.NewUserVirtualAmountDb(db.Db)
personEggEnergy, err := virtualAmountDb.GetUserVirtualWalletBySession(user.Id, eggEnergyBasicSetting.PersonEggEnergyCoinId)
if err != nil {
@@ -124,7 +124,40 @@ func EggEnergyDetails(c *gin.Context) {
e.OutErr(c, e.ERR_DB_ORM, err.Error())
return
}
totalEggEnergy := utils.StrToFloat64(personEggEnergy.Amount) + utils.StrToFloat64(teamEggEnergy.Amount)

now := time.Now()
signInDb := implement.NewEggSignInDb(db.Db)
nowStr := now.Format("2006-01-02 15:04:05")
has, signIn, err := signInDb.EggSignINGetOneByTimeAndUid("", nowStr, user.Id, 0)
if err != nil {
e.OutErr(c, e.ERR_DB_ORM, err.Error())
return
}

var estimatePersonEggEnergyValue decimal.Decimal
var estimateTeamEggEnergyValue decimal.Decimal
if has && utils.TimeParseStd(signIn.EndTime).After(now) {
//获取预估每秒获得蛋蛋能量数
estimatePerSecondPersonEggEnergyValue, err1 := decimal.NewFromString(signIn.EstimatePerSecondPersonEggEnergyValue)
if err1 != nil {
e.OutErr(c, e.ERR, err1.Error())
return
}
estimatePerSecondTeamEggEnergyValue, err1 := decimal.NewFromString(signIn.EstimatePerSecondTeamEggEnergyValue)
if err1 != nil {
e.OutErr(c, e.ERR, err1.Error())
return
}

//3.2.2 计算预估获得的蛋蛋能量数
estimateTimeSec := now.Unix() - utils.TimeParseStd(signIn.StartTime).Unix()
estimatePersonEggEnergyValue = decimal.NewFromInt(estimateTimeSec).Mul(estimatePerSecondPersonEggEnergyValue)
estimateTeamEggEnergyValue = decimal.NewFromInt(estimateTimeSec).Mul(estimatePerSecondTeamEggEnergyValue)
}
personEggEnergyValue, _ := decimal.NewFromString(personEggEnergy.Amount)
teamEggEnergyValue, _ := decimal.NewFromString(teamEggEnergy.Amount)

totalEggEnergy, _ := personEggEnergyValue.Add(teamEggEnergyValue).Add(estimatePersonEggEnergyValue).Add(estimateTeamEggEnergyValue).Float64()
totalEggEnergyPrice := totalEggEnergy * utils.StrToFloat64(coreData.NowPrice)

transferTypeList := md.TransferTypeList{


Ladataan…
Peruuta
Tallenna