feat: 新增license

This commit is contained in:
小蟑螂
2026-07-06 19:34:53 +08:00
parent 8a6cb23c07
commit ac890dcc5c
110 changed files with 10678 additions and 1368 deletions
@@ -0,0 +1,42 @@
import type { LicenseDTO, LicenseVO } from './types';
import { baseRequestClient, requestClient } from '#/api/request';
/** 初始化相关 API(无需登录) */
export async function getInitStatusApi() {
return baseRequestClient.get<LicenseVO.InitStatus>('/init/status');
}
export async function createInitAdminApi(data: LicenseDTO.InitAdmin) {
return baseRequestClient.post<void>('/init/admin', data);
}
export async function saveInitCompanyApi(data: LicenseDTO.InitCompany) {
return baseRequestClient.post<void>('/init/company', data);
}
export async function getInitFingerprintApi() {
return baseRequestClient.get<LicenseVO.Fingerprint>('/init/fingerprint');
}
export async function activateLicenseApi(data: LicenseDTO.ActivateLicense) {
return baseRequestClient.post<LicenseVO.LicenseSummary>(
'/init/activate',
data,
);
}
/** 已登录用户的 License 管理 API */
export async function getLicenseInfoApi() {
return requestClient.get<LicenseVO.LicenseSummary>('/system/license');
}
export async function updateLicenseApi(data: LicenseDTO.ActivateLicense) {
return requestClient.put<LicenseVO.LicenseSummary>('/system/license', data);
}
export async function getSystemFingerprintApi() {
return requestClient.get<LicenseVO.Fingerprint>('/system/fingerprint');
}
@@ -0,0 +1,2 @@
export * from './apis';
export * from './types';
@@ -0,0 +1,2 @@
export * from './types.dto';
export * from './types.vo';
@@ -0,0 +1,21 @@
/**
* License 模块 — 请求 DTO
*/
export namespace LicenseDTO {
export interface InitAdmin {
loginCode: string;
phone?: string;
password: string;
realName: string;
}
export interface InitCompany {
companyName: string;
contactPhone?: string;
contactEmail?: string;
}
export interface ActivateLicense {
licenseKey: string;
}
}
@@ -0,0 +1,32 @@
/**
* License 模块 — 响应 VO
*/
export namespace LicenseVO {
/** 初始化状态 */
export interface InitStatus {
initialized: boolean;
currentStep: number;
adminCreated: boolean;
companySaved: boolean;
licenseActivated: boolean;
}
/** 机器指纹 */
export interface Fingerprint {
fingerprint: string;
machineId: string;
hostname: string;
}
/** License 摘要 */
export interface LicenseSummary {
companyName?: string;
edition?: string;
machineFingerprint?: string;
features?: string[];
issuedAt?: string;
expiresAt?: string;
daysRemaining?: number;
status?: string;
}
}