menu_controller.go
1.6 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
package web_client
import (
"gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/application/web/custommenu/command"
"gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/application/web/custommenu/query"
"gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/application/web/custommenu/service"
"gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/log"
)
type MenuController struct {
baseController
}
func (controller *MenuController) MenuList() {
menuService := service.NewMenuService(nil)
menuListQuery := &query.MenuListQuery{}
err := controller.Unmarshal(menuListQuery)
if err != nil {
log.Logger.Debug("json err:" + err.Error())
}
menuListQuery.Operator = controller.GetOperator()
data, err := menuService.MenuList(menuListQuery)
controller.Response(data, err)
}
func (controller *MenuController) MenuUpdate() {
menuService := service.NewMenuService(nil)
menuUpdateQuery := &command.MenuUpdateCommand{}
err := controller.Unmarshal(menuUpdateQuery)
if err != nil {
log.Logger.Debug("json err:" + err.Error())
}
menuUpdateQuery.Operator = controller.GetOperator()
data, err := menuService.MenuUpdate(menuUpdateQuery)
controller.Response(data, err)
}
func (controller *MenuController) MenuFavorite() {
menuService := service.NewMenuService(nil)
menuFavoriteCommand := &command.MenuFavoriteCommand{}
err := controller.Unmarshal(menuFavoriteCommand)
if err != nil {
log.Logger.Debug("json err:" + err.Error())
}
menuFavoriteCommand.Operator = controller.GetOperator()
data, err := menuService.MenuFavorite(menuFavoriteCommand)
controller.Response(data, err)
}