2025-12-31 02:44:14 +08:00
|
|
|
|
package model
|
|
|
|
|
|
|
|
|
|
|
|
import (
|
|
|
|
|
|
"blazing/cool"
|
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
|
|
// 表名常量定义:任务配置表
|
|
|
|
|
|
const (
|
2025-12-31 18:58:44 +08:00
|
|
|
|
TableNameTaskConfig = "config_task" // 任务配置表(记录任务ID、类型、目标、奖励、状态等核心信息)
|
2025-12-31 02:44:14 +08:00
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
|
|
// TaskConfig 任务核心配置模型
|
|
|
|
|
|
type TaskConfig struct {
|
2026-02-13 22:57:05 +08:00
|
|
|
|
*BaseConfig
|
2025-12-31 02:44:14 +08:00
|
|
|
|
|
|
|
|
|
|
// 核心字段
|
2025-12-31 21:00:29 +08:00
|
|
|
|
TaskId uint32 `gorm:"not null;comment:'任务唯一ID'" json:"task_id" description:"任务唯一ID"`
|
2026-01-19 18:51:56 +08:00
|
|
|
|
OutState int `gorm:"not null;default:0;comment:'任务分支'" json:"out_state" description:"任务分支"`
|
2025-12-31 21:00:29 +08:00
|
|
|
|
//父级任务
|
|
|
|
|
|
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为周任务),
|
2026-01-01 15:37:43 +08:00
|
|
|
|
TaskType uint32 `gorm:"not null;default:0;comment:'任务类型'" json:"task_type" description:"任务类型"`
|
2026-01-19 18:51:56 +08:00
|
|
|
|
//是否可以被接受TaskConfig
|
|
|
|
|
|
IsAcceptable uint32 `gorm:"not null;default:1;comment:'是否可以被接受'" json:"is_acceptable" description:"是否可以被接受"`
|
2025-12-31 02:44:14 +08:00
|
|
|
|
|
|
|
|
|
|
// 奖励配置
|
2026-01-20 22:08:36 +00:00
|
|
|
|
ItemRewardIds []uint32 `gorm:"not null;type:jsonb;default:'[]';comment:'绑定奖励物品ID数组,关联item_gift表主键'" json:"item_reward_ids" description:"奖励物品数组"`
|
2025-12-31 18:58:44 +08:00
|
|
|
|
ElfRewardIds uint32 `gorm:"not null;default:0;comment:'绑定奖励精灵ID,关联elf_gift表主键'" json:"elf_reward_ids" description:"绑定奖励精灵ID"`
|
2026-04-11 19:25:59 +08:00
|
|
|
|
RewardPetID uint32 `gorm:"not null;default:0;comment:'宠物相关奖励生效的目标精灵ID,0表示不对已有精灵发放'" json:"reward_pet_id" description:"目标精灵ID"`
|
|
|
|
|
|
TrainSkillIDs []uint32 `gorm:"not null;type:jsonb;default:'[]';comment:'任务奖励的特训技能ID数组'" json:"train_skill_ids" description:"特训技能奖励数组"`
|
|
|
|
|
|
SkinIDs []uint32 `gorm:"not null;type:jsonb;default:'[]';comment:'任务奖励的皮肤ID数组'" json:"skin_ids" description:"皮肤奖励数组"`
|
2025-12-31 02:44:14 +08:00
|
|
|
|
|
2026-01-17 00:47:41 +08:00
|
|
|
|
//绑定奖励
|
|
|
|
|
|
TitleRewardIds uint32 `gorm:"not null;default:0;comment:'绑定奖励称号'" json:"title_reward_ids" description:"绑定奖励称号"`
|
2025-12-31 02:44:14 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// -------------------------- 核心配套方法(遵循项目规范)--------------------------
|
|
|
|
|
|
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(),
|
2025-12-31 02:44:14 +08:00
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// -------------------------- 表结构自动同步 --------------------------
|
|
|
|
|
|
func init() {
|
|
|
|
|
|
cool.CreateTable(&TaskConfig{})
|
|
|
|
|
|
}
|