瀏覽代碼

update

master
shenjiachi 11 小時之前
父節點
當前提交
425e706e69
共有 2 個文件被更改,包括 9 次插入22 次删除
  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 查看文件

@@ -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 查看文件

@@ -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…
取消
儲存