@@ -105,12 +105,6 @@ func EggEnergyDetails(c *gin.Context) { | |||||
} | } | ||||
//3、获取当前用户 蛋蛋能量(可用+结算)、 预估总价值 | //3、获取当前用户 蛋蛋能量(可用+结算)、 预估总价值 | ||||
var teamRewardSetting *md2.TeamRewardSettingStruct | |||||
err = json.Unmarshal([]byte(eggEnergyBasicSetting.DirectPushReward), &teamRewardSetting) | |||||
if err != nil { | |||||
e.OutErr(c, e.ERR, err.Error()) | |||||
return | |||||
} | |||||
virtualAmountDb := implement.NewUserVirtualAmountDb(db.Db) | virtualAmountDb := implement.NewUserVirtualAmountDb(db.Db) | ||||
personEggEnergy, err := virtualAmountDb.GetUserVirtualWalletBySession(user.Id, eggEnergyBasicSetting.PersonEggEnergyCoinId) | personEggEnergy, err := virtualAmountDb.GetUserVirtualWalletBySession(user.Id, eggEnergyBasicSetting.PersonEggEnergyCoinId) | ||||
if err != nil { | if err != nil { | ||||
@@ -282,12 +276,6 @@ func EggPointDetails(c *gin.Context) { | |||||
} | } | ||||
list = append(list, tmp) | list = append(list, tmp) | ||||
} | } | ||||
var teamRewardSetting *md2.TeamRewardSettingStruct | |||||
err = json.Unmarshal([]byte(eggEnergyBasicSetting.DirectPushReward), &teamRewardSetting) | |||||
if err != nil { | |||||
e.OutErr(c, e.ERR, err.Error()) | |||||
return | |||||
} | |||||
virtualAmountDb := implement.NewUserVirtualAmountDb(db.Db) | virtualAmountDb := implement.NewUserVirtualAmountDb(db.Db) | ||||
var totalEggPoints float64 | var totalEggPoints float64 | ||||
personEggPoints, err := virtualAmountDb.GetUserVirtualWalletBySession(user.Id, eggEnergyBasicSetting.PersonEggEnergyCoinId) | personEggPoints, err := virtualAmountDb.GetUserVirtualWalletBySession(user.Id, eggEnergyBasicSetting.PersonEggEnergyCoinId) | ||||
@@ -434,7 +422,7 @@ func BasalRate(c *gin.Context) { | |||||
return | return | ||||
} | } | ||||
estimatePerSecondEggEnergyValue, err := decimal.NewFromString(eggSignIn.EstimatePerSecondEggEnergyValue) | |||||
estimatePerSecondEggEnergyValue, err := decimal.NewFromString(eggSignIn.EstimatePerSecondPersonEggEnergyValue) | |||||
if err != nil { | if err != nil { | ||||
e.OutErr(c, e.ERR_UNMARSHAL, err.Error()) | e.OutErr(c, e.ERR_UNMARSHAL, err.Error()) | ||||
return | return | ||||
@@ -454,7 +442,7 @@ func BasalRate(c *gin.Context) { | |||||
// 预估收益 | // 预估收益 | ||||
estimatedRevenue := consumedAmount.Add(remainingAmount) | estimatedRevenue := consumedAmount.Add(remainingAmount) | ||||
// 基础速率 / 每小时 | // 基础速率 / 每小时 | ||||
basalRateDecimal, err := decimal.NewFromString(eggSignIn.EstimatePerSecondEggEnergyValue) | |||||
basalRateDecimal, err := decimal.NewFromString(eggSignIn.EstimatePerSecondPersonEggEnergyValue) | |||||
if err != nil { | if err != nil { | ||||
e.OutErr(c, e.ERR_UNMARSHAL, err.Error()) | e.OutErr(c, e.ERR_UNMARSHAL, err.Error()) | ||||
return | return | ||||
@@ -468,13 +456,13 @@ func BasalRate(c *gin.Context) { | |||||
signCountdown := fmt.Sprintf("%d:%d:%d", hours, minutes, seconds) //收益倒计时 | signCountdown := fmt.Sprintf("%d:%d:%d", hours, minutes, seconds) //收益倒计时 | ||||
resp := md.BasalRateResp{ | resp := md.BasalRateResp{ | ||||
ConsumedTime: consumedTime.StringFixed(2), | |||||
ConsumedEggEnergy: consumedEggEnergy.StringFixed(2), | |||||
RemainingTime: remainingTime.StringFixed(2), | |||||
RemainingEggEnergy: remainingEggEnergy.StringFixed(2), | |||||
BasalRate: basalRate.StringFixed(2), | |||||
ConsumedTime: consumedTime.String(), | |||||
ConsumedEggEnergy: consumedEggEnergy.String(), | |||||
RemainingTime: remainingTime.String(), | |||||
RemainingEggEnergy: remainingEggEnergy.String(), | |||||
BasalRate: basalRate.String(), | |||||
ConsumedEggPoint: eggSignIn.TotalPersonEggPoints, | ConsumedEggPoint: eggSignIn.TotalPersonEggPoints, | ||||
EstimatedRevenue: estimatedRevenue.StringFixed(2), | |||||
EstimatedRevenue: estimatedRevenue.String(), | |||||
SignCountdown: signCountdown, | SignCountdown: signCountdown, | ||||
} | } | ||||
e.OutSuc(c, resp, nil) | e.OutSuc(c, resp, nil) | ||||
@@ -501,102 +489,35 @@ func TotalRate(c *gin.Context) { | |||||
e.OutErr(c, e.ERR_USER_CHECK_ERR, nil) | e.OutErr(c, e.ERR_USER_CHECK_ERR, nil) | ||||
return | return | ||||
} | } | ||||
energyBasicSettingDb := implement.NewEggEnergyBasicSettingDb(db.Db) | |||||
eggEnergyBasicSetting, err := energyBasicSettingDb.EggEnergyBasicSettingGetOneByParams(map[string]interface{}{ | |||||
"key": "is_open", | |||||
"value": 1, | |||||
}) | |||||
if err != nil { | |||||
e.OutErr(c, e.ERR_DB_ORM, err.Error()) | |||||
return | |||||
} | |||||
var teamRewardSetting *md2.TeamRewardSettingStruct | |||||
err = json.Unmarshal([]byte(eggEnergyBasicSetting.DirectPushReward), &teamRewardSetting) | |||||
if err != nil { | |||||
e.OutErr(c, e.ERR, err.Error()) | |||||
return | |||||
} | |||||
now := time.Now() | now := time.Now() | ||||
nowStr := now.Format("2006-01-02 15:04:05") | |||||
signInDb := implement.NewEggSignInDb(db.Db) | signInDb := implement.NewEggSignInDb(db.Db) | ||||
// 计算用户是否在团队收益时间段内签到 | |||||
var oneRoundDuration = utils.StrToInt(teamRewardSetting.OneRoundDuration) | |||||
startTime := now.Add(-time.Hour * time.Duration(oneRoundDuration)).Format("2006-01-02 15:04:05") | |||||
exit, signIn, err := signInDb.EggSignInGetOne(startTime, now.Format("2006-01-02 15:04:05"), user.Id) | |||||
exit, signIn, err := signInDb.EggSignInGetOne(nowStr, nowStr, user.Id) | |||||
if err != nil { | if err != nil { | ||||
e.OutErr(c, e.ERR_DB_ORM, err.Error()) | e.OutErr(c, e.ERR_DB_ORM, err.Error()) | ||||
return | return | ||||
} | } | ||||
var signEggEnergy = "0.00" | |||||
var signPersonEggEnergy = "0.00" | |||||
var signTeamEggEnergy = "0.00" | |||||
if exit && utils.TimeParseStd(signIn.EndTime).After(now) { | if exit && utils.TimeParseStd(signIn.EndTime).After(now) { | ||||
//获取预估每秒获得蛋蛋能量数 | //获取预估每秒获得蛋蛋能量数 | ||||
estimatePerSecondEggEnergyValue, err1 := decimal.NewFromString(signIn.EstimatePerSecondEggEnergyValue) | |||||
estimatePerSecondPersonEggEnergyValue, err1 := decimal.NewFromString(signIn.EstimatePerSecondPersonEggEnergyValue) | |||||
if err1 != nil { | if err1 != nil { | ||||
e.OutErr(c, e.ERR, err1.Error()) | |||||
return | |||||
} | |||||
signEggEnergy = estimatePerSecondEggEnergyValue.String() | |||||
} | |||||
nowBasalRate := utils.StrToFloat64(signEggEnergy) * 60 * 60 //每小时基础速率 | |||||
var estimateLevel int | |||||
nowBasalRateValue := decimal.NewFromFloat(nowBasalRate) | |||||
for { | |||||
estimateLevel++ | |||||
rewardDecrementValue := utils.StrToFloat64(teamRewardSetting.RewardDecrementValue) / 100 | |||||
tmpRewardBase := decimal.NewFromFloat(math.Pow(rewardDecrementValue, float64(estimateLevel))) | |||||
tmpReward := nowBasalRateValue.Mul(tmpRewardBase) | |||||
rewardEndValue, _ := decimal.NewFromString(teamRewardSetting.RewardEndValue) | |||||
if !tmpReward.GreaterThanOrEqual(rewardEndValue) { | |||||
estimateLevel-- | |||||
break | |||||
} | |||||
if estimateLevel == 99 { | |||||
e.OutErr(c, e.ERR, "奖励结束值设置有误") | |||||
e.OutErr(c, e.ERR_DB_ORM, err1.Error()) | |||||
return | return | ||||
} | } | ||||
} | |||||
relateDb := implement.NewUserRelateDb(db.Db) | |||||
userRelates, err := relateDb.FindUserRelateByParentUid(user.Id, estimateLevel) | |||||
if err != nil { | |||||
e.OutErr(c, e.ERR, err.Error()) | |||||
return | |||||
} | |||||
var userRelatesUids []string | |||||
var userRelatesMap = map[int64]model.UserRelate{} | |||||
if userRelates != nil { | |||||
for _, userRelate := range *userRelates { | |||||
userRelatesUids = append(userRelatesUids, utils.Int64ToStr(userRelate.Uid)) | |||||
userRelatesMap[userRelate.Uid] = userRelate | |||||
} | |||||
} | |||||
var eggSignIns []*model.EggSignIn | |||||
if len(userRelatesUids) > 0 { | |||||
eggSignIns, err = signInDb.EggSignInFindByParams(map[string]interface{}{ | |||||
"key": "uid", | |||||
"value": userRelatesUids, | |||||
}) | |||||
if err != nil { | |||||
e.OutErr(c, e.ERR_DB_ORM, err.Error()) | |||||
signPersonEggEnergy = estimatePerSecondPersonEggEnergyValue.String() | |||||
estimatePerSecondTeamEggEnergyValue, err2 := decimal.NewFromString(signIn.EstimatePerSecondTeamEggEnergyValue) | |||||
if err2 != nil { | |||||
e.OutErr(c, e.ERR_DB_ORM, err2.Error()) | |||||
return | return | ||||
} | } | ||||
signTeamEggEnergy = estimatePerSecondTeamEggEnergyValue.String() | |||||
} | } | ||||
var nowTeamRate float64 //每小时基础速率 | |||||
for _, vv := range eggSignIns { | |||||
rewardDecrementValue := utils.StrToFloat64(teamRewardSetting.RewardDecrementValue) / 100 | |||||
tmpRewardBase := decimal.NewFromFloat(math.Pow(rewardDecrementValue, float64(userRelatesMap[vv.Uid].Level))) | |||||
tmpReward := nowBasalRateValue.Mul(tmpRewardBase) | |||||
rewardEndValue, _ := decimal.NewFromString(teamRewardSetting.RewardEndValue) | |||||
if tmpReward.GreaterThanOrEqual(rewardEndValue) { | |||||
tmpRewardValue, _ := tmpReward.Float64() | |||||
nowTeamRate += tmpRewardValue | |||||
} | |||||
} | |||||
nowBasalRate := utils.StrToFloat64(signPersonEggEnergy) * 60 * 60 //每小时基础速率 | |||||
nowTeamRate := utils.StrToFloat64(signTeamEggEnergy) * 60 * 60 // 每小时团队速率 | |||||
resp := md.TotalRateResp{ | resp := md.TotalRateResp{ | ||||
NowBasalRate: utils.Float64ToStr(nowBasalRate), | NowBasalRate: utils.Float64ToStr(nowBasalRate), | ||||
NowTeamRate: utils.Float64ToStr(nowTeamRate), | NowTeamRate: utils.Float64ToStr(nowTeamRate), | ||||
@@ -13,7 +13,6 @@ import ( | |||||
"encoding/json" | "encoding/json" | ||||
"github.com/gin-gonic/gin" | "github.com/gin-gonic/gin" | ||||
"github.com/shopspring/decimal" | "github.com/shopspring/decimal" | ||||
"math" | |||||
"time" | "time" | ||||
) | ) | ||||
@@ -61,20 +60,12 @@ func HomePage(c *gin.Context) { | |||||
//3、获取当前用户 蛋蛋能量(可用+结算+今日签到预估蛋蛋能量) | //3、获取当前用户 蛋蛋能量(可用+结算+今日签到预估蛋蛋能量) | ||||
var isSign bool | var isSign bool | ||||
var signCountdown string | var signCountdown string | ||||
var signEggEnergy = "0.00" | |||||
var signPersonalEggEnergy = "0.00" | |||||
var signTeamEggEnergy = "0.00" | |||||
var totalEggEnergy float64 | var totalEggEnergy float64 | ||||
var teamRewardSetting *md2.TeamRewardSettingStruct | |||||
// 3.1 获取团队收益设置 一轮持续时间 | |||||
err = json.Unmarshal([]byte(eggEnergyBasicSetting.DirectPushReward), &teamRewardSetting) | |||||
if err != nil { | |||||
e.OutErr(c, e.ERR, err.Error()) | |||||
return | |||||
} | |||||
//3.2 计算用户是否在团队收益时间段内签到 | |||||
var oneRoundDuration = utils.StrToInt(teamRewardSetting.OneRoundDuration) | |||||
startTime := now.Add(-time.Hour * time.Duration(oneRoundDuration)).Format("2006-01-02 15:04:05") | |||||
nowStr := now.Format("2006-01-02 15:04:05") | |||||
signInDb := implement.NewEggSignInDb(db.Db) | signInDb := implement.NewEggSignInDb(db.Db) | ||||
has, signIn, err := signInDb.EggSignInGetOne(startTime, now.Format("2006-01-02 15:04:05"), user.Id) | |||||
has, signIn, err := signInDb.EggSignInGetOne(nowStr, nowStr, user.Id) | |||||
if err != nil { | if err != nil { | ||||
e.OutErr(c, e.ERR_DB_ORM, err.Error()) | e.OutErr(c, e.ERR_DB_ORM, err.Error()) | ||||
return | return | ||||
@@ -82,12 +73,18 @@ func HomePage(c *gin.Context) { | |||||
if has && utils.TimeParseStd(signIn.EndTime).After(now) { | if has && utils.TimeParseStd(signIn.EndTime).After(now) { | ||||
//3.2.1 获取预估每秒获得蛋蛋能量数 | //3.2.1 获取预估每秒获得蛋蛋能量数 | ||||
estimatePerSecondEggEnergyValue, err1 := decimal.NewFromString(signIn.EstimatePerSecondEggEnergyValue) | |||||
estimatePerSecondPersonEggEnergyValue, err1 := decimal.NewFromString(signIn.EstimatePerSecondPersonEggEnergyValue) | |||||
if err1 != nil { | |||||
e.OutErr(c, e.ERR, err1.Error()) | |||||
return | |||||
} | |||||
estimatePerSecondTeamEggEnergyValue, err1 := decimal.NewFromString(signIn.EstimatePerSecondTeamEggEnergyValue) | |||||
if err1 != nil { | if err1 != nil { | ||||
e.OutErr(c, e.ERR, err1.Error()) | e.OutErr(c, e.ERR, err1.Error()) | ||||
return | return | ||||
} | } | ||||
signEggEnergy = estimatePerSecondEggEnergyValue.String() | |||||
signPersonalEggEnergy = estimatePerSecondPersonEggEnergyValue.String() | |||||
signTeamEggEnergy = estimatePerSecondTeamEggEnergyValue.String() | |||||
isSign = true | isSign = true | ||||
signCountdown = signIn.EndTime | signCountdown = signIn.EndTime | ||||
} | } | ||||
@@ -96,13 +93,15 @@ func HomePage(c *gin.Context) { | |||||
amountDb := implement.NewUserVirtualAmountDb(db.Db) | amountDb := implement.NewUserVirtualAmountDb(db.Db) | ||||
personEggEnergy, err := amountDb.GetUserVirtualWalletBySession(user.Id, eggEnergyBasicSetting.PersonEggEnergyCoinId) | personEggEnergy, err := amountDb.GetUserVirtualWalletBySession(user.Id, eggEnergyBasicSetting.PersonEggEnergyCoinId) | ||||
if err != nil { | if err != nil { | ||||
e.OutErr(c, e.ERR_DB_ORM, nil) | |||||
return | return | ||||
} | } | ||||
teamEggEnergy, err := amountDb.GetUserVirtualWalletBySession(user.Id, eggEnergyBasicSetting.TeamEggEnergyCoinId) | teamEggEnergy, err := amountDb.GetUserVirtualWalletBySession(user.Id, eggEnergyBasicSetting.TeamEggEnergyCoinId) | ||||
if err != nil { | if err != nil { | ||||
e.OutErr(c, e.ERR_DB_ORM, nil) | |||||
return | return | ||||
} | } | ||||
signEggEnergyValue, _ := decimal.NewFromString(signEggEnergy) | |||||
signEggEnergyValue, _ := decimal.NewFromString(signPersonalEggEnergy) | |||||
personEggEnergyValue, _ := decimal.NewFromString(personEggEnergy.Amount) | personEggEnergyValue, _ := decimal.NewFromString(personEggEnergy.Amount) | ||||
teamEggEnergyValue, _ := decimal.NewFromString(teamEggEnergy.Amount) | teamEggEnergyValue, _ := decimal.NewFromString(teamEggEnergy.Amount) | ||||
@@ -125,68 +124,8 @@ func HomePage(c *gin.Context) { | |||||
totalActivePoints = utils.StrToFloat64(personActivePoints.Amount) + utils.StrToFloat64(teamActivePoints.Amount) | totalActivePoints = utils.StrToFloat64(personActivePoints.Amount) + utils.StrToFloat64(teamActivePoints.Amount) | ||||
//5、计算当前基础速率、团队速率 | //5、计算当前基础速率、团队速率 | ||||
nowBasalRate := utils.StrToFloat64(signEggEnergy) * 60 * 60 //每小时基础速率 | |||||
var estimateLevel int | |||||
nowBasalRateValue := decimal.NewFromFloat(nowBasalRate) | |||||
for { | |||||
estimateLevel++ | |||||
rewardDecrementValue := utils.StrToFloat64(teamRewardSetting.RewardDecrementValue) / 100 | |||||
tmpRewardBase := decimal.NewFromFloat(math.Pow(rewardDecrementValue, float64(estimateLevel))) | |||||
tmpReward := nowBasalRateValue.Mul(tmpRewardBase) | |||||
rewardEndValue, _ := decimal.NewFromString(teamRewardSetting.RewardEndValue) | |||||
if !tmpReward.GreaterThanOrEqual(rewardEndValue) { | |||||
estimateLevel-- | |||||
break | |||||
} | |||||
if estimateLevel == 99 { | |||||
e.OutErr(c, e.ERR, "奖励结束值设置有误") | |||||
return | |||||
} | |||||
} | |||||
relateDb := implement.NewUserRelateDb(db.Db) | |||||
userRelates, err := relateDb.FindUserRelateByParentUid(user.Id, estimateLevel) | |||||
if err != nil { | |||||
e.OutErr(c, e.ERR, err.Error()) | |||||
return | |||||
} | |||||
var userRelatesUids []string | |||||
var userRelatesMap = map[int64]model.UserRelate{} | |||||
if userRelates != nil { | |||||
for _, userRelate := range *userRelates { | |||||
userRelatesUids = append(userRelatesUids, utils.Int64ToStr(userRelate.Uid)) | |||||
userRelatesMap[userRelate.Uid] = userRelate | |||||
} | |||||
} | |||||
var eggSignIns []*model.EggSignIn | |||||
if len(userRelatesUids) > 0 { | |||||
eggSignIns, err = signInDb.EggSignInFindByParams(map[string]interface{}{ | |||||
"key": "uid", | |||||
"value": userRelatesUids, | |||||
}) | |||||
if err != nil { | |||||
e.OutErr(c, e.ERR_DB_ORM, err.Error()) | |||||
return | |||||
} | |||||
} | |||||
var nowTeamRate float64 //每小时基础速率 | |||||
for _, vv := range eggSignIns { | |||||
rewardDecrementValue := utils.StrToFloat64(teamRewardSetting.RewardDecrementValue) / 100 | |||||
tmpRewardBase := decimal.NewFromFloat(math.Pow(rewardDecrementValue, float64(userRelatesMap[vv.Uid].Level))) | |||||
tmpReward := nowBasalRateValue.Mul(tmpRewardBase) | |||||
rewardEndValue, _ := decimal.NewFromString(teamRewardSetting.RewardEndValue) | |||||
if tmpReward.GreaterThanOrEqual(rewardEndValue) { | |||||
tmpRewardValue, _ := tmpReward.Float64() | |||||
nowTeamRate += tmpRewardValue | |||||
} | |||||
} | |||||
decimalRate := decimal.NewFromInt(100) //百分比 | |||||
risesValue, _ := decimal.NewFromFloat(rises).Mul(decimalRate).Float64() | |||||
var residueTimes = utils.TimeParseStd(signCountdown).Unix() - time.Now().Unix() | |||||
nowBasalRate := utils.StrToFloat64(signPersonalEggEnergy) * 60 * 60 //每小时基础速率 | |||||
NowTeamRate := utils.StrToFloat64(signTeamEggEnergy) * 60 * 60 // 每小时团队速率 | |||||
userDb := implement.NewUserDb(db.Db) | userDb := implement.NewUserDb(db.Db) | ||||
userCount, err := userDb.UserCount() | userCount, err := userDb.UserCount() | ||||
@@ -194,42 +133,42 @@ func HomePage(c *gin.Context) { | |||||
e.OutErr(c, e.ERR_DB_ORM, err.Error()) | e.OutErr(c, e.ERR_DB_ORM, err.Error()) | ||||
return | return | ||||
} | } | ||||
var residueTimes = utils.TimeParseStd(signCountdown).Unix() - time.Now().Unix() | |||||
utils.FilePutContents("HomePage", utils.SerializeStr(map[string]interface{}{ | utils.FilePutContents("HomePage", utils.SerializeStr(map[string]interface{}{ | ||||
"user_phone": user.Phone, | "user_phone": user.Phone, | ||||
"user_uid": user.Id, | "user_uid": user.Id, | ||||
"data": map[string]interface{}{ | "data": map[string]interface{}{ | ||||
"is_sign": isSign, | |||||
"sign_end_date": signCountdown, | |||||
"sign_end_timestamp": utils.TimeParseStd(signCountdown).Unix(), | |||||
"residue_times": residueTimes, | |||||
"total_egg_energy": totalEggEnergy, | |||||
"sign_reward_egg_energy": utils.StrToFloat64(signIn.EstimatePerSecondEggEnergyValue), | |||||
"total_active_points": totalActivePoints, | |||||
"egg_energy_now_price": nowPrice, | |||||
"initial_price": initialPrice, | |||||
"is_rises": isRise, | |||||
"rises": risesValue, | |||||
"now_basal_rate": nowBasalRate, | |||||
"now_team_rate": nowTeamRate, | |||||
"user_count": userCount, | |||||
"nickname": user.Nickname, | |||||
"is_sign": isSign, | |||||
"sign_end_date": signCountdown, | |||||
"sign_end_timestamp": utils.TimeParseStd(signCountdown).Unix(), | |||||
"residue_times": residueTimes, | |||||
"total_egg_energy": totalEggEnergy, | |||||
"total_active_points": totalActivePoints, | |||||
"egg_energy_now_price": nowPrice, | |||||
"initial_price": initialPrice, | |||||
"is_rises": isRise, | |||||
"rises": rises, | |||||
"now_basal_rate": nowBasalRate, | |||||
"now_team_rate": NowTeamRate, | |||||
"user_count": userCount, | |||||
"nickname": user.Nickname, | |||||
}, | }, | ||||
})) | })) | ||||
resp := md.HomePageResp{ | resp := md.HomePageResp{ | ||||
IsSign: isSign, | |||||
SignEndTime: signCountdown, | |||||
TotalEggEnergy: utils.Float64ToStr(totalEggEnergy), | |||||
SignRewardEggEnergy: signIn.EstimatePerSecondEggEnergyValue, | |||||
TotalActivePoints: utils.Float64ToStr(totalActivePoints), | |||||
EggEnergyNowPrice: nowPrice, | |||||
InitialPrice: initialPrice, | |||||
IsRises: isRise, | |||||
Rises: utils.Float64ToStr(risesValue), | |||||
NowBasalRate: utils.Float64ToStr(nowBasalRate), | |||||
NowTeamRate: utils.Float64ToStr(nowTeamRate), | |||||
UserCount: userCount, | |||||
NickName: user.Nickname, | |||||
IsSign: isSign, | |||||
SignEndTime: signCountdown, | |||||
TotalEggEnergy: utils.Float64ToStr(totalEggEnergy), | |||||
TotalActivePoints: utils.Float64ToStr(totalActivePoints), | |||||
EggEnergyNowPrice: nowPrice, | |||||
InitialPrice: initialPrice, | |||||
IsRises: isRise, | |||||
Rises: utils.Float64ToStr(rises), | |||||
NowBasalRate: utils.Float64ToStr(nowBasalRate), | |||||
NowTeamRate: utils.Float64ToStr(NowTeamRate), | |||||
UserCount: userCount, | |||||
NickName: user.Nickname, | |||||
} | } | ||||
e.OutSuc(c, resp, nil) | e.OutSuc(c, resp, nil) | ||||
@@ -84,13 +84,13 @@ type NineDimensionalSpaceResp struct { | |||||
} | } | ||||
type BasalRateResp struct { | type BasalRateResp struct { | ||||
ConsumedTime string `json:"consumed_time"` // 消耗时间 | |||||
ConsumedTime string `json:"consumed_time"` // 消耗时间/小时 | |||||
ConsumedEggEnergy string `json:"consumed_egg_energy"` // 收益蛋蛋能量 | ConsumedEggEnergy string `json:"consumed_egg_energy"` // 收益蛋蛋能量 | ||||
RemainingTime string `json:"remaining_time"` // 剩余时间 | |||||
RemainingTime string `json:"remaining_time"` // 剩余时间/小时 | |||||
RemainingEggEnergy string `json:"remaining_egg_energy"` // 剩余蛋蛋能量 | RemainingEggEnergy string `json:"remaining_egg_energy"` // 剩余蛋蛋能量 | ||||
BasalRate string `json:"basal_rate"` // 基础速率 | BasalRate string `json:"basal_rate"` // 基础速率 | ||||
ConsumedEggPoint string `json:"consumed_egg_point"` // 消耗蛋蛋积分 | ConsumedEggPoint string `json:"consumed_egg_point"` // 消耗蛋蛋积分 | ||||
EstimatedRevenue string `json:"estimated_revenue"` // 预估收益 | |||||
EstimatedRevenue string `json:"estimated_revenue"` // 预估收益蛋蛋能量 | |||||
SignCountdown string `json:"sign_countdown"` // 收益倒计时 | SignCountdown string `json:"sign_countdown"` // 收益倒计时 | ||||
} | } | ||||
@@ -1,19 +1,18 @@ | |||||
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"` // 总蛋蛋能量 | |||||
SignRewardEggEnergy string `json:"sign_reward_egg_energy"` // 签到奖励蛋蛋能量/秒 | |||||
TotalActivePoints string `json:"total_active_points"` // 总活跃积分 | |||||
EggEnergyNowPrice string `json:"egg_energy_now_price"` // 蛋蛋能量当前价格 | |||||
InitialPrice string `json:"initial_price"` // 蛋蛋能量初始价格 | |||||
IsRises bool `json:"is_rises"` // 是否涨价 | |||||
Rises string `json:"rises"` // 涨/跌价百分比 | |||||
NowBasalRate string `json:"now_basal_rate"` // 当前基础速率/小时 | |||||
NowTeamRate string `json:"now_team_rate"` // 当前团队速率/小时 | |||||
UserCount int64 `json:"user_count"` // 当前用户数量 | |||||
NickName string `json:"nick_name"` // 用户名称 | |||||
IsSign bool `json:"is_sign"` // 是否开始签到 | |||||
SignEndTime string `json:"sign_end_time"` // 签到截止时间 | |||||
TotalEggEnergy string `json:"total_egg_energy"` // 总蛋蛋能量 | |||||
TotalActivePoints string `json:"total_active_points"` // 总蛋蛋积分 | |||||
EggEnergyNowPrice string `json:"egg_energy_now_price"` // 蛋蛋能量当前价格 | |||||
InitialPrice string `json:"initial_price"` // 蛋蛋能量初始价格 | |||||
IsRises bool `json:"is_rises"` // 是否涨价 | |||||
Rises string `json:"rises"` // 涨/跌价百分比 | |||||
NowBasalRate string `json:"now_basal_rate"` // 当前基础速率/小时 | |||||
NowTeamRate string `json:"now_team_rate"` // 当前团队速率/小时 | |||||
UserCount int64 `json:"user_count"` // 当前用户数量 | |||||
NickName string `json:"nick_name"` // 用户名称 | |||||
} | } | ||||
type HomePageWatchAdRuleResp struct { | type HomePageWatchAdRuleResp struct { | ||||
@@ -1,5 +1,4 @@ | |||||
// Code generated by swaggo/swag. DO NOT EDIT. | |||||
// Package docs Code generated by swaggo/swag. DO NOT EDIT | |||||
package docs | package docs | ||||
import "github.com/swaggo/swag" | import "github.com/swaggo/swag" | ||||
@@ -556,9 +555,7 @@ const docTemplate = `{ | |||||
"name": "req", | "name": "req", | ||||
"in": "body", | "in": "body", | ||||
"required": true, | "required": true, | ||||
"schema": { | |||||
"type": "object" | |||||
} | |||||
"schema": {} | |||||
} | } | ||||
], | ], | ||||
"responses": { | "responses": { | ||||
@@ -733,11 +730,11 @@ const docTemplate = `{ | |||||
"type": "string" | "type": "string" | ||||
}, | }, | ||||
"consumed_time": { | "consumed_time": { | ||||
"description": "消耗时间", | |||||
"description": "消耗时间/小时", | |||||
"type": "string" | "type": "string" | ||||
}, | }, | ||||
"estimated_revenue": { | "estimated_revenue": { | ||||
"description": "预估收益", | |||||
"description": "预估收益蛋蛋能量", | |||||
"type": "string" | "type": "string" | ||||
}, | }, | ||||
"remaining_egg_energy": { | "remaining_egg_energy": { | ||||
@@ -745,7 +742,7 @@ const docTemplate = `{ | |||||
"type": "string" | "type": "string" | ||||
}, | }, | ||||
"remaining_time": { | "remaining_time": { | ||||
"description": "剩余时间", | |||||
"description": "剩余时间/小时", | |||||
"type": "string" | "type": "string" | ||||
}, | }, | ||||
"sign_countdown": { | "sign_countdown": { | ||||
@@ -922,7 +919,7 @@ const docTemplate = `{ | |||||
"type": "boolean" | "type": "boolean" | ||||
}, | }, | ||||
"is_sign": { | "is_sign": { | ||||
"description": "是否完成签到", | |||||
"description": "是否开始签到", | |||||
"type": "boolean" | "type": "boolean" | ||||
}, | }, | ||||
"nick_name": { | "nick_name": { | ||||
@@ -945,12 +942,8 @@ const docTemplate = `{ | |||||
"description": "签到截止时间", | "description": "签到截止时间", | ||||
"type": "string" | "type": "string" | ||||
}, | }, | ||||
"sign_reward_egg_energy": { | |||||
"description": "签到奖励蛋蛋能量/秒", | |||||
"type": "string" | |||||
}, | |||||
"total_active_points": { | "total_active_points": { | ||||
"description": "总活跃积分", | |||||
"description": "总蛋蛋积分", | |||||
"type": "string" | "type": "string" | ||||
}, | }, | ||||
"total_egg_energy": { | "total_egg_energy": { | ||||
@@ -1311,6 +1304,8 @@ var SwaggerInfo = &swag.Spec{ | |||||
Description: "APP客户端-Api接口", | Description: "APP客户端-Api接口", | ||||
InfoInstanceName: "swagger", | InfoInstanceName: "swagger", | ||||
SwaggerTemplate: docTemplate, | SwaggerTemplate: docTemplate, | ||||
LeftDelim: "{{", | |||||
RightDelim: "}}", | |||||
} | } | ||||
func init() { | func init() { | ||||
@@ -549,9 +549,7 @@ | |||||
"name": "req", | "name": "req", | ||||
"in": "body", | "in": "body", | ||||
"required": true, | "required": true, | ||||
"schema": { | |||||
"type": "object" | |||||
} | |||||
"schema": {} | |||||
} | } | ||||
], | ], | ||||
"responses": { | "responses": { | ||||
@@ -726,11 +724,11 @@ | |||||
"type": "string" | "type": "string" | ||||
}, | }, | ||||
"consumed_time": { | "consumed_time": { | ||||
"description": "消耗时间", | |||||
"description": "消耗时间/小时", | |||||
"type": "string" | "type": "string" | ||||
}, | }, | ||||
"estimated_revenue": { | "estimated_revenue": { | ||||
"description": "预估收益", | |||||
"description": "预估收益蛋蛋能量", | |||||
"type": "string" | "type": "string" | ||||
}, | }, | ||||
"remaining_egg_energy": { | "remaining_egg_energy": { | ||||
@@ -738,7 +736,7 @@ | |||||
"type": "string" | "type": "string" | ||||
}, | }, | ||||
"remaining_time": { | "remaining_time": { | ||||
"description": "剩余时间", | |||||
"description": "剩余时间/小时", | |||||
"type": "string" | "type": "string" | ||||
}, | }, | ||||
"sign_countdown": { | "sign_countdown": { | ||||
@@ -915,7 +913,7 @@ | |||||
"type": "boolean" | "type": "boolean" | ||||
}, | }, | ||||
"is_sign": { | "is_sign": { | ||||
"description": "是否完成签到", | |||||
"description": "是否开始签到", | |||||
"type": "boolean" | "type": "boolean" | ||||
}, | }, | ||||
"nick_name": { | "nick_name": { | ||||
@@ -938,12 +936,8 @@ | |||||
"description": "签到截止时间", | "description": "签到截止时间", | ||||
"type": "string" | "type": "string" | ||||
}, | }, | ||||
"sign_reward_egg_energy": { | |||||
"description": "签到奖励蛋蛋能量/秒", | |||||
"type": "string" | |||||
}, | |||||
"total_active_points": { | "total_active_points": { | ||||
"description": "总活跃积分", | |||||
"description": "总蛋蛋积分", | |||||
"type": "string" | "type": "string" | ||||
}, | }, | ||||
"total_egg_energy": { | "total_egg_energy": { | ||||
@@ -24,16 +24,16 @@ definitions: | |||||
description: 消耗蛋蛋积分 | description: 消耗蛋蛋积分 | ||||
type: string | type: string | ||||
consumed_time: | consumed_time: | ||||
description: 消耗时间 | |||||
description: 消耗时间/小时 | |||||
type: string | type: string | ||||
estimated_revenue: | estimated_revenue: | ||||
description: 预估收益 | |||||
description: 预估收益蛋蛋能量 | |||||
type: string | type: string | ||||
remaining_egg_energy: | remaining_egg_energy: | ||||
description: 剩余蛋蛋能量 | description: 剩余蛋蛋能量 | ||||
type: string | type: string | ||||
remaining_time: | remaining_time: | ||||
description: 剩余时间 | |||||
description: 剩余时间/小时 | |||||
type: string | type: string | ||||
sign_countdown: | sign_countdown: | ||||
description: 收益倒计时 | description: 收益倒计时 | ||||
@@ -153,7 +153,7 @@ definitions: | |||||
description: 是否涨价 | description: 是否涨价 | ||||
type: boolean | type: boolean | ||||
is_sign: | is_sign: | ||||
description: 是否完成签到 | |||||
description: 是否开始签到 | |||||
type: boolean | type: boolean | ||||
nick_name: | nick_name: | ||||
description: 用户名称 | description: 用户名称 | ||||
@@ -170,11 +170,8 @@ definitions: | |||||
sign_end_time: | sign_end_time: | ||||
description: 签到截止时间 | description: 签到截止时间 | ||||
type: string | type: string | ||||
sign_reward_egg_energy: | |||||
description: 签到奖励蛋蛋能量/秒 | |||||
type: string | |||||
total_active_points: | total_active_points: | ||||
description: 总活跃积分 | |||||
description: 总蛋蛋积分 | |||||
type: string | type: string | ||||
total_egg_energy: | total_egg_energy: | ||||
description: 总蛋蛋能量 | description: 总蛋蛋能量 | ||||
@@ -772,8 +769,7 @@ paths: | |||||
in: body | in: body | ||||
name: req | name: req | ||||
required: true | required: true | ||||
schema: | |||||
type: object | |||||
schema: {} | |||||
produces: | produces: | ||||
- application/json | - application/json | ||||
responses: | responses: | ||||
@@ -32,7 +32,7 @@ require ( | |||||
) | ) | ||||
require ( | require ( | ||||
code.fnuoos.com/EggPlanet/egg_models.git v0.2.1-0.20241121103041-c8eab82bd33d | |||||
code.fnuoos.com/EggPlanet/egg_models.git v0.2.1-0.20241122012509-ceb61ba8203c | |||||
code.fnuoos.com/EggPlanet/egg_system_rules.git v0.0.4-0.20241122005808-60ab25ac1d22 | code.fnuoos.com/EggPlanet/egg_system_rules.git v0.0.4-0.20241122005808-60ab25ac1d22 | ||||
code.fnuoos.com/go_rely_warehouse/zyos_go_es.git v1.0.1-0.20241118083738-0f22da9ba0be | code.fnuoos.com/go_rely_warehouse/zyos_go_es.git v1.0.1-0.20241118083738-0f22da9ba0be | ||||
code.fnuoos.com/go_rely_warehouse/zyos_go_mq.git v0.0.5 | code.fnuoos.com/go_rely_warehouse/zyos_go_mq.git v0.0.5 | ||||