Files
bl/modules/player/model/task.go
xinian b327398448
Some checks failed
ci/woodpecker/push/my-first-workflow Pipeline failed
refactor: 重构任务服务读写逻辑
2026-04-09 22:59:28 +08:00

41 lines
932 B
Go

package model
import (
"blazing/cool"
)
// todo 还需要做一个记录任务奖励的表
const TableNameTask = "player_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 []uint32 `struc:"[20]byte" gorm:"type:jsonb;not null;default:'[]';comment:'全部数据'" json:"data"`
}
// TaskEX 单个任务的详细信息,包含任务步骤状态和整体状态
// TableName PlayerInfo's table name
func (*Task) TableName() string {
return TableNameTask
}
// GroupName PlayerInfo's table group
func (*Task) GroupName() string {
return "default"
}
// NewPlayerInfo create a new PlayerInfo
func NewTask() *Task {
return &Task{
Model: cool.NewModel(),
}
}
// init 创建表
func init() {
cool.CreateTable(&Task{})
}