mirror of
https://github.com/certd/certd.git
synced 2026-07-14 17:53:28 +08:00
chore: project detail join approve
This commit is contained in:
@@ -0,0 +1,60 @@
|
||||
import { Constants, isEnterprise } from '@certd/lib-server';
|
||||
import { Body, Controller, Inject, Post, Provide } from '@midwayjs/core';
|
||||
import { In } from 'typeorm';
|
||||
import { AuthService } from '../../../modules/sys/authority/service/auth-service.js';
|
||||
import { UserService } from '../../../modules/sys/authority/service/user-service.js';
|
||||
import { BasicController } from '../../basic/code-controller.js';
|
||||
|
||||
/**
|
||||
* 通知
|
||||
*/
|
||||
@Provide()
|
||||
@Controller('/api/basic/user')
|
||||
export class BasicUserController extends BasicController {
|
||||
@Inject()
|
||||
service: UserService;
|
||||
@Inject()
|
||||
authService: AuthService;
|
||||
|
||||
getService(): UserService {
|
||||
return this.service;
|
||||
}
|
||||
|
||||
@Post('/getSimpleUserByIds', { summary: Constants.per.authOnly })
|
||||
async getSimpleUserByIds(@Body('ids') ids: number[]) {
|
||||
if(!isEnterprise()){
|
||||
throw new Error('非企业模式不能获取用户信息');
|
||||
}
|
||||
const users = await this.service.find({
|
||||
select: {
|
||||
id: true,
|
||||
username: true,
|
||||
nickName: true,
|
||||
mobile: true,
|
||||
phoneCode: true,
|
||||
},
|
||||
where: {
|
||||
id: In(ids),
|
||||
},
|
||||
});
|
||||
return this.ok(users);
|
||||
}
|
||||
|
||||
@Post('/getSimpleUsers', {summary: Constants.per.authOnly})
|
||||
async getSimpleUsers() {
|
||||
if(!isEnterprise()){
|
||||
throw new Error('非企业模式不能获取所有用户信息');
|
||||
}
|
||||
const users = await this.service.find({
|
||||
select: {
|
||||
id: true,
|
||||
username: true,
|
||||
nickName: true,
|
||||
mobile: true,
|
||||
phoneCode: true,
|
||||
},
|
||||
});
|
||||
return this.ok(users);
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user