From 51e052d25d6820dcfc8ffc8fdb2ac05eb6b1bd5e Mon Sep 17 00:00:00 2001 From: truthhun <1272881215@qq.com> Date: Wed, 21 Jun 2023 16:13:42 +0800 Subject: [PATCH] =?UTF-8?q?=E6=83=A9=E5=A4=84=E6=9C=8D=E5=8A=A1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- model/data.go | 1 + service/serve/registerGRPCService.go | 9 ++ web/components/FormPunishment.vue | 162 +++++++++++++++++++ web/layouts/admin.vue | 5 + web/pages/admin/user/punishment.vue | 231 +++++++++++++++++++++++++++ web/utils/permission.js | 6 + 6 files changed, 414 insertions(+) create mode 100644 web/components/FormPunishment.vue create mode 100644 web/pages/admin/user/punishment.vue diff --git a/model/data.go b/model/data.go index 4329531..9df5080 100644 --- a/model/data.go +++ b/model/data.go @@ -68,6 +68,7 @@ func getPermissions() (permissions []Permission) { {Title: "更新头像", Description: "", Method: "POST", Path: "/api/v1/upload/avatar"}, {Title: "一键重转失败文档", Description: "", Method: "GRPC", Path: "/api.v1.DocumentAPI/SetDocumentReconvert"}, {Title: "批量修改文档分类", Description: "", Method: "GRPC", Path: "/api.v1.DocumentAPI/SetDocumentsCategory"}, + {Title: "惩罚管理", Description: "", Method: "GRPC", Path: "/api.v1.PunishmentAPI/ListPunishment"}, } return } diff --git a/service/serve/registerGRPCService.go b/service/serve/registerGRPCService.go index e5b6d2c..6bc1175 100644 --- a/service/serve/registerGRPCService.go +++ b/service/serve/registerGRPCService.go @@ -148,5 +148,14 @@ func RegisterGRPCService(dbModel *model.DBModel, logger *zap.Logger, endpoint st return } + // 惩罚服务 + punishmentAPIService := biz.NewPunishmentAPIService(dbModel, logger) + v1.RegisterPunishmentAPIServer(grpcServer, punishmentAPIService) + err = v1.RegisterPunishmentAPIHandlerFromEndpoint(context.Background(), gwmux, endpoint, dialOpts) + if err != nil { + logger.Error("RegisterPunishmentAPIHandlerFromEndpoint", zap.Error(err)) + return + } + return } diff --git a/web/components/FormPunishment.vue b/web/components/FormPunishment.vue new file mode 100644 index 0000000..62a6b8d --- /dev/null +++ b/web/components/FormPunishment.vue @@ -0,0 +1,162 @@ + + diff --git a/web/layouts/admin.vue b/web/layouts/admin.vue index 04c4ab7..51b6815 100644 --- a/web/layouts/admin.vue +++ b/web/layouts/admin.vue @@ -160,6 +160,11 @@ export default { title: '权限管理', icon: 'el-icon-circle-check', }, + { + page: '/admin/user/punishment', + title: '惩罚管理', + icon: 'el-icon-warning-outline', + }, ], }, { diff --git a/web/pages/admin/user/punishment.vue b/web/pages/admin/user/punishment.vue new file mode 100644 index 0000000..9902afb --- /dev/null +++ b/web/pages/admin/user/punishment.vue @@ -0,0 +1,231 @@ + + + + diff --git a/web/utils/permission.js b/web/utils/permission.js index abf40e6..b989f15 100644 --- a/web/utils/permission.js +++ b/web/utils/permission.js @@ -79,6 +79,12 @@ const cumstomPermissionMap = { children: [], pages: ['/admin/comment'], }, + 'api.v1.PunishmentAPI': { + label: '惩罚管理', + path: 'ListPunishment', + children: [], + pages: ['/admin/user/punishment'], + }, upload: { id: 0, label: '上传管理',