提交
This commit is contained in:
40
modules/dict/controller/admin/dict_info.go
Normal file
40
modules/dict/controller/admin/dict_info.go
Normal file
@@ -0,0 +1,40 @@
|
||||
package admin
|
||||
|
||||
import (
|
||||
"context"
|
||||
|
||||
"github.com/cool-team-official/cool-admin-go/cool"
|
||||
"github.com/cool-team-official/cool-admin-go/modules/dict/service"
|
||||
|
||||
"github.com/gogf/gf/v2/frame/g"
|
||||
)
|
||||
|
||||
type DictInfoController struct {
|
||||
*cool.Controller
|
||||
}
|
||||
|
||||
func init() {
|
||||
var dict_info_controller = &DictInfoController{
|
||||
&cool.Controller{
|
||||
Prefix: "/admin/dict/info",
|
||||
Api: []string{"Add", "Delete", "Update", "Info", "List", "Page"},
|
||||
Service: service.NewDictInfoService(),
|
||||
},
|
||||
}
|
||||
// 注册路由
|
||||
cool.RegisterController(dict_info_controller)
|
||||
}
|
||||
|
||||
// Data 方法请求
|
||||
type DictInfoDataReq struct {
|
||||
g.Meta `path:"/data" method:"POST"`
|
||||
Types []string `json:"types"`
|
||||
}
|
||||
|
||||
// Data 方法 获得字典数据
|
||||
func (c *DictInfoController) Data(ctx context.Context, req *DictInfoDataReq) (res *cool.BaseRes, err error) {
|
||||
service := service.NewDictInfoService()
|
||||
data, err := service.Data(ctx, req.Types)
|
||||
res = cool.Ok(data)
|
||||
return
|
||||
}
|
||||
22
modules/dict/controller/admin/dict_type.go
Normal file
22
modules/dict/controller/admin/dict_type.go
Normal file
@@ -0,0 +1,22 @@
|
||||
package admin
|
||||
|
||||
import (
|
||||
"github.com/cool-team-official/cool-admin-go/cool"
|
||||
"github.com/cool-team-official/cool-admin-go/modules/dict/service"
|
||||
)
|
||||
|
||||
type DictTypeController struct {
|
||||
*cool.Controller
|
||||
}
|
||||
|
||||
func init() {
|
||||
var dict_type_controller = &DictTypeController{
|
||||
&cool.Controller{
|
||||
Prefix: "/admin/dict/type",
|
||||
Api: []string{"Add", "Delete", "Update", "Info", "List", "Page"},
|
||||
Service: service.NewDictTypeService(),
|
||||
},
|
||||
}
|
||||
// 注册路由
|
||||
cool.RegisterController(dict_type_controller)
|
||||
}
|
||||
Reference in New Issue
Block a user