```
All checks were successful
ci/woodpecker/push/my-first-workflow Pipeline was successful

feat(config): 添加超时空地图配置和时间地图查询功能

新增IsTimeSpace字段用于标识地图是否为超时空地图,
添加TimeMap API接口支持查询超时空地图配置

perf(socket): 优化XORDecryptU解密函数减少内存分配

基于bytebufferpool实现缓冲区池化,大幅降低高频调用下的
内存分配和GC压力,提升性能表现

refactor(utils): 优化packVal序列化函数提升性能和稳定性

减少反射开销,
This commit is contained in:
昔念
2026-02-21 16:48:42 +08:00
parent b536f0974e
commit 31d9eb3f9e
6 changed files with 154 additions and 29 deletions

View File

@@ -3,6 +3,9 @@ package admin
import (
"blazing/cool"
"blazing/modules/config/service"
"context"
"github.com/gogf/gf/v2/frame/g"
)
type MapController struct {
@@ -20,3 +23,13 @@ func init() {
},
})
}
type TimeMapReq struct {
g.Meta `path:"/timemap" method:"POST"`
}
func (this *MapController) TimeMap(ctx context.Context, req *TimeMapReq) (res *cool.BaseRes, err error) {
res = &cool.BaseRes{}
res.Data = service.NewMapService().GetTimeMap()
return res, nil
}

View File

@@ -16,6 +16,8 @@ type MapConfig struct {
MapID uint32 `gorm:"not null;primaryKey;comment:'地图唯一ID主键'" json:"map_id" description:"地图ID"`
WeatherType []uint32 `gorm:"type:int[];comment:'天气类型( 1-雨天2-雪天)'" json:"weather_type"`
//是否超时空
IsTimeSpace int `gorm:"type:int;default:0;comment:'是否超时空'" json:"is_time_space"`
// 掉落物配置
DropItemIds []uint32 `gorm:"type:int[];comment:'掉落物IDs" json:"drop_item_ids"`

View File

@@ -29,3 +29,12 @@ func (s *MapService) GetData(p1 uint32) (ret *model.MapConfig) {
return
}
func (s *MapService) GetTimeMap() (ret []model.MapConfig) {
//cacheKey := strings.Join([]string{fmt.Sprintf("%d", p1), fmt.Sprintf("%d", p2)}, ":")
m := dbm_notenable(s.Model)
m.Where(`is_time_space`, 1).Scan(&ret)
return
}