chore: project userid fixed -1

This commit is contained in:
xiaojunnuo
2026-03-04 23:15:48 +08:00
parent 6c546b5290
commit 17dd77cc96
21 changed files with 97 additions and 72 deletions
@@ -21,12 +21,18 @@ export class BasicController extends BaseController {
@Post('/preBindUser', { summary: 'sys:settings:edit' })
public async preBindUser(@Body(ALL) body: PreBindUserReq) {
// 设置缓存内容
if (body.userId == null || body.userId <= 0) {
throw new Error("用户ID不能为空");
}
await this.plusService.userPreBind(body.userId);
return this.ok({});
}
@Post('/bindUser', { summary: 'sys:settings:edit' })
public async bindUser(@Body(ALL) body: BindUserReq) {
if (body.userId == null || body.userId <= 0) {
throw new Error("用户ID不能为空");
}
const installInfo: SysInstallInfo = await this.sysSettingsService.getSetting(SysInstallInfo);
installInfo.bindUserId = body.userId;
await this.sysSettingsService.saveSetting(installInfo);
@@ -14,7 +14,7 @@ export class SysAddonController extends AddonController {
async getProjectUserId(permission:string){
return {
projectId:null,userId:0
projectId:null,userId:0 //0为系统级别
}
}
getUserId() {
@@ -40,7 +40,7 @@ export class SysProjectController extends CrudController<ProjectEntity> {
bean.userId = this.getUserId();
return super.add({
...bean,
userId:0,
userId:-1, //企业用户id固定为-1
adminId: bean.userId,
});
}