2024-07-15 00:30:33 +08:00
|
|
|
import { ALL, Body, Controller, Inject, Post, Provide } from '@midwayjs/core';
|
|
|
|
|
import { BaseController } from '../../../basic/base-controller.js';
|
|
|
|
|
import { Constants } from '../../../basic/constants.js';
|
|
|
|
|
import { UserService } from '../../authority/service/user-service.js';
|
2024-08-14 21:24:12 +08:00
|
|
|
import { getPlusInfo } from '@certd/pipeline';
|
2023-06-28 23:15:37 +08:00
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
*/
|
|
|
|
|
@Provide()
|
|
|
|
|
@Controller('/api/mine')
|
|
|
|
|
export class MineController extends BaseController {
|
|
|
|
|
@Inject()
|
|
|
|
|
userService: UserService;
|
|
|
|
|
@Post('/info', { summary: Constants.per.authOnly })
|
|
|
|
|
public async info() {
|
|
|
|
|
const userId = this.getUserId();
|
|
|
|
|
const user = await this.userService.info(userId);
|
|
|
|
|
delete user.password;
|
|
|
|
|
return this.ok(user);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Post('/changePassword', { summary: Constants.per.authOnly })
|
|
|
|
|
public async changePassword(@Body(ALL) body: any) {
|
|
|
|
|
const userId = this.getUserId();
|
|
|
|
|
await this.userService.changePassword(userId, body);
|
|
|
|
|
return this.ok({});
|
|
|
|
|
}
|
2024-08-14 21:24:12 +08:00
|
|
|
|
|
|
|
|
@Post('/plusInfo', { summary: Constants.per.authOnly })
|
|
|
|
|
async plusInfo(@Body(ALL) body) {
|
|
|
|
|
const info = getPlusInfo();
|
|
|
|
|
return this.ok({
|
|
|
|
|
...info,
|
|
|
|
|
});
|
|
|
|
|
}
|
2023-06-28 23:15:37 +08:00
|
|
|
}
|