```
feat(build): 更新构建脚本添加资源打包和proto编译 更新build.bat脚本,添加proto文件编译和资源打包功能,调整资源打包顺序。 BREAKING CHANGE: 构建流程发生变化,需要重新生成proto文件和打包资源。 --- refactor(xmlres): 使用gres替换gfile读取资源文件 将xmlres模块中文件读取方式从gfile.GetBytes改为gres.GetContent, 使
This commit is contained in:
22
modules/config/controller/admin/server.go
Normal file
22
modules/config/controller/admin/server.go
Normal file
@@ -0,0 +1,22 @@
|
||||
package admin
|
||||
|
||||
import (
|
||||
"blazing/cool"
|
||||
"blazing/modules/config/service"
|
||||
)
|
||||
|
||||
type ServerController struct {
|
||||
*cool.Controller
|
||||
}
|
||||
|
||||
func init() {
|
||||
|
||||
// 注册路由
|
||||
cool.RegisterController(&ServerController{
|
||||
&cool.Controller{
|
||||
Prefix: "/admin/config/server",
|
||||
Api: []string{"Add", "Delete", "Update", "Info", "List", "Page"},
|
||||
Service: service.NewServerService(),
|
||||
},
|
||||
})
|
||||
}
|
||||
@@ -25,7 +25,7 @@ type PetBaseConfig struct {
|
||||
|
||||
// ===================== 战斗核心属性(BossMon节点) =====================
|
||||
MonID int32 `gorm:"not null;comment:'BOSS对应的精灵ID'" json:"mon_id"`
|
||||
Nature uint32 `gorm:"not null;default:0;comment:'BOSS属性-性格'" json:"nature"`
|
||||
Nature int32 `gorm:"not null;default:0;comment:'BOSS属性-性格'" json:"nature"`
|
||||
Effect []uint32 `gorm:"type:jsonb;not null;default:'[]';comment:'BOSS特性'" json:"effect"`
|
||||
Lv int32 `gorm:"not null;comment:'BOSS等级(LvHpMatchUser非0时此配置无效)'" json:"lv"`
|
||||
Color string `gorm:"comment:'BOSS颜色'" json:"color"`
|
||||
|
||||
@@ -10,10 +10,17 @@ const TableNameServerList = "server_list"
|
||||
// ServerList mapped from table <server_list>
|
||||
type ServerList struct {
|
||||
*cool.Model
|
||||
OnlineID uint16 `gorm:"column:online_id;comment:'在线ID';uniqueIndex" json:"online_id"`
|
||||
//IP string `gorm:"type:varchar(16);comment:'服务器IP'" json:"ip"`
|
||||
Port uint16 `gorm:"comment:'端口号,通常是小整数'" json:"port"`
|
||||
//IsOpen bool `gorm:"default:true;not null;comment:'服务器是否开启,默认为开启状态'" json:"is_open"`
|
||||
OnlineID uint16 `gorm:"column:online_id;comment:'在线ID';uniqueIndex" json:"online_id"`
|
||||
IP string `gorm:"type:string;comment:'服务器IP'" json:"ip"`
|
||||
Port uint16 `gorm:"comment:'端口号,通常是小整数'" json:"port"`
|
||||
IsOpen bool `gorm:"default:true;not null;comment:'服务器是否开启,默认为开启状态'" json:"is_open"`
|
||||
CanPort []uint32 `gorm:"type:jsonb;comment:'可连接端口'" json:"can_port"`
|
||||
IsVip uint32 `gorm:"default:0;not null;comment:'是否为VIP服务器'" json:"is_vip"`
|
||||
//服务器异色概率设定ServerList
|
||||
ShinyRate uint8 `gorm:"default:0;comment:'异色概率'" json:"shiny_rate"`
|
||||
//服务器天气设定ServerList
|
||||
WeatherRate uint8 `gorm:"default:0;comment:'天气概率'" json:"weather_rate"`
|
||||
Desc string `gorm:"comment:'服务器描述'" json:"desc"`
|
||||
}
|
||||
|
||||
// TableName ServerList's table name
|
||||
|
||||
18
modules/config/service/server.go
Normal file
18
modules/config/service/server.go
Normal file
@@ -0,0 +1,18 @@
|
||||
package service
|
||||
|
||||
import (
|
||||
"blazing/cool"
|
||||
"blazing/modules/config/model"
|
||||
)
|
||||
|
||||
type ServerService struct {
|
||||
*cool.Service
|
||||
}
|
||||
|
||||
func NewServerService() *ServerService {
|
||||
return &ServerService{
|
||||
&cool.Service{
|
||||
Model: model.NewServerList(),
|
||||
},
|
||||
}
|
||||
}
|
||||
@@ -15,20 +15,38 @@ func NewTaskService() *TaskService {
|
||||
return &TaskService{
|
||||
&cool.Service{
|
||||
Model: model.NewTaskConfig(),
|
||||
PageQueryOp: &cool.QueryOp{
|
||||
FieldEQ: []string{"task_type"},
|
||||
},
|
||||
//UniqueKey: map[string]string{"task_id": "索引不能重复"},
|
||||
},
|
||||
}
|
||||
}
|
||||
func (s *TaskService) Get(id, os uint32) *model.TaskConfig {
|
||||
var item *model.TaskConfig
|
||||
cool.DBM(s.Model).Where("task_id", id).Where("out_state", os).
|
||||
var item []model.TaskConfig
|
||||
cool.DBM(s.Model).Where("task_id", id).
|
||||
Cache(gdb.CacheOption{
|
||||
// Duration: time.Hour,
|
||||
|
||||
Force: false,
|
||||
}).Scan(&item)
|
||||
var res *model.TaskConfig
|
||||
if len(item) == 1 { //只有一个直接默认
|
||||
res = &item[0]
|
||||
}
|
||||
if len(item) > 1 { //
|
||||
|
||||
return item
|
||||
for _, v := range item {
|
||||
if v.OutState == os {
|
||||
res = &item[os]
|
||||
return res
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
return res
|
||||
|
||||
}
|
||||
func (s *TaskService) GetDaily() []model.TaskConfig {
|
||||
|
||||
Reference in New Issue
Block a user