From ab53c601bfce7324b5f03a1315a37b4d79b1ed61 Mon Sep 17 00:00:00 2001 From: xiaojunnuo Date: Mon, 23 Sep 2024 13:33:46 +0800 Subject: [PATCH] chore: --- .../src/modules/account/account-controller.ts | 20 ++++++++++++++++++- .../src/modules/system/service/models.ts | 2 ++ 2 files changed, 21 insertions(+), 1 deletion(-) diff --git a/packages/ui/certd-server/src/modules/account/account-controller.ts b/packages/ui/certd-server/src/modules/account/account-controller.ts index 3e409597c..abd85c0b3 100644 --- a/packages/ui/certd-server/src/modules/account/account-controller.ts +++ b/packages/ui/certd-server/src/modules/account/account-controller.ts @@ -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({}); + } } diff --git a/packages/ui/certd-server/src/modules/system/service/models.ts b/packages/ui/certd-server/src/modules/system/service/models.ts index 60f89de0c..3d239804f 100644 --- a/packages/ui/certd-server/src/modules/system/service/models.ts +++ b/packages/ui/certd-server/src/modules/system/service/models.ts @@ -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 {