- 重构config层为配置中心架构,支持动态配置管理 - 统一core层命名规范(event-bus→event, circuit-breaker→breaker, domain-sdk→sdk) - 修复数据库连接配置路径问题 - 实现配置中心完整功能:系统配置、动态配置、配置验证、统计 - 优化目录结构,为微服务架构做准备 - 修复TypeScript编译错误和依赖注入问题
76 lines
2.0 KiB
TypeScript
76 lines
2.0 KiB
TypeScript
import { Injectable } from '@nestjs/common';
|
|
import { CoreUserService } from '../core/CoreUserService';
|
|
import { CreateUserAdminDto, UpdateUserAdminDto, GetUserListAdminDto, BatchUpdateUserStatusAdminDto, ResetUserPasswordAdminDto } from '../../dto/admin/UserDto';
|
|
import { UserContextDto } from '../../dto/UserContextDto';
|
|
|
|
@Injectable()
|
|
export class UserAdminService {
|
|
constructor(
|
|
private readonly coreUserService: CoreUserService,
|
|
) {}
|
|
|
|
/**
|
|
* 创建用户
|
|
*/
|
|
async createUser(createUserDto: CreateUserAdminDto, userContext: UserContextDto) {
|
|
return await this.coreUserService.createUser(
|
|
createUserDto,
|
|
userContext.siteId,
|
|
userContext.userId,
|
|
);
|
|
}
|
|
|
|
/**
|
|
* 更新用户
|
|
*/
|
|
async updateUser(updateUserDto: UpdateUserAdminDto, userContext: UserContextDto) {
|
|
return await this.coreUserService.updateUser(
|
|
updateUserDto,
|
|
userContext.siteId,
|
|
userContext.userId,
|
|
);
|
|
}
|
|
|
|
/**
|
|
* 获取用户列表
|
|
*/
|
|
async getUserList(queryDto: GetUserListAdminDto, userContext: UserContextDto) {
|
|
return await this.coreUserService.getUserList(queryDto, userContext.siteId);
|
|
}
|
|
|
|
/**
|
|
* 根据ID获取用户
|
|
*/
|
|
async getUserById(id: number, userContext: UserContextDto) {
|
|
return await this.coreUserService.getUserById(id, userContext.siteId);
|
|
}
|
|
|
|
/**
|
|
* 删除用户
|
|
*/
|
|
async deleteUser(id: number, userContext: UserContextDto) {
|
|
return await this.coreUserService.deleteUser(id, userContext.siteId);
|
|
}
|
|
|
|
/**
|
|
* 批量更新用户状态
|
|
*/
|
|
async batchUpdateStatus(batchUpdateDto: BatchUpdateUserStatusAdminDto, userContext: UserContextDto) {
|
|
return await this.coreUserService.batchUpdateStatus(
|
|
batchUpdateDto.ids,
|
|
batchUpdateDto.status,
|
|
userContext.siteId,
|
|
);
|
|
}
|
|
|
|
/**
|
|
* 重置用户密码
|
|
*/
|
|
async resetPassword(resetPasswordDto: ResetUserPasswordAdminDto, userContext: UserContextDto) {
|
|
return await this.coreUserService.resetPassword(
|
|
resetPasswordDto.id,
|
|
resetPasswordDto.password,
|
|
userContext.siteId,
|
|
);
|
|
}
|
|
}
|