Files
bl/modules/blazing/model/task.go

56 lines
1.4 KiB
Go
Raw Normal View History

2025-08-27 20:52:15 +00:00
package model
import (
"blazing/cool"
)
2025-08-27 20:52:15 +00:00
// todo 还需要做一个记录任务奖励的表
2025-08-27 20:52:15 +00:00
const TableNameTask = "task"
// Task mapped from table <task>
type Task struct {
*cool.Model
PlayerID uint64 `gorm:"not null;index:idx_task_by_player_id;comment:'所属玩家ID'" json:"player_id"`
TaskID uint32 `gorm:"not null;comment:'任务ID'" json:"task_id"`
Data string `gorm:"type:jsonb;not null;comment:'全部数据'" json:"data"`
2025-08-27 20:52:15 +00:00
}
// TaskEX 单个任务的详细信息,包含任务步骤状态和整体状态
type TaskEX struct {
Task
Data []uint32 `struc:"[20]byte" orm:"data" json:"data"`
//LastResetTime time.Time `gorm:"not null;comment:'上次重置时间UTC'" json:"last_reset_time"` //这里是每天重置
2025-08-27 20:52:15 +00:00
// Status 任务整体状态0-未接受1-已接受2-已完成未领取3-已完成已领取
// json标签指定JSON字段名与业务状态说明保持一致
//Status byte `json:"status"`
2025-08-27 20:52:15 +00:00
}
// TableName PlayerInfo's table name
func (*Task) TableName() string {
return TableNameTask
2025-08-27 20:52:15 +00:00
}
// GroupName PlayerInfo's table group
func (*Task) GroupName() string {
return "default"
}
func (t *Task) GetData() string {
return t.Data
}
func (t *Task) SetData(t1 string) {
t.Data = t1
}
2025-08-27 20:52:15 +00:00
// NewPlayerInfo create a new PlayerInfo
func NewTask() *Task {
return &Task{
Model: cool.NewModel(),
}
}
// init 创建表
func init() {
cool.CreateTable(&Task{})
}