在玩家断开连接时,使用 sync.Once 确保只保存一次玩家数据, 防止因并发或多次触发导致的数据异常。 feat(fight): 增加战斗资格判断与邀请取消功能 - 新增 Player.CanFight() 方法用于统一判断是否可以参与战斗 - 在多个战斗相关接口中加入 CanFight 检查 - 添加“取消战斗邀请”指令及处理逻辑(cmd: 2402) - 修复部分错误码不准确的问题,提升提示一致性 refactor(login): 优化登录流程并增强健壮性 - 提前校验 session 合法性 - 增强获取玩家信息后的空指针检查 - 调整挖矿数据重置方式为 defer 执行 - 优化日志输出内容,便于调试追踪 docs(model): 更新部门、菜单等模型字段命名规范 将 orderNum 字段改为 ordernum,保持数据库列名风格一致, 同时更新了 base_sys_role 中 userId 为 userid。 perf(rate-limit): 提高登录接口的限流 Burst 容量 调整限流器配置,将请求 burst 容量从 2 提升至 5, 以应对短时间高频访问场景,改善用户体验。 chore(build): 忽略新增编译产物和临时文件 在 .gitignore 中添加 logic/logic2、login/login 等新生成文件路径, 避免误提交二进制文件到版本控制。
40 lines
985 B
Go
40 lines
985 B
Go
package model
|
|
|
|
import (
|
|
"blazing/cool"
|
|
)
|
|
|
|
const TableNameDictInfo = "dict_info"
|
|
|
|
// DictInfo mapped from table <dict_info>
|
|
type DictInfo struct {
|
|
*cool.Model
|
|
TypeID int32 `gorm:"column:typeId;type:int;not null" json:"typeId"` // 类型ID
|
|
Name string `gorm:"column:name;type:varchar(255);not null" json:"name"` // 名称
|
|
ordernum int32 `gorm:"column:ordernum;type:int;not null" json:"ordernum"` // 排序
|
|
Remark *string `gorm:"column:remark;type:varchar(255)" json:"remark"` // 备注
|
|
ParentID *int32 `gorm:"column:parentId;type:int" json:"parentId"` // 父ID
|
|
}
|
|
|
|
// TableName DictInfo's table name
|
|
func (*DictInfo) TableName() string {
|
|
return TableNameDictInfo
|
|
}
|
|
|
|
// GroupName DictInfo's table group
|
|
func (*DictInfo) GroupName() string {
|
|
return "default"
|
|
}
|
|
|
|
// NewDictInfo create a new DictInfo
|
|
func NewDictInfo() *DictInfo {
|
|
return &DictInfo{
|
|
Model: cool.NewModel(),
|
|
}
|
|
}
|
|
|
|
// init 创建表
|
|
func init() {
|
|
cool.CreateTable(&DictInfo{})
|
|
}
|