```
refactor(common): 移除未使用的XML解析测试代码 移除test_test.go中未完成的Mapxml函数和login/main.go中的 XML解析注释代码,清理无用的导入包,优化代码结构 BREAKING CHANGE: 删除了modules/config/model/map_moster_node.go 文件中的MapPit相关模型定义 ```
This commit is contained in:
@@ -8,6 +8,7 @@ import (
|
||||
"testing"
|
||||
|
||||
"github.com/apcera/termtables"
|
||||
"github.com/gogf/gf/v2/os/gfile"
|
||||
"github.com/gogf/gf/v2/os/glog"
|
||||
)
|
||||
|
||||
@@ -37,6 +38,12 @@ type Map struct {
|
||||
Galaxy string `xml:"galaxy,attr" json:"galaxy,omitempty"`
|
||||
}
|
||||
|
||||
func Mapxml() {
|
||||
|
||||
superMaps := &SuperMaps{}
|
||||
err := xml.Unmarshal([]byte(gfile.GetBytes("public/config/地图配置野怪.xml")), superMaps)
|
||||
fmt.Println(err)
|
||||
}
|
||||
func TestXml(t *testing.T) {
|
||||
// 示例XML数据
|
||||
xmlData := `<?xml version="1.0" encoding="UTF-8"?>
|
||||
|
||||
8
help/查询超规精灵.sql
Normal file
8
help/查询超规精灵.sql
Normal file
@@ -0,0 +1,8 @@
|
||||
-- 所有宠物ID + 对应记录总数(去重前)
|
||||
SELECT
|
||||
(data->>'ID')::INT AS pet_id, -- 宠物ID
|
||||
COUNT(*) AS total_records -- 该宠物的总持有记录数
|
||||
FROM "player_pet"
|
||||
WHERE data->>'ID' IS NOT NULL -- 过滤无宠物ID的无效记录
|
||||
GROUP BY (data->>'ID')::INT
|
||||
ORDER BY total_records DESC, pet_id ASC; -- 按数量降序、ID升序排列
|
||||
@@ -28,7 +28,20 @@ func init() {
|
||||
}
|
||||
|
||||
func main() {
|
||||
// superMaps := &xmlres.MonsterRoot{}
|
||||
// err := xml.Unmarshal([]byte(gfile.GetBytes("public/config/地图配置野怪.xml")), superMaps)
|
||||
// for _, v := range superMaps.Maps {
|
||||
|
||||
// if v.Monsters != nil {
|
||||
// for _, v1 := range v.Monsters.Monsters {
|
||||
// fmt.Println(v.Name, v1.ID, "|", v1.Lv)
|
||||
|
||||
// }
|
||||
|
||||
// }
|
||||
|
||||
// }
|
||||
// fmt.Println(err)
|
||||
// err := service.RemoteExecuteScript(ip, sshPort, user, password, scriptPort)
|
||||
// if err != nil {
|
||||
// log.Fatal(err)
|
||||
|
||||
22
modules/config/controller/admin/mappit.go
Normal file
22
modules/config/controller/admin/mappit.go
Normal file
@@ -0,0 +1,22 @@
|
||||
package admin
|
||||
|
||||
import (
|
||||
"blazing/cool"
|
||||
"blazing/modules/config/service"
|
||||
)
|
||||
|
||||
type MapPitController struct {
|
||||
*cool.Controller
|
||||
}
|
||||
|
||||
func init() {
|
||||
|
||||
// 注册路由
|
||||
cool.RegisterController(&MapPitController{
|
||||
&cool.Controller{
|
||||
Prefix: "/admin/config/mappit",
|
||||
Api: []string{"Add", "Delete", "Update", "Info", "List", "Page"},
|
||||
Service: service.NewMapPitService(),
|
||||
},
|
||||
})
|
||||
}
|
||||
@@ -12,21 +12,23 @@ type Event struct {
|
||||
//携带精灵数组Event
|
||||
Sprites []int32 `gorm:"type:int[];comment:'携带精灵数组'" json:"sprites"`
|
||||
//触发开始时间Event
|
||||
StartTime int32 `gorm:"type:int;default:0;comment:'触发开始时间'" json:"start_time"`
|
||||
StartTime string `gorm:"type:varchar(100);default:'';comment:'触发开始时间'" json:"start_time"`
|
||||
//触发结束时间Event
|
||||
EndTime int32 `gorm:"type:int;default:0;comment:'触发结束时间'" json:"end_time"`
|
||||
EndTime string `gorm:"type:varchar(100);default:'';comment:'触发结束时间'" json:"end_time"`
|
||||
//触发天气Event
|
||||
Weather []int32 `gorm:"type:int[];comment:'触发天气'" json:"weather"`
|
||||
}
|
||||
|
||||
// MapPit 地图坑位核心配置模型(参照MonsterRefresh实现风格)
|
||||
type MapPit struct {
|
||||
*BaseConfig // 复用通用基础配置(ID/创建时间/更新时间等)
|
||||
MapID []int32 `gorm:"type:int[];comment:'绑定地图地图ID'" json:"map_id"`
|
||||
*cool.Model // 保留通用Model(ID/创建时间/更新时间等)
|
||||
|
||||
Remark string `gorm:"type:varchar(255);default:'';comment:'性别配置备注(如:默认性别规则)'" json:"remark"` // 调整注释 // 复用通用基础配置(ID/创建时间/更新时间等)
|
||||
MapID []int32 `gorm:"type:int[];comment:'绑定地图地图ID'" json:"map_id"`
|
||||
*Event
|
||||
PitName string `gorm:"type:varchar(100);default:'';comment:'坑位名称'" json:"pit_name"`
|
||||
|
||||
RefreshID []int `gorm:"type:int[];comment:'关联刷新规则ID列表'" json:"refresh_id"`
|
||||
RefreshID []int `gorm:"type:int[];comment:'精灵ID列表'" json:"refresh_id"`
|
||||
//最小等级
|
||||
MinLevel int `gorm:"type:int;default:0;comment:'最小等级'" json:"min_level"`
|
||||
//最大等级
|
||||
@@ -48,8 +50,8 @@ func (*MapPit) GroupName() string {
|
||||
// NewMapPit 创建一个新的MapPit实例(初始化通用BaseConfig)
|
||||
func NewMapPit() *MapPit {
|
||||
return &MapPit{
|
||||
BaseConfig: NewBaseConfig(),
|
||||
Event: &Event{},
|
||||
Model: cool.NewModel(),
|
||||
Event: &Event{},
|
||||
}
|
||||
}
|
||||
|
||||
21
modules/config/service/map_pit.go
Normal file
21
modules/config/service/map_pit.go
Normal file
@@ -0,0 +1,21 @@
|
||||
package service
|
||||
|
||||
import (
|
||||
"blazing/cool"
|
||||
"blazing/modules/config/model"
|
||||
)
|
||||
|
||||
type MapPitService struct {
|
||||
*cool.Service
|
||||
}
|
||||
|
||||
func NewMapPitService() *MapPitService {
|
||||
return &MapPitService{
|
||||
&cool.Service{
|
||||
Model: model.NewMapPit(),
|
||||
PageQueryOp: &cool.QueryOp{
|
||||
KeyWordField: []string{"remake"},
|
||||
},
|
||||
},
|
||||
}
|
||||
}
|
||||
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user