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

53 lines
2.0 KiB
Go
Raw Normal View History

package model
import (
"blazing/cool"
)
// 表名常量定义:任务配置表
const (
TableNameTaskConfig = "config_task" // 任务配置表记录任务ID、类型、目标、奖励、状态等核心信息
)
// TaskConfig 任务核心配置模型
type TaskConfig struct {
2026-02-13 22:57:05 +08:00
*BaseConfig
// 核心字段
TaskId uint32 `gorm:"not null;comment:'任务唯一ID'" json:"task_id" description:"任务唯一ID"`
OutState int `gorm:"not null;default:0;comment:'任务分支'" json:"out_state" description:"任务分支"`
//父级任务
ParentTaskId uint32 `gorm:"not null;default:0;comment:'父级任务ID'" json:"parent_task_id" description:"父级任务ID"`
2026-03-05 15:29:18 +08:00
// type(任务类型0为常规任务1为日常任务,2为周任务),
TaskType uint32 `gorm:"not null;default:0;comment:'任务类型'" json:"task_type" description:"任务类型"`
//是否可以被接受TaskConfig
IsAcceptable uint32 `gorm:"not null;default:1;comment:'是否可以被接受'" json:"is_acceptable" description:"是否可以被接受"`
// 奖励配置
ItemRewardIds []uint32 `gorm:"not null;type:jsonb;default:'[]';comment:'绑定奖励物品ID数组关联item_gift表主键'" json:"item_reward_ids" description:"奖励物品数组"`
ElfRewardIds uint32 `gorm:"not null;default:0;comment:'绑定奖励精灵ID关联elf_gift表主键'" json:"elf_reward_ids" description:"绑定奖励精灵ID"`
//绑定奖励
TitleRewardIds uint32 `gorm:"not null;default:0;comment:'绑定奖励称号'" json:"title_reward_ids" description:"绑定奖励称号"`
}
// -------------------------- 核心配套方法(遵循项目规范)--------------------------
func (*TaskConfig) TableName() string {
return TableNameTaskConfig
}
func (*TaskConfig) GroupName() string {
return "default"
}
func NewTaskConfig() *TaskConfig {
return &TaskConfig{
2026-02-13 22:57:05 +08:00
BaseConfig: NewBaseConfig(),
}
}
// -------------------------- 表结构自动同步 --------------------------
func init() {
cool.CreateTable(&TaskConfig{})
}