Browse Source

update

master
shenjiachi 1 month ago
parent
commit
425e706e69
2 changed files with 9 additions and 22 deletions
  1. +5
    -18
      app/hdl/institutional_management/egg_energy/hdl_basic.go
  2. +4
    -4
      app/md/institutional_management/egg_energy/md_basic.go

+ 5
- 18
app/hdl/institutional_management/egg_energy/hdl_basic.go View File

@@ -392,36 +392,23 @@ func GetEggCoreDataList(c *gin.Context) {
return
}

sql := "SELECT SUM(amount) AS total, coin_id FORM `user_virtual_amount` GROUP BY (coin_id)"
sql := "SELECT SUM(amount) AS total, coin_id FROM `user_virtual_amount` GROUP BY (coin_id)"
results, err := db.Db.QueryString(sql)
if err != nil {
e.OutErr(c, e.ERR_DB_ORM, err.Error())
return
}
coinsHoldMap := make(map[int]string)
for _, result := range results {
coinsHoldMap[utils.StrToInt(result["coin_id"])] = result["total"]
}

basicSettingDb := implement.NewEggEnergyBasicSettingDb(db.Db)
basicSetting, err := basicSettingDb.EggEnergyBasicSettingGetOne()
if err != nil {
e.OutErr(c, e.ERR_DB_ORM, err.Error())
return
}
userHoldTotalNumsMap := map[string]string{
"PersonEggEnergyUserHoldTotal": coinsHoldMap[basicSetting.PersonEggEnergyCoinId],
"TeamEggEnergyUserHoldTotal": coinsHoldMap[basicSetting.TeamEggEnergyCoinId],
"PersonEggPointsUserHoldTotal": coinsHoldMap[basicSetting.PersonEggPointsCoinId],
"TeamEggPointsUserHoldTotal": coinsHoldMap[basicSetting.TeamEggPointsCoinId],
"ContributionUserHoldTotal": coinsHoldMap[basicSetting.ContributionCoinId],
var userHoldTotalNums float64
for _, result := range results {
userHoldTotalNums += utils.StrToFloat64(result["total"])
}

resp := md.GetEggCoreDataListResp{
PlanetTotalValue: coreData.PlanetTotalValue,
NowPrice: coreData.NowPrice,
NowEnergyTotalNums: coreData.NowEnergyTotalNums,
UserHoldTotalNums: userHoldTotalNumsMap,
UserHoldTotalNums: utils.Float64ToStr(userHoldTotalNums),
}

e.OutSuc(c, resp, nil)


+ 4
- 4
app/md/institutional_management/egg_energy/md_basic.go View File

@@ -98,10 +98,10 @@ type UpdateEggEnergyVipSettingReq struct {
}

type GetEggCoreDataListResp struct {
PlanetTotalValue string `json:"planet_total_value" example:"星球价值"` // 星球价值
NowPrice string `json:"now_price" example:"当前价格"` // 当前价格
NowEnergyTotalNums string `json:"now_energy_total_nums" example:"现行总量"` // 现行总量
UserHoldTotalNums map[string]string `json:"user_hold_total_nums"` // 用户持有总量
PlanetTotalValue string `json:"planet_total_value" example:"星球价值"` // 星球价值
NowPrice string `json:"now_price" example:"当前价格"` // 当前价格
NowEnergyTotalNums string `json:"now_energy_total_nums" example:"现行总量"` // 现行总量
UserHoldTotalNums string `json:"user_hold_total_nums"` // 用户持有总量
}

type GetPriceCurveResp struct {


Loading…
Cancel
Save