2026-01-19 18:51:56 +08:00
|
|
|
|
/*
|
|
|
|
|
|
* @Author: 昔念 12574910+72wo@users.noreply.github.com
|
|
|
|
|
|
* @Date: 2025-12-31 02:42:41
|
|
|
|
|
|
* @LastEditors: 昔念 12574910+72wo@users.noreply.github.com
|
|
|
|
|
|
* @LastEditTime: 2026-01-18 11:37:05
|
|
|
|
|
|
* @FilePath: \sun\modules\config\model\task.go
|
|
|
|
|
|
* @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
|
|
|
|
|
|
*/
|
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 {
|
|
|
|
|
|
*cool.Model
|
|
|
|
|
|
|
|
|
|
|
|
// 核心字段
|
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-01-01 15:37:43 +08:00
|
|
|
|
// type(任务类型,0为常规任务,1为日常任务),
|
|
|
|
|
|
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
|
|
|
|
|
|
|
|
|
|
// 奖励配置
|
|
|
|
|
|
ItemRewardIds []uint32 `gorm:"not null;type:json;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"`
|
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
|
|
|
|
// 任务状态和周期
|
|
|
|
|
|
IsEnabled uint32 `gorm:"not null;default:1;comment:'是否启用该任务(0-禁用 1-启用)'" json:"is_enabled" description:"是否启用"`
|
|
|
|
|
|
|
|
|
|
|
|
Remark string `gorm:"size:512;default:'';comment:'任务备注'" json:"remark" description:"备注信息"`
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// -------------------------- 核心配套方法(遵循项目规范)--------------------------
|
|
|
|
|
|
func (*TaskConfig) TableName() string {
|
|
|
|
|
|
return TableNameTaskConfig
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
func (*TaskConfig) GroupName() string {
|
|
|
|
|
|
return "default"
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
func NewTaskConfig() *TaskConfig {
|
|
|
|
|
|
return &TaskConfig{
|
|
|
|
|
|
Model: cool.NewModel(),
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// -------------------------- 表结构自动同步 --------------------------
|
|
|
|
|
|
func init() {
|
|
|
|
|
|
cool.CreateTable(&TaskConfig{})
|
|
|
|
|
|
}
|