杂务:新增声明级注释覆盖率

This commit is contained in:
xiaowang
2026-05-23 18:44:57 +08:00
parent 8f038894e7
commit 844516988b
234 changed files with 8356 additions and 0 deletions
+232
View File
@@ -10,10 +10,26 @@ import { clearAdminSessionStorage } from '@/utils/admin-session'
import { attachRequestSignature } from '@/utils/request-signature'
import { isAdminApiAuthFreePath } from './auth-free-paths'
/**
* Purpose: lastErrorTime supports admin.ts by holding or executing the last error time page or API role.
* Usage: import, call, read, or update this let from the owning page/module while preserving the surrounding loading and permission flow.
*/
let lastErrorTime = 0
/**
* Purpose: lastErrorMessage supports admin.ts by holding or executing the last error message page or API role.
* Usage: import, call, read, or update this let from the owning page/module while preserving the surrounding loading and permission flow.
*/
let lastErrorMessage = ''
/**
* Purpose: ERROR_DEBOUNCE_TIME supports admin.ts by holding or executing the error debounce time page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
const ERROR_DEBOUNCE_TIME = 1000
/**
* Purpose: adminApi supports admin.ts by holding or executing the admin api page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
const adminApi = axios.create({
baseURL: ADMIN_API_BASE_URL,
timeout: 10000,
@@ -22,12 +38,20 @@ const adminApi = axios.create({
}
})
/**
* Purpose: isRefreshing supports admin.ts by holding or executing the is refreshing page or API role.
* Usage: import, call, read, or update this let from the owning page/module while preserving the surrounding loading and permission flow.
*/
let isRefreshing = false
let failedQueue: Array<{
resolve: (value?: any) => void
reject: (reason?: any) => void
}> = []
/**
* Purpose: processQueue supports admin.ts by holding or executing the process queue page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
const processQueue = (error: any, token: string | null = null) => {
failedQueue.forEach(prom => {
if (error) {
@@ -39,10 +63,18 @@ const processQueue = (error: any, token: string | null = null) => {
failedQueue = []
}
/**
* Purpose: getStoredAdminAccessToken supports admin.ts by holding or executing the get stored admin access token page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
const getStoredAdminAccessToken = () => {
return localStorage.getItem('adminAccessToken') || sessionStorage.getItem('adminAccessToken')
}
/**
* Purpose: getRequestToken supports admin.ts by holding or executing the get request token page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
const getRequestToken = (request: any) => {
if (request?._authToken) {
return request._authToken as string
@@ -54,10 +86,18 @@ const getRequestToken = (request: any) => {
return authHeader.startsWith('Bearer ') ? authHeader.slice('Bearer '.length) : null
}
/**
* Purpose: isCurrentStoredAdminToken supports admin.ts by holding or executing the is current stored admin token page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
const isCurrentStoredAdminToken = (token: string | null) => {
return Boolean(token && token === getStoredAdminAccessToken())
}
/**
* Purpose: showError supports admin.ts by holding or executing the show error page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
const showError = (msg: string) => {
const now = Date.now()
if (now - lastErrorTime > ERROR_DEBOUNCE_TIME || msg !== lastErrorMessage) {
@@ -67,10 +107,18 @@ const showError = (msg: string) => {
}
}
/**
* Purpose: isAuthFreePath supports admin.ts by holding or executing the is auth free path page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
const isAuthFreePath = (url?: string) => {
return isAdminApiAuthFreePath(url)
}
/**
* Purpose: handleAdminTokenExpired supports admin.ts by holding or executing the handle admin token expired page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
const handleAdminTokenExpired = (failedToken: string | null = null) => {
if (!isCurrentStoredAdminToken(failedToken)) {
return
@@ -192,18 +240,30 @@ adminApi.interceptors.response.use(
}
)
/**
* Purpose: AdminLoginRequest supports admin.ts by holding or executing the admin login request page or API role.
* Usage: import, call, read, or update this interface from the owning page/module while preserving the surrounding loading and permission flow.
*/
export interface AdminLoginRequest {
account: string
password: string
shopId?: IdType
}
/**
* Purpose: AdminLoginResponse supports admin.ts by holding or executing the admin login response page or API role.
* Usage: import, call, read, or update this interface from the owning page/module while preserving the surrounding loading and permission flow.
*/
export interface AdminLoginResponse {
accessToken: string
refreshToken: string
userInfo: any
}
/**
* Purpose: LoginShopSelectionResponse supports admin.ts by holding or executing the login shop selection response page or API role.
* Usage: import, call, read, or update this interface from the owning page/module while preserving the surrounding loading and permission flow.
*/
export interface LoginShopSelectionResponse {
allowShoplessLogin: boolean
message: string
@@ -213,6 +273,10 @@ export interface LoginShopSelectionResponse {
}>
}
/**
* Purpose: LegalAgreementAdminVO supports admin.ts by holding or executing the legal agreement admin vo page or API role.
* Usage: import, call, read, or update this interface from the owning page/module while preserving the surrounding loading and permission flow.
*/
export interface LegalAgreementAdminVO {
id: IdType
agreementType: 'USER_TERMS' | 'PRIVACY_POLICY'
@@ -227,6 +291,10 @@ export interface LegalAgreementAdminVO {
updateTime?: string
}
/**
* Purpose: LegalAgreementAdminRequest supports admin.ts by holding or executing the legal agreement admin request page or API role.
* Usage: import, call, read, or update this interface from the owning page/module while preserving the surrounding loading and permission flow.
*/
export interface LegalAgreementAdminRequest {
agreementType: 'USER_TERMS' | 'PRIVACY_POLICY'
title: string
@@ -280,6 +348,10 @@ export const adminAuthApi = {
}
}
/**
* Purpose: adminLegalAgreementApi supports admin.ts by holding or executing the admin legal agreement api page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
export const adminLegalAgreementApi = {
list: () => adminApi.get<LegalAgreementAdminVO[]>('/legal-agreement/list'),
create: (data: LegalAgreementAdminRequest) => adminApi.post<IdType>('/legal-agreement/create', data),
@@ -288,6 +360,10 @@ export const adminLegalAgreementApi = {
disable: (id: IdType) => adminApi.put<boolean>(`/legal-agreement/${id}/disable`)
}
/**
* Purpose: ObjectStorageFileVO supports admin.ts by holding or executing the object storage file vo page or API role.
* Usage: import, call, read, or update this interface from the owning page/module while preserving the surrounding loading and permission flow.
*/
export interface ObjectStorageFileVO {
id: IdType
fileName: string
@@ -296,6 +372,10 @@ export interface ObjectStorageFileVO {
createTime: string
}
/**
* Purpose: ChunkUploadInitRequest supports admin.ts by holding or executing the chunk upload init request page or API role.
* Usage: import, call, read, or update this interface from the owning page/module while preserving the surrounding loading and permission flow.
*/
export interface ChunkUploadInitRequest {
fileName: string
fileSize: number
@@ -304,6 +384,10 @@ export interface ChunkUploadInitRequest {
scene: string
}
/**
* Purpose: ChunkUploadSessionVO supports admin.ts by holding or executing the chunk upload session vo page or API role.
* Usage: import, call, read, or update this interface from the owning page/module while preserving the surrounding loading and permission flow.
*/
export interface ChunkUploadSessionVO {
uploadId: string
chunkSize: number
@@ -339,6 +423,10 @@ export const adminFileApi = {
return adminApi.post<ChunkUploadSessionVO>('/object-storage-file/upload/init', data) as unknown as Promise<ChunkUploadSessionVO>
},
uploadChunk: (
/**
* Purpose: data supports admin.ts by holding or executing the data page or API role.
* Usage: import, call, read, or update this page-data from the owning page/module while preserving the surrounding loading and permission flow.
*/
data: { uploadId: string; chunkIndex: number; totalChunks: number; chunk: Blob },
config?: { signal?: AbortSignal; onUploadProgress?: (event: AxiosProgressEvent) => void }
) => {
@@ -348,10 +436,22 @@ export const adminFileApi = {
formData.append('totalChunks', String(data.totalChunks))
formData.append('chunk', data.chunk)
return adminApi.post<boolean>('/object-storage-file/upload/chunk', formData, {
/**
* Purpose: headers supports admin.ts by holding or executing the headers page or API role.
* Usage: import, call, read, or update this page-data-field from the owning page/module while preserving the surrounding loading and permission flow.
*/
headers: {
'Content-Type': 'multipart/form-data'
},
/**
* Purpose: signal supports admin.ts by holding or executing the signal page or API role.
* Usage: import, call, read, or update this page-data-field from the owning page/module while preserving the surrounding loading and permission flow.
*/
signal: config?.signal,
/**
* Purpose: onUploadProgress supports admin.ts by holding or executing the on upload progress page or API role.
* Usage: import, call, read, or update this page-data-field from the owning page/module while preserving the surrounding loading and permission flow.
*/
onUploadProgress: config?.onUploadProgress
})
},
@@ -381,6 +481,10 @@ export const adminFileApi = {
}
}
/**
* Purpose: Tag supports admin.ts by holding or executing the tag page or API role.
* Usage: import, call, read, or update this interface from the owning page/module while preserving the surrounding loading and permission flow.
*/
export interface Tag {
id: IdType
tagName: string
@@ -442,6 +546,10 @@ export const adminTagApi = {
}
}
/**
* Purpose: Artist supports admin.ts by holding or executing the artist page or API role.
* Usage: import, call, read, or update this interface from the owning page/module while preserving the surrounding loading and permission flow.
*/
export interface Artist {
id: IdType
nickname: string
@@ -472,6 +580,10 @@ export const adminArtistApi = {
}
}
/**
* Purpose: Coupon supports admin.ts by holding or executing the coupon page or API role.
* Usage: import, call, read, or update this interface from the owning page/module while preserving the surrounding loading and permission flow.
*/
export interface Coupon {
id: IdType
couponCode?: string
@@ -548,6 +660,10 @@ export const adminCouponApi = {
}
}
/**
* Purpose: AdminCommentVO supports admin.ts by holding or executing the admin comment vo page or API role.
* Usage: import, call, read, or update this interface from the owning page/module while preserving the surrounding loading and permission flow.
*/
export interface AdminCommentVO {
id: IdType
userId: IdType
@@ -585,6 +701,10 @@ export const adminCommentApi = {
}
}
/**
* Purpose: Product supports admin.ts by holding or executing the product page or API role.
* Usage: import, call, read, or update this interface from the owning page/module while preserving the surrounding loading and permission flow.
*/
export interface Product {
id: IdType
shopId: IdType
@@ -653,6 +773,10 @@ export const adminProductApi = {
}
}
/**
* Purpose: Shop supports admin.ts by holding or executing the shop page or API role.
* Usage: import, call, read, or update this interface from the owning page/module while preserving the surrounding loading and permission flow.
*/
export interface Shop {
id: IdType
shopName: string
@@ -682,6 +806,10 @@ export interface Shop {
updateTime: string
}
/**
* Purpose: ShopListResponse supports admin.ts by holding or executing the shop list response page or API role.
* Usage: import, call, read, or update this interface from the owning page/module while preserving the surrounding loading and permission flow.
*/
export interface ShopListResponse {
list: Shop[]
total: number
@@ -689,6 +817,10 @@ export interface ShopListResponse {
size: number
}
/**
* Purpose: CreateShopRequest supports admin.ts by holding or executing the create shop request page or API role.
* Usage: import, call, read, or update this interface from the owning page/module while preserving the surrounding loading and permission flow.
*/
export interface CreateShopRequest {
shopName: string
description: string
@@ -759,6 +891,10 @@ export const adminShopApi = {
}
}
/**
* Purpose: UserVO supports admin.ts by holding or executing the user vo page or API role.
* Usage: import, call, read, or update this interface from the owning page/module while preserving the surrounding loading and permission flow.
*/
export interface UserVO {
id: IdType
shopId?: IdType
@@ -780,6 +916,10 @@ export interface UserVO {
status?: number
}
/**
* Purpose: UserRelationVO supports admin.ts by holding or executing the user relation vo page or API role.
* Usage: import, call, read, or update this interface from the owning page/module while preserving the surrounding loading and permission flow.
*/
export interface UserRelationVO {
userId: IdType
shopId?: IdType
@@ -792,6 +932,10 @@ export interface UserRelationVO {
sourceTypeName?: string
}
/**
* Purpose: UserStatisticsVO supports admin.ts by holding or executing the user statistics vo page or API role.
* Usage: import, call, read, or update this interface from the owning page/module while preserving the surrounding loading and permission flow.
*/
export interface UserStatisticsVO {
totalUserCount: number
normalUserCount: number
@@ -805,6 +949,10 @@ export interface UserStatisticsVO {
byParent?: Record<string, number>
}
/**
* Purpose: PageResult supports admin.ts by holding or executing the page result page or API role.
* Usage: import, call, read, or update this interface from the owning page/module while preserving the surrounding loading and permission flow.
*/
export interface PageResult<T> {
list: T[]
total: number
@@ -960,6 +1108,10 @@ export const adminUserApi = {
}
}
/**
* Purpose: UserAssetVO supports admin.ts by holding or executing the user asset vo page or API role.
* Usage: import, call, read, or update this interface from the owning page/module while preserving the surrounding loading and permission flow.
*/
export interface UserAssetVO {
userId: IdType
nickname: string
@@ -975,6 +1127,10 @@ export interface UserAssetVO {
vipExpireTime?: string
}
/**
* Purpose: UserBalanceHistoryItem supports admin.ts by holding or executing the user balance history item page or API role.
* Usage: import, call, read, or update this interface from the owning page/module while preserving the surrounding loading and permission flow.
*/
export interface UserBalanceHistoryItem {
id: IdType
userId: IdType
@@ -993,6 +1149,10 @@ export interface UserBalanceHistoryItem {
changeTime: string
}
/**
* Purpose: AdminUserBalanceChangeRequest supports admin.ts by holding or executing the admin user balance change request page or API role.
* Usage: import, call, read, or update this interface from the owning page/module while preserving the surrounding loading and permission flow.
*/
export interface AdminUserBalanceChangeRequest {
amount: number
changeScene: string
@@ -1001,13 +1161,25 @@ export interface AdminUserBalanceChangeRequest {
remark?: string
}
/**
* Purpose: AdminUserVipOverrideRequest supports admin.ts by holding or executing the admin user vip override request page or API role.
* Usage: import, call, read, or update this interface from the owning page/module while preserving the surrounding loading and permission flow.
*/
export interface AdminUserVipOverrideRequest {
vipLevel: string
remark?: string
}
/**
* Purpose: userApi supports admin.ts by holding or executing the user api page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
export const userApi = adminUserApi
/**
* Purpose: OrderVO supports admin.ts by holding or executing the order vo page or API role.
* Usage: import, call, read, or update this interface from the owning page/module while preserving the surrounding loading and permission flow.
*/
export interface OrderVO {
id: IdType
orderNo: string
@@ -1067,6 +1239,10 @@ export const adminOrderApi = {
}
}
/**
* Purpose: HotProductVO supports admin.ts by holding or executing the hot product vo page or API role.
* Usage: import, call, read, or update this interface from the owning page/module while preserving the surrounding loading and permission flow.
*/
export interface HotProductVO {
id: IdType
title: string
@@ -1075,6 +1251,10 @@ export interface HotProductVO {
collectCount: number
}
/**
* Purpose: RecentActivityVO supports admin.ts by holding or executing the recent activity vo page or API role.
* Usage: import, call, read, or update this interface from the owning page/module while preserving the surrounding loading and permission flow.
*/
export interface RecentActivityVO {
id: IdType
type: string
@@ -1084,6 +1264,10 @@ export interface RecentActivityVO {
color?: string
}
/**
* Purpose: DashboardStats supports admin.ts by holding or executing the dashboard stats page or API role.
* Usage: import, call, read, or update this interface from the owning page/module while preserving the surrounding loading and permission flow.
*/
export interface DashboardStats {
totalUsers: number
totalProducts: number
@@ -1117,6 +1301,10 @@ export const adminDashboardApi = {
}
}
/**
* Purpose: NailArtistInfoVO supports admin.ts by holding or executing the nail artist info vo page or API role.
* Usage: import, call, read, or update this interface from the owning page/module while preserving the surrounding loading and permission flow.
*/
export interface NailArtistInfoVO {
id: IdType
userId: IdType
@@ -1166,6 +1354,10 @@ export const adminNailArtistApi = {
}
}
/**
* Purpose: SystemMessageVO supports admin.ts by holding or executing the system message vo page or API role.
* Usage: import, call, read, or update this interface from the owning page/module while preserving the surrounding loading and permission flow.
*/
export interface SystemMessageVO {
id: IdType
title: string
@@ -1186,11 +1378,19 @@ export interface SystemMessageVO {
readStatus?: number
}
/**
* Purpose: MessageTargetOptionsVO supports admin.ts by holding or executing the message target options vo page or API role.
* Usage: import, call, read, or update this interface from the owning page/module while preserving the surrounding loading and permission flow.
*/
export interface MessageTargetOptionsVO {
shops: Array<{ id: IdType; shopName: string }>
users: Array<{ id: IdType; nickname: string; account: string; shopId?: IdType; shopName?: string; type?: number }>
}
/**
* Purpose: SystemMessageCreateRequest supports admin.ts by holding or executing the system message create request page or API role.
* Usage: import, call, read, or update this interface from the owning page/module while preserving the surrounding loading and permission flow.
*/
export interface SystemMessageCreateRequest {
title: string
content: string
@@ -1240,6 +1440,10 @@ export const adminSystemMessageApi = {
}
}
/**
* Purpose: AnnouncementVO supports admin.ts by holding or executing the announcement vo page or API role.
* Usage: import, call, read, or update this interface from the owning page/module while preserving the surrounding loading and permission flow.
*/
export interface AnnouncementVO {
id: IdType
title: string
@@ -1256,6 +1460,10 @@ export interface AnnouncementVO {
createTime?: string
}
/**
* Purpose: AnnouncementCreateRequest supports admin.ts by holding or executing the announcement create request page or API role.
* Usage: import, call, read, or update this interface from the owning page/module while preserving the surrounding loading and permission flow.
*/
export interface AnnouncementCreateRequest {
title: string
content: string
@@ -1303,6 +1511,10 @@ export const adminAnnouncementApi = {
}
}
/**
* Purpose: VipRechargePlanVO supports admin.ts by holding or executing the vip recharge plan vo page or API role.
* Usage: import, call, read, or update this interface from the owning page/module while preserving the surrounding loading and permission flow.
*/
export interface VipRechargePlanVO {
id: IdType
shopId: IdType
@@ -1318,6 +1530,10 @@ export interface VipRechargePlanVO {
updateTime?: string
}
/**
* Purpose: VipRechargePlanRequest supports admin.ts by holding or executing the vip recharge plan request page or API role.
* Usage: import, call, read, or update this interface from the owning page/module while preserving the surrounding loading and permission flow.
*/
export interface VipRechargePlanRequest {
shopId?: IdType
title: string
@@ -1380,6 +1596,10 @@ export const adminVipRechargePlanApi = {
}
}
/**
* Purpose: MessageHubPushConfigVO supports admin.ts by holding or executing the message hub push config vo page or API role.
* Usage: import, call, read, or update this interface from the owning page/module while preserving the surrounding loading and permission flow.
*/
export interface MessageHubPushConfigVO {
id: IdType
sceneCode: string
@@ -1397,6 +1617,10 @@ export interface MessageHubPushConfigVO {
updateTime?: string
}
/**
* Purpose: MessageHubPushConfigRequest supports admin.ts by holding or executing the message hub push config request page or API role.
* Usage: import, call, read, or update this interface from the owning page/module while preserving the surrounding loading and permission flow.
*/
export interface MessageHubPushConfigRequest {
sceneCode: string
sceneName: string
@@ -1460,6 +1684,10 @@ export const adminMessageHubPushConfigApi = {
}
}
/**
* Purpose: SystemParameterConfigVO supports admin.ts by holding or executing the system parameter config vo page or API role.
* Usage: import, call, read, or update this interface from the owning page/module while preserving the surrounding loading and permission flow.
*/
export interface SystemParameterConfigVO {
id?: IdType
configGroup: string
@@ -1472,6 +1700,10 @@ export interface SystemParameterConfigVO {
updateTime?: string
}
/**
* Purpose: adminSystemParameterConfigApi supports admin.ts by holding or executing the admin system parameter config api page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
export const adminSystemParameterConfigApi = {
listConfigs: (configGroup?: string) => {
return adminApi.get<SystemParameterConfigVO[]>('/system-parameter-config/admin/list', { params: { configGroup } }) as unknown as Promise<SystemParameterConfigVO[]>