dengbiao преди 4 дни
родител
ревизия
e2bb44c826
променени са 2 файла, в които са добавени 15 реда и са изтрити 37 реда
  1. +1
    -23
      app/hdl/hdl_add_friend.go
  2. +14
    -14
      etc/cfg.yml

+ 1
- 23
app/hdl/hdl_add_friend.go Целия файл

@@ -410,21 +410,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)
@@ -448,11 +433,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 {
@@ -463,16 +443,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 {


+ 14
- 14
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'


Зареждане…
Отказ
Запис