From 4ea3ae4bc6332c2e623055834440c513ee5a0cb8 Mon Sep 17 00:00:00 2001 From: mofangmin Date: Fri, 12 Jul 2024 17:41:10 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BB=BB=E5=8A=A1=E7=8A=B6=E6=80=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- common/task.go | 3 ++- modules/web/app/activity.go | 2 +- modules/web/handler/task.go | 2 +- 3 files changed, 4 insertions(+), 3 deletions(-) diff --git a/common/task.go b/common/task.go index ae045b5..24f7550 100644 --- a/common/task.go +++ b/common/task.go @@ -48,6 +48,7 @@ const ( TaskKindZero = iota TaskKindOnce TaskKindCycle + TaskKindDayOne TaskKindAll ) @@ -60,7 +61,7 @@ type ConfigTask struct { Target int64 `gorm:"column:target;type:bigint(20);default:0;comment:任务目标" web:"target"` Reward int64 `gorm:"column:reward;type:bigint(20);default:0;comment:奖励" web:"reward"` Open int `gorm:"column:open;type:int(11);default:1;comment:开关 1打开" web:"open"` - Kind int `gorm:"column:kind;type:int(11);default:1;comment:1单次 2循环" web:"kind"` + Kind int `gorm:"column:kind;type:int(11);default:1;comment:1单次 2循环 3 每日一次" web:"kind"` Type TaskType `gorm:"column:type;type:int(11);default:1;comment:1注册 2下载" web:"type"` Title string `gorm:"column:title;type:varchar(256);default:'';comment:标题" web:"title"` Icon string `gorm:"column:icon;type:varchar(256);default:'';comment:图标" web:"icon"` diff --git a/modules/web/app/activity.go b/modules/web/app/activity.go index 079afa6..a470277 100644 --- a/modules/web/app/activity.go +++ b/modules/web/app/activity.go @@ -60,7 +60,7 @@ func (a *Gin) GetUserTaskStatus() (ret []*values.OneTask) { v.Progess = k.Progress taskTime := time.Unix(k.Time, 0) // 跨天清空数据 - if !util.IsSameDay(now, taskTime) && v.Kind == 2 { + if !util.IsSameDay(now, taskTime) && v.Kind == common.TaskKindDayOne { v.Status = 0 v.Progess = 0 err := db.Mysql().Update(&k, map[string]interface{}{ diff --git a/modules/web/handler/task.go b/modules/web/handler/task.go index e057d7c..4697c32 100644 --- a/modules/web/handler/task.go +++ b/modules/web/handler/task.go @@ -60,7 +60,7 @@ func DrawTask(c *gin.Context) { // } var rows int64 var err error - if con.Kind == common.TaskKindOnce { + if con.Kind == common.TaskKindOnce || con.Kind == common.TaskKindDayOne { rows, err = db.Mysql().UpdateRes(&common.TaskData{UID: a.UID, TaskID: req.TaskID, Progress: task.Progress}, map[string]interface{}{"progress": -1}) } else if con.Kind == common.TaskKindCycle { rows, err = db.Mysql().UpdateRes(&common.TaskData{UID: a.UID, TaskID: req.TaskID, Progress: task.Progress}, map[string]interface{}{"progress": 0})