feat(cache): 添加复合键缓存操作支持 添加了基于 uint32+string 组合键的缓存操作方法,包括 GetByCompoundKey、SetByCompoundKey、DelByCompoundKey 和 ContainsByCompoundKey 方法,用于处理用户ID和会话ID的组合缓存场景 fix(vscode): 添加 cSpell 配置支持 struc 词汇 refactor(session): 移除过时的会话管理方法 移除了基于单一字符串键的会话管理方法,因为已迁移到使用 复合键的缓存操作方式 ```
65 lines
2.6 KiB
Go
65 lines
2.6 KiB
Go
/*
|
||
* @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
|
||
*/
|
||
package model
|
||
|
||
import (
|
||
"blazing/cool"
|
||
)
|
||
|
||
// 表名常量定义:任务配置表
|
||
const (
|
||
TableNameTaskConfig = "config_task" // 任务配置表(记录任务ID、类型、目标、奖励、状态等核心信息)
|
||
)
|
||
|
||
// TaskConfig 任务核心配置模型
|
||
type TaskConfig struct {
|
||
*cool.Model
|
||
|
||
// 核心字段
|
||
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"`
|
||
// type(任务类型,0为常规任务,1为日常任务),
|
||
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:json;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:"绑定奖励称号"`
|
||
// 任务状态和周期
|
||
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{})
|
||
}
|