Files
bl/modules/config/model/task.go
昔念 08ebf849eb ```
feat(pet): 添加宠物收集功能和称号系统

- 实现了宠物收集任务状态查询功能
- 新增Collect方法处理宠物收集逻辑,包括类型验证和ID合法性检查
- 创建validTypeIDMap映射表统一管理合法的类型ID集合
- 重构任务状态判断逻辑,基于model.Completion状态进行判断

refactor(map): 统一玩家信息结构体

- 将OutInfo重命名为SimpleInfo并添加Title字段
- 更新EnterMap方法的返回类型为SimpleInfo
- 修改space包中的UserInfo映射类型为SimpleInfo

feat(task): 集成称号奖励到任务系统

- 在PlayerInfo结构体中添加Title字段
- 扩展TaskConfig模型支持称号奖励配置
- 更新用户信息服务处理用户名大小写转换

refactor(space): 优化空间服务数据结构

- 更新GetInfo方法返回SimpleInfo切片
- 调整UserInfo CsMap泛型类型参数
- 修改ListMapPlayerOutboundInfo中Player数组类型

style(login): 规范化用户名输入处理

- 登录时将用户名转换为小写进行比较
- 使用strings.EqualFold进行大小
2026-01-17 00:47:41 +08:00

55 lines
2.1 KiB
Go
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

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 uint32 `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:"任务类型"`
// 奖励配置
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{})
}