102 lines
3.7 KiB
Go
102 lines
3.7 KiB
Go
package model
|
||
|
||
import (
|
||
"github.com/gogf/gf/v2/os/gtime"
|
||
)
|
||
|
||
type Task struct {
|
||
Id int64 `json:"id" orm:"id"`
|
||
TaskType uint `json:"taskType" orm:"task_type"`
|
||
Title string `json:"title" orm:"title"`
|
||
Description string `json:"description" orm:"description"`
|
||
RewardPoints uint `json:"rewardPoints" orm:"reward_points"`
|
||
Limit uint `json:"limit" orm:"limit"`
|
||
LimitType int `json:"limitType" orm:"limit_type"`
|
||
Status int `json:"status" orm:"status"`
|
||
StartTime *gtime.Time `json:"startTime" orm:"start_time"`
|
||
EndTime *gtime.Time `json:"endTime" orm:"end_time"`
|
||
CreatedAt *gtime.Time `json:"createdAt" orm:"created_at"`
|
||
UpdatedAt *gtime.Time `json:"updatedAt" orm:"updated_at"`
|
||
DeletedAt *gtime.Time `json:"deletedAt" orm:"deleted_at"`
|
||
}
|
||
|
||
type TaskListIn struct {
|
||
Page int
|
||
Size int
|
||
Title string // 可选,按标题模糊搜索
|
||
Status int // 可选,按状态筛选
|
||
}
|
||
type TaskListOut struct {
|
||
Total int
|
||
List []Task
|
||
}
|
||
|
||
type TaskAddIn struct {
|
||
TaskType uint
|
||
Title string
|
||
Description string
|
||
RewardPoints uint
|
||
Limit uint
|
||
LimitType int
|
||
Status int
|
||
StartTime *gtime.Time
|
||
EndTime *gtime.Time
|
||
}
|
||
type TaskEditIn struct {
|
||
Id int64
|
||
TaskType uint
|
||
Title string
|
||
Description string
|
||
RewardPoints uint
|
||
Limit uint
|
||
LimitType int
|
||
Status int
|
||
StartTime *gtime.Time
|
||
EndTime *gtime.Time
|
||
}
|
||
type TaskDelIn struct {
|
||
Id int64
|
||
}
|
||
type TaskCRUDOut struct {
|
||
Success bool
|
||
}
|
||
|
||
// App端任务列表项,包含用户完成情况
|
||
// CompletedCount: 用户已完成次数
|
||
// IsCompleted: 用户今日/周期内是否已完成
|
||
// LastActionTime: 最近一次完成时间
|
||
type TaskAppListItem struct {
|
||
Id int64 `json:"id" orm:"id" dc:"任务ID"`
|
||
TaskType uint `json:"taskType" orm:"task_type" dc:"任务类型:1=首次登录,2=广告,3=发布书籍"`
|
||
Title string `json:"title" orm:"title" dc:"任务标题"`
|
||
Description string `json:"description" orm:"description" dc:"任务描述"`
|
||
RewardPoints uint `json:"rewardPoints" orm:"reward_points" dc:"完成任务奖励的积分数"`
|
||
DailyLimit uint `json:"dailyLimit" orm:"daily_limit" dc:"每天可参与次数,NULL 表示不限"`
|
||
LimitType int `json:"limitType" orm:"limit_type" dc:"限制类型:1=不限,2=每日,3=每周,4=仅一次"`
|
||
Status int `json:"status" orm:"status" dc:"状态:1=启用,2=禁用"`
|
||
StartTime *gtime.Time `json:"startTime" orm:"start_time" dc:"任务开始时间"`
|
||
EndTime *gtime.Time `json:"endTime" orm:"end_time" dc:"任务结束时间"`
|
||
CompletedCount int `json:"completedCount" orm:"-" dc:"用户已完成次数"`
|
||
IsCompleted bool `json:"isCompleted" orm:"-" dc:"是否已完成"`
|
||
LastActionTime *gtime.Time `json:"lastActionTime" orm:"-" dc:"最近完成时间"`
|
||
}
|
||
|
||
type TaskAppListOut struct {
|
||
List []TaskAppListItem `json:"list"`
|
||
}
|
||
|
||
// App端任务列表查询参数
|
||
type TaskAppListIn struct {
|
||
UserId int64 `json:"userId" dc:"用户ID"`
|
||
}
|
||
|
||
// 简化的任务列表项,只包含任务类型和奖励积分
|
||
type TaskSimpleItem struct {
|
||
TaskType uint `json:"taskType" orm:"task_type" dc:"任务类型:1=首次登录,2=广告,3=发布书籍"`
|
||
RewardPoints uint `json:"rewardPoints" orm:"reward_points" dc:"完成任务奖励的积分数"`
|
||
}
|
||
|
||
type TaskSimpleListOut struct {
|
||
List []TaskSimpleItem `json:"list"`
|
||
}
|