diff --git a/app/hdl/hdl_add_friend.go b/app/hdl/hdl_add_friend.go index 105ccae..619216a 100644 --- a/app/hdl/hdl_add_friend.go +++ b/app/hdl/hdl_add_friend.go @@ -377,21 +377,6 @@ func BasalRate(c *gin.Context) { e.OutErr(c, e.ERR_USER_CHECK_ERR, nil) return } - energyBasicSettingDb := implement.NewEggEnergyBasicSettingDb(db.Db) - eggEnergyBasicSetting, err := energyBasicSettingDb.EggEnergyBasicSettingGetOneByParams(map[string]interface{}{ - "key": "is_open", - "value": 1, - }) - if err != nil { - e.OutErr(c, e.ERR_DB_ORM, err.Error()) - return - } - coinID := eggEnergyBasicSetting.PersonEggEnergyCoinId - coinDb := implement.NewVirtualCoinDb(db.Db) - coin, err := coinDb.VirtualCoinGetOneByParams(map[string]interface{}{ - "key": "id", - "value": coinID, - }) now := time.Now() nowStr := now.Format("2006-01-02 15:04:05") signInDb := implement.NewEggSignInDb(db.Db) @@ -415,11 +400,6 @@ func BasalRate(c *gin.Context) { e.OutSuc(c, resp, nil) return } - ratio, err := decimal.NewFromString(coin.ExchangeRatio) - if err != nil { - e.OutErr(c, e.ERR_UNMARSHAL, err.Error()) - return - } estimatePerSecondEggEnergyValue, err := decimal.NewFromString(eggSignIn.EstimatePerSecondPersonEggEnergyValue) if err != nil { @@ -430,16 +410,14 @@ func BasalRate(c *gin.Context) { consumedTimeSec := now.Unix() - utils.TimeParseStd(eggSignIn.StartTime).Unix() consumedTime := decimal.NewFromInt(consumedTimeSec).Div(decimal.NewFromInt(60 * 60)) consumedEggEnergy := decimal.NewFromInt(consumedTimeSec).Mul(estimatePerSecondEggEnergyValue) - consumedAmount := consumedEggEnergy.Div(ratio) // 剩余时间、待收益 remainingTimeSec := utils.TimeParseStd(eggSignIn.EndTime).Unix() - now.Unix() remainingTime := decimal.NewFromInt(remainingTimeSec).Div(decimal.NewFromInt(60 * 60)) remainingEggEnergy := decimal.NewFromInt(remainingTimeSec).Mul(estimatePerSecondEggEnergyValue) - remainingAmount := remainingEggEnergy.Div(ratio) // 预估收益 - estimatedRevenue := consumedAmount.Add(remainingAmount) + estimatedRevenue := consumedEggEnergy.Add(remainingEggEnergy) // 基础速率 / 每小时 basalRateDecimal, err := decimal.NewFromString(eggSignIn.EstimatePerSecondPersonEggEnergyValue) if err != nil { diff --git a/etc/cfg.yml b/etc/cfg.yml index a347bc5..9e6a870 100644 --- a/etc/cfg.yml +++ b/etc/cfg.yml @@ -47,28 +47,28 @@ db_back: show_log: true path: 'tmp/%s.log' -#im_db: -# host: '119.23.182.117:3306' -# name: 'egg-im' -# user: 'root' -# psw: 'Fnuo123com@' -# show_log: true -# max_lifetime: 30 -# max_open_conns: 100 -# max_idle_conns: 100 -# path: 'tmp/%s.log' - im_db: - host: 'advertisement-db.rwlb.rds.aliyuncs.com:3306' + host: '119.23.182.117:3306' name: 'egg-im' - user: 'canal' - psw: 'DengBiao@1997' + user: 'root' + psw: 'Fnuo123com@' show_log: true max_lifetime: 30 max_open_conns: 100 max_idle_conns: 100 path: 'tmp/%s.log' +#im_db: +# host: 'advertisement-db.rwlb.rds.aliyuncs.com:3306' +# name: 'egg-im' +# user: 'canal' +# psw: 'DengBiao@1997' +# show_log: true +# max_lifetime: 30 +# max_open_conns: 100 +# max_idle_conns: 100 +# path: 'tmp/%s.log' + # 日志 log: app_name: 'applet'