Browse Source

fix: add TotalEggEnergyValue

master
shenjiachi 1 day ago
parent
commit
3886b897de
2 changed files with 33 additions and 18 deletions
  1. +23
    -9
      app/hdl/hdl_home_page.go
  2. +10
    -9
      app/md/md_home_page.go

+ 23
- 9
app/hdl/hdl_home_page.go View File

@@ -144,6 +144,19 @@ func HomePage(c *gin.Context) {


// 6、预估能量 + 原有能量 // 6、预估能量 + 原有能量
totalEggEnergyDecimal := decimal.NewFromFloat(totalEggEnergy).Add(estimatePersonEggEnergyValue).Add(estimateTeamEggEnergyValue) totalEggEnergyDecimal := decimal.NewFromFloat(totalEggEnergy).Add(estimatePersonEggEnergyValue).Add(estimateTeamEggEnergyValue)
// 7、总能量预估价值
coreDataDb := implement.NewEggEnergyCoreDataDb(db.Db)
coreData, err := coreDataDb.EggEnergyCoreDataGet()
if err != nil {
e.OutErr(c, e.ERR_DB_ORM, err.Error())
return
}
nowPriceDecimal, err := decimal.NewFromString(coreData.NowPrice)
if err != nil {
e.OutErr(c, e.ERR, err.Error())
return
}
totalEggEnergyValueDecimal := totalEggEnergyDecimal.Mul(nowPriceDecimal)


utils.FilePutContents("HomePage", utils.SerializeStr(map[string]interface{}{ utils.FilePutContents("HomePage", utils.SerializeStr(map[string]interface{}{
"user_phone": user.Phone, "user_phone": user.Phone,
@@ -167,15 +180,16 @@ func HomePage(c *gin.Context) {
})) }))


resp := md.HomePageResp{ resp := md.HomePageResp{
LeaveTimer: utils.Int64ToStr(residueTimes),
IsSign: isSign,
SignEndTime: signCountdown,
TotalEggEnergy: totalEggEnergyDecimal.String(),
TotalActivePoints: utils.Float64ToStr(totalActivePoints),
InitialPrice: initialPrice,
NowBasalRate: utils.Float64ToStr(nowBasalRate),
NowTeamRate: utils.Float64ToStr(NowTeamRate),
NickName: user.Nickname,
LeaveTimer: utils.Int64ToStr(residueTimes),
IsSign: isSign,
SignEndTime: signCountdown,
TotalEggEnergy: totalEggEnergyDecimal.String(),
TotalEggEnergyValue: totalEggEnergyValueDecimal.String(),
TotalActivePoints: utils.Float64ToStr(totalActivePoints),
InitialPrice: initialPrice,
NowBasalRate: utils.Float64ToStr(nowBasalRate),
NowTeamRate: utils.Float64ToStr(NowTeamRate),
NickName: user.Nickname,
} }


e.OutSuc(c, resp, nil) e.OutSuc(c, resp, nil)


+ 10
- 9
app/md/md_home_page.go View File

@@ -1,15 +1,16 @@
package md package md


type HomePageResp struct { type HomePageResp struct {
IsSign bool `json:"is_sign"` // 是否开始签到
SignEndTime string `json:"sign_end_time"` // 签到截止时间
TotalEggEnergy string `json:"total_egg_energy"` // 总蛋蛋能量
TotalActivePoints string `json:"total_active_points"` // 总蛋蛋积分
InitialPrice string `json:"initial_price"` // 蛋蛋能量初始价格
NowBasalRate string `json:"now_basal_rate"` // 当前基础速率/小时
NowTeamRate string `json:"now_team_rate"` // 当前团队速率/小时
NickName string `json:"nick_name"` // 用户名称
LeaveTimer string `json:"leave_timer"` // 可签到剩余时间 秒
IsSign bool `json:"is_sign"` // 是否开始签到
SignEndTime string `json:"sign_end_time"` // 签到截止时间
TotalEggEnergy string `json:"total_egg_energy"` // 总蛋蛋能量 (个人+团队+预估)
TotalEggEnergyValue string `json:"total_egg_energy_value"` // 总蛋蛋能量价值
TotalActivePoints string `json:"total_active_points"` // 总蛋蛋积分
InitialPrice string `json:"initial_price"` // 蛋蛋能量初始价格
NowBasalRate string `json:"now_basal_rate"` // 当前基础速率/小时
NowTeamRate string `json:"now_team_rate"` // 当前团队速率/小时
NickName string `json:"nick_name"` // 用户名称
LeaveTimer string `json:"leave_timer"` // 可签到剩余时间 秒
} }


type HomePageWatchAdRuleResp struct { type HomePageWatchAdRuleResp struct {


Loading…
Cancel
Save