refactor(assets): 重构资产同步流程并添加宠物相关功能

- 移除了资产同步到私有 B 仓库的工作流
- 在玩家结构中添加了 IsFighting 字段
- 新增了宠物信息相关功能和数据结构
- 优化了地图进入和怪物刷新逻辑
- 调整了玩家登录和地图数据发送流程
- 重构了部分代码以提高可维护性和性能
This commit is contained in:
2025-08-24 17:33:19 +08:00
parent b6164f3b9e
commit 081f990110
23 changed files with 1214 additions and 420 deletions

View File

@@ -3,6 +3,12 @@ package service
import (
"blazing/cool"
"blazing/modules/blazing/model"
"strconv"
"time"
"github.com/gogf/gf/v2/database/gdb"
"github.com/gogf/gf/v2/frame/g"
"github.com/gogf/gf/v2/util/gconv"
)
type MonsterService struct {
@@ -22,9 +28,29 @@ func NewMonsterService() *MonsterService {
},
}
}
func (s *MonsterService) ModifyAfter(ctx g.Ctx, method string, param g.MapStrAny) (err error) {
gconv.String(param["map_id"])
cool.DBM(s.Model).Cache((gdb.CacheOption{
Duration: -1,
Name: model.TableNameMonsterRefresh + gconv.String(param["map_id"]),
Force: false,
}))
//todo 待测试,缓存优化
return nil
}
func (s *MonsterService) GetId(mapid uint32) uint32 {
m := cool.DBM(s.Model).Where("map_id", mapid)
//todo 待修改更新时候删除缓存
m := cool.DBM(s.Model).Where("map_id", mapid).Cache(
gdb.CacheOption{
Duration: time.Hour,
Name: model.TableNameMonsterRefresh + strconv.Itoa(int(mapid)),
Force: false,
},
)
var tt []model.MonsterRefresh
m.Scan(&tt)