This commit is contained in:
@@ -14,7 +14,7 @@ func init() {
|
||||
// 注册路由
|
||||
cool.RegisterController(&PetRewardController{
|
||||
&cool.Controller{
|
||||
Prefix: "/admin/game/petreward",
|
||||
Prefix: "/admin/config/petreward",
|
||||
Api: []string{"Add", "Delete", "Update", "Info", "List", "Page"},
|
||||
Service: service.NewPetRewardService(),
|
||||
},
|
||||
|
||||
@@ -14,7 +14,7 @@ func init() {
|
||||
// 注册路由
|
||||
cool.RegisterController(&CdkController{
|
||||
&cool.Controller{
|
||||
Prefix: "/admin/game/cdk",
|
||||
Prefix: "/admin/config/cdk",
|
||||
Api: []string{"Add", "Delete", "Update", "Info", "List", "Page"},
|
||||
Service: service.NewCdkService(),
|
||||
},
|
||||
|
||||
@@ -14,7 +14,7 @@ func init() {
|
||||
// 注册路由
|
||||
cool.RegisterController(&ItemController{
|
||||
&cool.Controller{
|
||||
Prefix: "/admin/game/item",
|
||||
Prefix: "/admin/config/item",
|
||||
Api: []string{"Add", "Delete", "Update", "Info", "List", "Page"},
|
||||
Service: service.NewItemService(),
|
||||
},
|
||||
|
||||
22
modules/config/controller/admin/map.go
Normal file
22
modules/config/controller/admin/map.go
Normal file
@@ -0,0 +1,22 @@
|
||||
package admin
|
||||
|
||||
import (
|
||||
"blazing/cool"
|
||||
"blazing/modules/config/service"
|
||||
)
|
||||
|
||||
type MapController struct {
|
||||
*cool.Controller
|
||||
}
|
||||
|
||||
func init() {
|
||||
|
||||
// 注册路由
|
||||
cool.RegisterController(&MapController{
|
||||
&cool.Controller{
|
||||
Prefix: "/admin/config/map",
|
||||
Api: []string{"Add", "Delete", "Update", "Info", "List", "Page"},
|
||||
Service: service.NewMapService(),
|
||||
},
|
||||
})
|
||||
}
|
||||
@@ -14,7 +14,7 @@ func init() {
|
||||
// 注册路由
|
||||
cool.RegisterController(&ColorController{
|
||||
&cool.Controller{
|
||||
Prefix: "/admin/game/shiny",
|
||||
Prefix: "/admin/config/shiny",
|
||||
Api: []string{"Add", "Delete", "Update", "Info", "List", "Page"},
|
||||
Service: service.NewShinyService(),
|
||||
},
|
||||
|
||||
@@ -14,7 +14,7 @@ func init() {
|
||||
// 注册路由
|
||||
cool.RegisterController(&ShopController{
|
||||
&cool.Controller{
|
||||
Prefix: "/admin/game/shop",
|
||||
Prefix: "config/shop",
|
||||
Api: []string{"Add", "Delete", "Update", "Info", "List", "Page"},
|
||||
Service: service.NewShopService(),
|
||||
},
|
||||
|
||||
@@ -12,7 +12,7 @@ type TalkConfigController struct {
|
||||
func init() {
|
||||
var task_info_controller = &TalkConfigController{
|
||||
&cool.Controller{
|
||||
Prefix: "/admin/sun/talkconfig",
|
||||
Prefix: "/admin/config/talkconfig",
|
||||
Api: []string{"Add", "Delete", "Update", "Info", "List", "Page"},
|
||||
Service: service.NewTalkConfigService(),
|
||||
},
|
||||
|
||||
45
modules/config/model/map.go
Normal file
45
modules/config/model/map.go
Normal file
@@ -0,0 +1,45 @@
|
||||
package model
|
||||
|
||||
import (
|
||||
"blazing/cool"
|
||||
)
|
||||
|
||||
// 表名常量定义:地图配置表
|
||||
const (
|
||||
TableNameMapConfig = "config_map" // 地图配置表(记录地图ID、刷野怪开关、天气开关、掉落物配置等核心信息)
|
||||
)
|
||||
|
||||
// MapConfig 地图核心配置模型(包含地图基础属性、刷怪配置、天气配置、掉落物配置)
|
||||
type MapConfig struct {
|
||||
*BaseConfig
|
||||
|
||||
// 核心字段
|
||||
MapID uint32 `gorm:"not null;primaryKey;comment:'地图唯一ID(主键)'" json:"map_id" description:"地图ID"`
|
||||
|
||||
IsSpawnMonster int32 `gorm:"not null;default:0;comment:'是否开启刷怪(1:开启,0:关闭)'" json:"is_spawn_monster" description:"是否开启刷怪"`
|
||||
//`gorm:"type:int[];comment:'副宠物IDs(如:1,2,3)'" json:"sub_pet_ids"`
|
||||
WeatherType []uint32 `gorm:"type:int[];comment:'天气类型( 1-雨天,2-雪天)'" json:"weather_type"`
|
||||
|
||||
// 掉落物配置
|
||||
DropItemIds []uint32 `gorm:"type:int[];comment:'掉落物IDs" json:"drop_item_ids"`
|
||||
}
|
||||
|
||||
// -------------------------- 核心配套方法(遵循项目规范)--------------------------
|
||||
func (*MapConfig) TableName() string {
|
||||
return TableNameMapConfig
|
||||
}
|
||||
|
||||
func (*MapConfig) GroupName() string {
|
||||
return "default"
|
||||
}
|
||||
|
||||
func NewMapConfig() *MapConfig {
|
||||
return &MapConfig{
|
||||
BaseConfig: NewBaseConfig(),
|
||||
}
|
||||
}
|
||||
|
||||
// -------------------------- 表结构自动同步 --------------------------
|
||||
func init() {
|
||||
cool.CreateTable(&MapConfig{})
|
||||
}
|
||||
31
modules/config/service/map.go
Normal file
31
modules/config/service/map.go
Normal file
@@ -0,0 +1,31 @@
|
||||
package service
|
||||
|
||||
import (
|
||||
"blazing/cool"
|
||||
"blazing/modules/config/model"
|
||||
)
|
||||
|
||||
type MapService struct {
|
||||
*cool.Service
|
||||
}
|
||||
|
||||
func NewMapService() *MapService {
|
||||
return &MapService{
|
||||
&cool.Service{
|
||||
Model: model.NewMapConfig(),
|
||||
PageQueryOp: &cool.QueryOp{
|
||||
KeyWordField: []string{"remake"},
|
||||
},
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
func (s *MapService) GetData(p1 uint32) (ret *model.MapConfig) {
|
||||
//cacheKey := strings.Join([]string{fmt.Sprintf("%d", p1), fmt.Sprintf("%d", p2)}, ":")
|
||||
m := dbm_enable(s.Model)
|
||||
|
||||
m.Wheref(`male_pet_ids @> ARRAY[?]::integer[]`, p1).Scan(&ret)
|
||||
|
||||
return
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user