正在显示
4 个修改的文件
包含
70 行增加
和
10 行删除
pkg/domain/operator.go
0 → 100644
pkg/port/beego/controllers/baseController.go
0 → 100644
1 | +package controllers | ||
2 | + | ||
3 | +import ( | ||
4 | + "strconv" | ||
5 | + | ||
6 | + "github.com/linmadan/egglib-go/web/beego" | ||
7 | + "gitlab.fjmaimaimai.com/allied-creation/allied-creation-basic/pkg/domain" | ||
8 | +) | ||
9 | + | ||
10 | +type baseController struct { | ||
11 | + beego.BaseController | ||
12 | +} | ||
13 | + | ||
14 | +func (controller *baseController) GetUserId() int64 { | ||
15 | + str := controller.Ctx.Input.Header("userId") | ||
16 | + userId, _ := strconv.Atoi(str) | ||
17 | + return int64(userId) | ||
18 | +} | ||
19 | + | ||
20 | +func (controller *baseController) GetCompanyId() int64 { | ||
21 | + str := controller.Ctx.Input.Header("companyId") | ||
22 | + companyId, _ := strconv.Atoi(str) | ||
23 | + return int64(companyId) | ||
24 | +} | ||
25 | + | ||
26 | +func (controller *baseController) GetUserBaseId() int64 { | ||
27 | + str := controller.Ctx.Input.Header("userBaseId") | ||
28 | + userBaseId, _ := strconv.Atoi(str) | ||
29 | + return int64(userBaseId) | ||
30 | +} | ||
31 | + | ||
32 | +func (controller *baseController) GetOrgId() int64 { | ||
33 | + str := controller.Ctx.Input.Header("orgId") | ||
34 | + orgId, _ := strconv.Atoi(str) | ||
35 | + return int64(orgId) | ||
36 | +} | ||
37 | + | ||
38 | +func (controller *baseController) GetOperator() domain.Operator { | ||
39 | + return domain.Operator{ | ||
40 | + UserId: controller.GetUserId(), | ||
41 | + CompanyId: controller.GetCompanyId(), | ||
42 | + OrgId: controller.GetOrgId(), | ||
43 | + UserBaseId: controller.GetUserBaseId(), | ||
44 | + } | ||
45 | +} |
@@ -5,21 +5,13 @@ import ( | @@ -5,21 +5,13 @@ import ( | ||
5 | "gitlab.fjmaimaimai.com/allied-creation/allied-creation-basic/pkg/application/noticeSetting/command" | 5 | "gitlab.fjmaimaimai.com/allied-creation/allied-creation-basic/pkg/application/noticeSetting/command" |
6 | "gitlab.fjmaimaimai.com/allied-creation/allied-creation-basic/pkg/application/noticeSetting/query" | 6 | "gitlab.fjmaimaimai.com/allied-creation/allied-creation-basic/pkg/application/noticeSetting/query" |
7 | "gitlab.fjmaimaimai.com/allied-creation/allied-creation-basic/pkg/application/noticeSetting/service" | 7 | "gitlab.fjmaimaimai.com/allied-creation/allied-creation-basic/pkg/application/noticeSetting/service" |
8 | + "gitlab.fjmaimaimai.com/allied-creation/allied-creation-basic/pkg/domain" | ||
8 | ) | 9 | ) |
9 | 10 | ||
10 | type NoticeSettingController struct { | 11 | type NoticeSettingController struct { |
11 | beego.BaseController | 12 | beego.BaseController |
12 | } | 13 | } |
13 | 14 | ||
14 | -func (controller *NoticeSettingController) returnPageListData(count int64, data interface{}, err error, pageNumber int) { | ||
15 | - dataMap := map[string]interface{}{ | ||
16 | - "totalRow": count, | ||
17 | - "pageNumber": pageNumber, | ||
18 | - "list": data, | ||
19 | - } | ||
20 | - controller.Response(dataMap, err) | ||
21 | -} | ||
22 | - | ||
23 | func (controller *NoticeSettingController) UpdateNoticeSetting() { | 15 | func (controller *NoticeSettingController) UpdateNoticeSetting() { |
24 | noticeSettingService := service.NewNoticeSettingService(nil) | 16 | noticeSettingService := service.NewNoticeSettingService(nil) |
25 | updateNoticeSettingCommand := &command.UpdateNoticeSettingCommand{} | 17 | updateNoticeSettingCommand := &command.UpdateNoticeSettingCommand{} |
@@ -44,7 +36,11 @@ func (controller *NoticeSettingController) ListNoticeSetting() { | @@ -44,7 +36,11 @@ func (controller *NoticeSettingController) ListNoticeSetting() { | ||
44 | listNoticeSettingQuery := &query.ListNoticeSettingQuery{} | 36 | listNoticeSettingQuery := &query.ListNoticeSettingQuery{} |
45 | controller.Unmarshal(listNoticeSettingQuery) | 37 | controller.Unmarshal(listNoticeSettingQuery) |
46 | count, listdata, err := noticeSettingService.ListNoticeSetting(listNoticeSettingQuery) | 38 | count, listdata, err := noticeSettingService.ListNoticeSetting(listNoticeSettingQuery) |
47 | - controller.returnPageListData(count, listdata, err, listNoticeSettingQuery.PageIndex) | 39 | + data := map[string]interface{}{ |
40 | + "noticeSettings": listdata, | ||
41 | + "count": count, | ||
42 | + } | ||
43 | + controller.Response(data, err) | ||
48 | } | 44 | } |
49 | 45 | ||
50 | func (controller *NoticeSettingController) AddNoticeSetting() { | 46 | func (controller *NoticeSettingController) AddNoticeSetting() { |
@@ -54,3 +50,12 @@ func (controller *NoticeSettingController) AddNoticeSetting() { | @@ -54,3 +50,12 @@ func (controller *NoticeSettingController) AddNoticeSetting() { | ||
54 | data, err := noticeSettingService.AddNoticeSetting(addNoticeSettingCommand) | 50 | data, err := noticeSettingService.AddNoticeSetting(addNoticeSettingCommand) |
55 | controller.Response(data, err) | 51 | controller.Response(data, err) |
56 | } | 52 | } |
53 | + | ||
54 | +func (controller *NoticeSettingController) NoticeSettingProfile() { | ||
55 | + data := map[string]interface{}{ | ||
56 | + "module": domain.GetNoticeModuleList(), | ||
57 | + "moduleAction": domain.GetNoticeModuleActionList(), | ||
58 | + "paramList": domain.GetNoticeSettingParamList(""), | ||
59 | + } | ||
60 | + controller.Response(data, nil) | ||
61 | +} |
@@ -10,4 +10,5 @@ func init() { | @@ -10,4 +10,5 @@ func init() { | ||
10 | web.Router("/notice-setting/:settingId", &controllers.NoticeSettingController{}, "Get:GetNoticeSetting") | 10 | web.Router("/notice-setting/:settingId", &controllers.NoticeSettingController{}, "Get:GetNoticeSetting") |
11 | web.Router("/notice-setting/search", &controllers.NoticeSettingController{}, "POST:ListNoticeSetting") | 11 | web.Router("/notice-setting/search", &controllers.NoticeSettingController{}, "POST:ListNoticeSetting") |
12 | web.Router("/notice-setting", &controllers.NoticeSettingController{}, "Post:UpdateNoticeSetting") | 12 | web.Router("/notice-setting", &controllers.NoticeSettingController{}, "Post:UpdateNoticeSetting") |
13 | + web.Router("/notice-setting/profile/get", &controllers.NoticeSettingController{}, "Get:NoticeSettingProfile") | ||
13 | } | 14 | } |
-
请 注册 或 登录 后发表评论