|
|
@@ -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) |
|
|
|