Browse Source

查签到记录调整

master
huangjiajun 2 weeks ago
parent
commit
65ba633453
2 changed files with 8 additions and 33 deletions
  1. +2
    -20
      app/hdl/hdl_add_friend.go
  2. +6
    -13
      app/hdl/hdl_home_page.go

+ 2
- 20
app/hdl/hdl_add_friend.go View File

@@ -493,27 +493,9 @@ func TotalRate(c *gin.Context) {
return
}
now := time.Now()
//开始时间 以当前时间 往前推多少
//1、查找 `egg_energy_basic_setting` 基础设置
eggEnergyBasicSettingDb := implement.NewEggEnergyBasicSettingDb(db.Db)
eggEnergyBasicSetting, err := eggEnergyBasicSettingDb.EggEnergyBasicSettingGetOneByParams(map[string]interface{}{
"key": "is_open",
"value": 1,
})
if err != nil {
e.OutErr(c, e.ERR_DB_ORM, err.Error())
return
}
var videoRewardSystem *md2.VideoRewardSystemStruct
err = json.Unmarshal([]byte(eggEnergyBasicSetting.VideoRewardSystem), &videoRewardSystem)
if err != nil {
e.OutErr(c, e.ERR_DB_ORM, err.Error())
return
}
var oneRoundDuration = utils.StrToInt(videoRewardSystem.EachRoundHour)
startTime := now.Add(-time.Hour * time.Duration(oneRoundDuration)).Format("2006-01-02 15:04:05")
signInDb := implement.NewEggSignInDb(db.Db)
exit, signIn, err := signInDb.EggSignINGetOneByTimeAndUid(startTime, "", user.Id, 0)
nowStr := now.Format("2006-01-02 15:04:05")
exit, signIn, err := signInDb.EggSignINGetOneByTimeAndUid("", nowStr, user.Id, 0)
if err != nil {
e.OutErr(c, e.ERR_DB_ORM, err.Error())
return


+ 6
- 13
app/hdl/hdl_home_page.go View File

@@ -64,17 +64,10 @@ func HomePage(c *gin.Context) {
var signPersonalEggEnergy = "0.00"
var signTeamEggEnergy = "0.00"
var totalEggEnergy float64
//开始时间 以当前时间 往前推多少
var videoRewardSystem *md2.VideoRewardSystemStruct
err = json.Unmarshal([]byte(eggEnergyBasicSetting.VideoRewardSystem), &videoRewardSystem)
if err != nil {
e.OutErr(c, e.ERR_DB_ORM, err.Error())
return
}
var oneRoundDuration = utils.StrToInt(videoRewardSystem.EachRoundHour)
startTime := now.Add(-time.Hour * time.Duration(oneRoundDuration)).Format("2006-01-02 15:04:05")

signInDb := implement.NewEggSignInDb(db.Db)
has, signIn, err := signInDb.EggSignINGetOneByTimeAndUid(startTime, "", user.Id, 0)
nowStr := now.Format("2006-01-02 15:04:05")
has, signIn, err := signInDb.EggSignINGetOneByTimeAndUid("", nowStr, user.Id, 0)
if err != nil {
e.OutErr(c, e.ERR_DB_ORM, err.Error())
return
@@ -246,10 +239,10 @@ func HomePageWatchAdRule(c *gin.Context) {
var roundRemainingSecs int64
now := time.Now()
//开始时间 以当前时间 往前推多少
var oneRoundDuration = utils.StrToInt(videoRewardSystem.EachRoundHour)
startTime := now.Add(-time.Hour * time.Duration(oneRoundDuration)).Format("2006-01-02 15:04:05")
signInDb := implement.NewEggSignInDb(db.Db)
has, signIn, err := signInDb.EggSignINGetOneByTimeAndUid(startTime, "", user.Id, 0)
nowStr := now.Format("2006-01-02 15:04:05")

has, signIn, err := signInDb.EggSignINGetOneByTimeAndUid("", nowStr, user.Id, 0)
if err != nil {
e.OutErr(c, e.ERR_DB_ORM, err.Error())
return


Loading…
Cancel
Save