mirror of
https://gitee.com/qqtt-ah/ecom-dmb.git
synced 2026-11-24 07:49:19 +08:00
feat: 新增license
This commit is contained in:
@@ -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;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user