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

41 lines
932 B
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 还需要做一个记录任务奖励的表
const TableNameTask = "player_task"
2025-08-27 20:52:15 +00:00
// Task mapped from table <task>
type Task struct {
*cool.Model
2026-02-14 03:05:51 +08:00
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 []uint32 `struc:"[20]byte" gorm:"type:jsonb;not null;default:'[]';comment:'全部数据'" json:"data"`
2025-08-27 20:52:15 +00:00
}
// TaskEX 单个任务的详细信息,包含任务步骤状态和整体状态
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"
}
// NewPlayerInfo create a new PlayerInfo
func NewTask() *Task {
return &Task{
Model: cool.NewModel(),
2025-08-27 20:52:15 +00:00
}
}
// init 创建表
func init() {
cool.CreateTable(&Task{})
}