用户管理

This commit is contained in:
COOL 2023-04-16 23:02:47 +08:00
parent ed51e11426
commit 4b0e57f0f2
2 changed files with 21 additions and 9 deletions

View File

@ -289,6 +289,14 @@ INSERT INTO `base_sys_menu` VALUES (450, '2023-03-07 10:28:17.692000', '2023-03-
INSERT INTO `base_sys_menu` VALUES (451, '2023-03-07 10:28:44.322000', '2023-03-07 10:28:44.322000', 449, '编辑器', '/demo/editor', NULL, 1, 'icon-favor', 2, 'modules/demo/views/editor.vue', 1, 1);
INSERT INTO `base_sys_menu` VALUES (452, '2023-03-07 10:29:06.344000', '2023-03-07 10:29:06.344000', 449, '文件上传', '/demo/upload', NULL, 1, 'icon-favor', 3, 'modules/demo/views/upload.vue', 1, 1);
INSERT INTO `base_sys_menu` VALUES (453, '2023-03-15 10:38:43.677000', '2023-03-15 10:38:43.677000', 8, '编辑', NULL, 'base:sys:menu:info,base:sys:menu:update', 2, NULL, 0, NULL, 1, 1);
INSERT INTO `base_sys_menu` VALUES (454, '2023-04-16 21:59:16.442000', '2023-04-16 21:59:16.442000', NULL, '用户管理', NULL, NULL, 0, 'icon-user', 8, NULL, 1, 1);
INSERT INTO `base_sys_menu` VALUES (455, '2023-04-16 21:59:58.296000', '2023-04-16 21:59:58.296000', 454, '用户列表', '/user/list', NULL, 1, 'icon-menu', 1, 'modules/user/views/list.vue', 1, 1);
INSERT INTO `base_sys_menu` VALUES (456, '2023-04-16 21:59:58.525729', '2023-04-16 21:59:58.525729', 455, '删除', NULL, 'user:info:delete', 2, NULL, 0, NULL, 1, 1);
INSERT INTO `base_sys_menu` VALUES (457, '2023-04-16 21:59:58.525729', '2023-04-16 21:59:58.525729', 455, '修改', NULL, 'user:info:update,user:info:info', 2, NULL, 0, NULL, 1, 1);
INSERT INTO `base_sys_menu` VALUES (458, '2023-04-16 21:59:58.525729', '2023-04-16 21:59:58.525729', 455, '单个信息', NULL, 'user:info:info', 2, NULL, 0, NULL, 1, 1);
INSERT INTO `base_sys_menu` VALUES (459, '2023-04-16 21:59:58.525729', '2023-04-16 21:59:58.525729', 455, '列表查询', NULL, 'user:info:list', 2, NULL, 0, NULL, 1, 1);
INSERT INTO `base_sys_menu` VALUES (460, '2023-04-16 21:59:58.525729', '2023-04-16 21:59:58.525729', 455, '分页查询', NULL, 'user:info:page', 2, NULL, 0, NULL, 1, 1);
INSERT INTO `base_sys_menu` VALUES (461, '2023-04-16 21:59:58.525729', '2023-04-16 21:59:58.525729', 455, '新增', NULL, 'user:info:add', 2, NULL, 0, NULL, 1, 1);
COMMIT;
-- ----------------------------

View File

@ -1,5 +1,5 @@
import { Inject, Provide } from '@midwayjs/decorator';
import { BaseService } from '@cool-midway/core';
import { BaseService, CoolCommException } from '@cool-midway/core';
import { InjectEntityModel } from '@midwayjs/typeorm';
import { Repository } from 'typeorm';
import { UserInfoEntity } from '../entity/info';
@ -27,6 +27,7 @@ export class UserInfoService extends BaseService {
}
async updatePerson(id, param) {
try {
const info = await this.person(id);
// 修改了头像要重新处理
if (param.avatarUrl && info.avatarUrl != param.avatarUrl) {
@ -36,5 +37,8 @@ export class UserInfoService extends BaseService {
);
}
return await this.userInfoEntity.update({ id }, param);
} catch (err) {
throw new CoolCommException('更新失败,参数错误或者手机号已存在');
}
}
}