mirror of
https://github.com/cool-team-official/cool-admin-midway.git
synced 2024-11-01 22:20:30 +08:00
用户管理
This commit is contained in:
parent
ed51e11426
commit
4b0e57f0f2
@ -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;
|
||||
|
||||
-- ----------------------------
|
||||
|
@ -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,14 +27,18 @@ export class UserInfoService extends BaseService {
|
||||
}
|
||||
|
||||
async updatePerson(id, param) {
|
||||
const info = await this.person(id);
|
||||
// 修改了头像要重新处理
|
||||
if (param.avatarUrl && info.avatarUrl != param.avatarUrl) {
|
||||
param.avatarUrl = await this.file.downAndUpload(
|
||||
param.avatarUrl,
|
||||
uuid() + '.png'
|
||||
);
|
||||
try {
|
||||
const info = await this.person(id);
|
||||
// 修改了头像要重新处理
|
||||
if (param.avatarUrl && info.avatarUrl != param.avatarUrl) {
|
||||
param.avatarUrl = await this.file.downAndUpload(
|
||||
param.avatarUrl,
|
||||
uuid() + '.png'
|
||||
);
|
||||
}
|
||||
return await this.userInfoEntity.update({ id }, param);
|
||||
} catch (err) {
|
||||
throw new CoolCommException('更新失败,参数错误或者手机号已存在');
|
||||
}
|
||||
return await this.userInfoEntity.update({ id }, param);
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user