diff --git a/app/hdl/institutional_management/egg_energy/hdl_basic.go b/app/hdl/institutional_management/egg_energy/hdl_basic.go index 44fc418..db7c0d8 100644 --- a/app/hdl/institutional_management/egg_energy/hdl_basic.go +++ b/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) diff --git a/app/md/institutional_management/egg_energy/md_basic.go b/app/md/institutional_management/egg_energy/md_basic.go index 94ef41f..669000e 100644 --- a/app/md/institutional_management/egg_energy/md_basic.go +++ b/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 {