pull/189/head
xiaojunnuo 2024-09-23 13:33:46 +08:00
parent 8e03e8463f
commit ab53c601bf
2 changed files with 21 additions and 1 deletions

View File

@ -8,7 +8,9 @@ import { SysInstallInfo } from '../system/service/models.js';
export type PreBindUserReq = {
userId: number;
};
export type BindUserReq = {
userId: number;
};
/**
*/
@Provide()
@ -35,4 +37,20 @@ export class BasicController extends BaseController {
return this.ok({});
}
@Post('/bindUser', { summary: 'sys:settings:edit' })
public async bindUser(@Body(ALL) body: BindUserReq) {
const installInfo: SysInstallInfo = await this.sysSettingsService.getSetting(SysInstallInfo);
installInfo.bindUserId = body.userId;
await this.sysSettingsService.saveSetting(installInfo);
return this.ok({});
}
@Post('/unbindUser', { summary: 'sys:settings:edit' })
public async unbindUser() {
const installInfo: SysInstallInfo = await this.sysSettingsService.getSetting(SysInstallInfo);
installInfo.bindUserId = null;
await this.sysSettingsService.saveSetting(installInfo);
return this.ok({});
}
}

View File

@ -30,6 +30,8 @@ export class SysInstallInfo extends BaseSettings {
static __access__ = 'private';
installTime: number;
siteId?: string;
bindUserId?: number;
bindUrl?: string;
}
export class SysLicenseInfo extends BaseSettings {