This commit is contained in:
20
modules/config/controller/admin/collect_plan.go
Normal file
20
modules/config/controller/admin/collect_plan.go
Normal file
@@ -0,0 +1,20 @@
|
||||
package admin
|
||||
|
||||
import (
|
||||
"blazing/cool"
|
||||
"blazing/modules/config/service"
|
||||
)
|
||||
|
||||
type CollectPlanController struct {
|
||||
*cool.Controller
|
||||
}
|
||||
|
||||
func init() {
|
||||
cool.RegisterController(&CollectPlanController{
|
||||
&cool.Controller{
|
||||
Prefix: "/admin/config/collectPlan",
|
||||
Api: []string{"Add", "Delete", "Update", "Info", "List", "Page"},
|
||||
Service: service.NewCollectPlanService(),
|
||||
},
|
||||
})
|
||||
}
|
||||
35
modules/config/model/collect_plan.go
Normal file
35
modules/config/model/collect_plan.go
Normal file
@@ -0,0 +1,35 @@
|
||||
package model
|
||||
|
||||
import "blazing/cool"
|
||||
|
||||
const (
|
||||
TableNameCollectPlanConfig = "config_collect_plan"
|
||||
)
|
||||
|
||||
// CollectPlanConfig 精灵收集计划配置。
|
||||
type CollectPlanConfig struct {
|
||||
*BaseConfig
|
||||
|
||||
Title string `gorm:"type:varchar(64);not null;default:'';comment:'计划标题'" json:"title" description:"计划标题"`
|
||||
Description string `gorm:"type:text;not null;default:'';comment:'计划描述'" json:"description" description:"计划描述"`
|
||||
RewardGroups []uint32 `gorm:"type:jsonb;not null;default:'[]';comment:'奖励精灵组'" json:"reward_groups" description:"奖励精灵组"`
|
||||
TargetGroups []uint32 `gorm:"type:jsonb;not null;default:'[]';comment:'目标精灵列表'" json:"target_groups" description:"目标精灵列表"`
|
||||
}
|
||||
|
||||
func (*CollectPlanConfig) TableName() string {
|
||||
return TableNameCollectPlanConfig
|
||||
}
|
||||
|
||||
func (*CollectPlanConfig) GroupName() string {
|
||||
return "default"
|
||||
}
|
||||
|
||||
func NewCollectPlanConfig() *CollectPlanConfig {
|
||||
return &CollectPlanConfig{
|
||||
BaseConfig: NewBaseConfig(),
|
||||
}
|
||||
}
|
||||
|
||||
func init() {
|
||||
cool.CreateTable(&CollectPlanConfig{})
|
||||
}
|
||||
36
modules/config/service/collect_plan.go
Normal file
36
modules/config/service/collect_plan.go
Normal file
@@ -0,0 +1,36 @@
|
||||
package service
|
||||
|
||||
import (
|
||||
"blazing/cool"
|
||||
"blazing/modules/config/model"
|
||||
|
||||
"github.com/gogf/gf/v2/frame/g"
|
||||
)
|
||||
|
||||
type CollectPlanService struct {
|
||||
*cool.Service
|
||||
}
|
||||
|
||||
func NewCollectPlanService() *CollectPlanService {
|
||||
return &CollectPlanService{
|
||||
&cool.Service{
|
||||
Model: model.NewCollectPlanConfig(),
|
||||
ListQueryOp: &cool.QueryOp{
|
||||
FieldEQ: []string{"is_enable", "id"},
|
||||
AddOrderby: map[string]string{
|
||||
"id": "asc",
|
||||
},
|
||||
},
|
||||
PageQueryOp: &cool.QueryOp{
|
||||
FieldEQ: []string{"is_enable", "id"},
|
||||
KeyWordField: []string{"title", "description", "remark"},
|
||||
AddOrderby: map[string]string{
|
||||
"id": "asc",
|
||||
},
|
||||
ModifyResult: func(ctx g.Ctx, data interface{}) interface{} {
|
||||
return data
|
||||
},
|
||||
},
|
||||
},
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user