Files
JayuCloud/JC-Salon-Frontend/src/api/admin.ts
T

2078 lines
84 KiB
TypeScript
Raw Normal View History

/**
* Front-end API wrapper for this module.
* Call guide: import the named API object, then call the matching method from a Vue page or composable.
*/
2026-03-26 11:41:38 +08:00
import axios, { AxiosError, type AxiosProgressEvent } from 'axios'
2026-02-25 10:37:16 +08:00
import { message } from 'ant-design-vue'
2026-03-10 23:23:15 +08:00
import { ADMIN_API_BASE_URL } from '../config/api'
2026-03-27 14:55:41 +08:00
import type { IdType } from '@/utils/id'
import { clearAdminSessionStorage } from '@/utils/admin-session'
import { attachRequestSignature } from '@/utils/request-signature'
2026-05-23 15:16:40 +08:00
import { isAdminApiAuthFreePath } from './auth-free-paths'
2026-02-25 10:37:16 +08:00
2026-05-23 18:44:57 +08:00
/**
* 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.
*/
2026-02-26 23:28:24 +08:00
let lastErrorTime = 0
2026-05-23 18:44:57 +08:00
/**
* 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.
*/
2026-02-26 23:28:24 +08:00
let lastErrorMessage = ''
2026-05-23 18:44:57 +08:00
/**
* 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
2026-02-26 23:28:24 +08:00
2026-05-23 18:44:57 +08:00
/**
* 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.
*/
2026-02-25 10:37:16 +08:00
const adminApi = axios.create({
2026-03-10 23:23:15 +08:00
baseURL: ADMIN_API_BASE_URL,
2026-05-29 13:30:56 +08:00
timeout: 60000,
2026-02-25 10:37:16 +08:00
headers: {
'Content-Type': 'application/json'
}
})
2026-05-23 18:44:57 +08:00
/**
* 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
}> = []
2026-05-23 18:44:57 +08:00
/**
* 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) {
prom.reject(error)
} else {
prom.resolve(token)
}
})
failedQueue = []
}
2026-05-23 18:44:57 +08:00
/**
* 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.
*/
2026-05-23 15:16:40 +08:00
const getStoredAdminAccessToken = () => {
return localStorage.getItem('adminAccessToken') || sessionStorage.getItem('adminAccessToken')
}
2026-05-23 18:44:57 +08:00
/**
* 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.
*/
2026-05-23 15:16:40 +08:00
const getRequestToken = (request: any) => {
if (request?._authToken) {
return request._authToken as string
}
const authHeader = request?.headers?.Authorization || request?.headers?.authorization
if (typeof authHeader !== 'string') {
return null
}
return authHeader.startsWith('Bearer ') ? authHeader.slice('Bearer '.length) : null
}
2026-05-23 18:44:57 +08:00
/**
* 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.
*/
2026-05-23 15:16:40 +08:00
const isCurrentStoredAdminToken = (token: string | null) => {
return Boolean(token && token === getStoredAdminAccessToken())
}
2026-05-23 18:44:57 +08:00
/**
* 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) {
lastErrorTime = now
lastErrorMessage = msg
message.error(msg)
}
}
2026-05-23 18:44:57 +08:00
/**
* 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) => {
2026-05-23 15:16:40 +08:00
return isAdminApiAuthFreePath(url)
}
2026-05-23 18:44:57 +08:00
/**
* 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.
*/
2026-05-23 15:16:40 +08:00
const handleAdminTokenExpired = (failedToken: string | null = null) => {
if (!isCurrentStoredAdminToken(failedToken)) {
return
}
clearAdminSessionStorage()
if (Date.now() - lastErrorTime > ERROR_DEBOUNCE_TIME || lastErrorMessage !== '登录已过期,请重新登录') {
showError('登录已过期,请重新登录')
}
setTimeout(() => {
window.location.href = '/admin/login'
}, 300)
}
2026-02-25 10:37:16 +08:00
adminApi.interceptors.request.use(
async config => {
let token: string | null = null
if (!isAuthFreePath(config.url)) {
2026-05-23 15:16:40 +08:00
token = getStoredAdminAccessToken()
if (token) {
config.headers.Authorization = `Bearer ${token}`
}
2026-02-25 10:37:16 +08:00
}
2026-05-23 15:16:40 +08:00
;(config as any)._authToken = token || null
return attachRequestSignature(config, token, {
authFree: isAuthFreePath(config.url)
})
2026-02-25 10:37:16 +08:00
},
error => Promise.reject(error)
2026-02-25 10:37:16 +08:00
)
adminApi.interceptors.response.use(
response => {
const res = response.data
if (res.code !== 200) {
2026-02-26 23:28:24 +08:00
const errorMsg = res.message || '请求失败'
if (!errorMsg.includes('权限') && !errorMsg.includes('permission')) {
showError(errorMsg)
2026-02-26 23:28:24 +08:00
} else {
console.error('权限不足:', errorMsg)
}
return Promise.reject(new Error(errorMsg))
}
2026-03-02 10:13:20 +08:00
return res.data as any
2026-02-25 10:37:16 +08:00
},
async (error: AxiosError) => {
const originalRequest = error.config as any
2026-02-26 23:28:24 +08:00
if (error.response?.status === 401) {
2026-05-23 15:16:40 +08:00
const requestToken = getRequestToken(originalRequest)
if (!isCurrentStoredAdminToken(requestToken)) {
return Promise.reject(error)
}
if (!originalRequest?._retry && !isAuthFreePath(originalRequest?.url)) {
if (isRefreshing) {
return new Promise((resolve, reject) => {
failedQueue.push({ resolve, reject })
}).then(token => {
if (token) {
originalRequest.headers.Authorization = `Bearer ${token}`
}
return adminApi(originalRequest)
2026-02-26 23:28:24 +08:00
})
}
originalRequest._retry = true
isRefreshing = true
try {
let refreshToken = localStorage.getItem('adminRefreshToken')
if (!refreshToken) {
refreshToken = sessionStorage.getItem('adminRefreshToken')
}
if (!refreshToken) {
throw new Error('No refresh token available')
}
const response = await adminAuthApi.refreshToken(refreshToken)
const newToken = (response as any).accessToken
const newRefreshToken = (response as any).refreshToken
localStorage.setItem('adminAccessToken', newToken)
localStorage.setItem('adminRefreshToken', newRefreshToken)
sessionStorage.setItem('adminAccessToken', newToken)
sessionStorage.setItem('adminRefreshToken', newRefreshToken)
processQueue(null, newToken)
originalRequest.headers.Authorization = `Bearer ${newToken}`
return adminApi(originalRequest)
} catch (refreshError) {
processQueue(refreshError, null)
2026-05-23 15:16:40 +08:00
handleAdminTokenExpired(requestToken)
return Promise.reject(refreshError)
} finally {
isRefreshing = false
2026-02-26 23:28:24 +08:00
}
}
2026-05-23 15:16:40 +08:00
handleAdminTokenExpired(requestToken)
} else if (error.response?.status !== 403) {
const errorMsg = (error.response?.data as any)?.message || error.message || '请求失败'
2026-02-26 23:28:24 +08:00
showError(errorMsg)
} else {
console.error('权限不足:', error)
2026-02-25 10:37:16 +08:00
}
if (error.response?.status === 403) {
const errorMsg = (error.response?.data as any)?.message || '权限不足'
console.error('Admin API Permission Error:', errorMsg)
return Promise.reject(new Error(errorMsg))
}
2026-02-25 10:37:16 +08:00
console.error('Admin API Error:', error)
return Promise.reject(error)
}
)
2026-05-23 18:44:57 +08:00
/**
* 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.
*/
2026-02-25 10:37:16 +08:00
export interface AdminLoginRequest {
2026-02-25 11:08:02 +08:00
account: string
2026-02-25 10:37:16 +08:00
password: string
2026-03-27 14:55:41 +08:00
shopId?: IdType
2026-02-25 10:37:16 +08:00
}
2026-05-23 18:44:57 +08:00
/**
* 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.
*/
2026-02-25 10:37:16 +08:00
export interface AdminLoginResponse {
accessToken: string
refreshToken: string
userInfo: any
}
2026-05-23 18:44:57 +08:00
/**
* 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
shops: Array<{
2026-03-27 14:55:41 +08:00
id: IdType
shopName: string
}>
}
2026-05-23 18:44:57 +08:00
/**
* 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'
agreementTypeName?: string
title: string
version: string
content: string
status: number
statusText?: string
effectiveTime?: string
createTime?: string
updateTime?: string
}
2026-05-23 18:44:57 +08:00
/**
* 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
version: string
content: string
}
/**
* adminAuthApi groups all API calls for this page domain.
* Call guide: pass the typed payload or identifier into the method below, and use the returned Promise in the page script.
*/
2026-02-25 10:37:16 +08:00
export const adminAuthApi = {
/**
* `login` API call. Use this method from the page script to invoke the backend endpoint tied to this feature.
* Call guide: supply the parameters below, await the returned Promise, and handle loading / error UI in the caller.
* @param data: AdminLoginRequest caller-supplied value for `data: AdminLoginRequest`
*/
2026-02-25 10:37:16 +08:00
login: (data: AdminLoginRequest) => {
2026-02-27 14:20:20 +08:00
return adminApi.post<AdminLoginResponse>('/auth/login', data)
2026-02-25 10:37:16 +08:00
},
/**
* `getLoginShops` API call. Use this method from the page script to invoke the backend endpoint tied to this feature.
* Call guide: supply the parameters below, await the returned Promise, and handle loading / error UI in the caller.
* @param account: string caller-supplied value for `account: string`
*/
getLoginShops: (account: string) => {
return adminApi.get<LoginShopSelectionResponse>(`/auth/login-shops/${encodeURIComponent(account)}`)
},
/**
* `logout` API call. Use this method from the page script to invoke the backend endpoint tied to this feature.
* Call guide: supply the parameters below, await the returned Promise, and handle loading / error UI in the caller.
*/
logout: () => {
return adminApi.post<boolean>('/auth/logout')
},
/**
* `switchShop` API call. Use this method from the page script to invoke the backend endpoint tied to this feature.
* Call guide: supply the parameters below, await the returned Promise, and handle loading / error UI in the caller.
* @param shopId?: IdType caller-supplied value for `shopId?: IdType`
*/
2026-03-27 14:55:41 +08:00
switchShop: (shopId?: IdType) => {
return adminApi.post<AdminLoginResponse>('/auth/switch-shop', { shopId })
},
/**
* `refreshToken` API call. Use this method from the page script to invoke the backend endpoint tied to this feature.
* Call guide: supply the parameters below, await the returned Promise, and handle loading / error UI in the caller.
* @param refreshToken: string caller-supplied value for `refreshToken: string`
*/
refreshToken: (refreshToken: string) => {
return adminApi.post<{ accessToken: string; refreshToken: string }>('/auth/refresh', { refreshToken })
}
}
2026-02-25 10:37:16 +08:00
2026-05-23 18:44:57 +08:00
/**
* 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),
update: (id: IdType, data: LegalAgreementAdminRequest) => adminApi.put<boolean>(`/legal-agreement/${id}`, data),
publish: (id: IdType) => adminApi.put<boolean>(`/legal-agreement/${id}/publish`),
disable: (id: IdType) => adminApi.put<boolean>(`/legal-agreement/${id}/disable`)
}
2026-05-23 18:44:57 +08:00
/**
* 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 {
2026-03-27 14:55:41 +08:00
id: IdType
fileName: string
fileUrl?: string
objectName?: string
primaryProvider?: string
primaryUrl?: string
backupProvider?: string
backupUrl?: string
fileSize: number
contentType: string
primaryUploadStatus?: number
backupUploadStatus?: number
backupRetryCount?: number
backupLastError?: string
backupUploadedAt?: string
backupLastRetryTime?: string
createTime: string
}
2026-05-23 18:44:57 +08:00
/**
* 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.
*/
2026-03-26 11:41:38 +08:00
export interface ChunkUploadInitRequest {
fileName: string
fileSize: number
contentType: string
fileFingerprint: string
scene: string
}
2026-05-23 18:44:57 +08:00
/**
* 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.
*/
2026-03-26 11:41:38 +08:00
export interface ChunkUploadSessionVO {
uploadId: string
chunkSize: number
totalChunks: number
uploadedChunks: number[]
}
/**
* adminFileApi groups all API calls for this page domain.
* Call guide: pass the typed payload or identifier into the method below, and use the returned Promise in the page script.
*/
export const adminFileApi = {
/**
* `uploadFile` API call. Use this method from the page script to invoke the backend endpoint tied to this feature.
* Call guide: supply the parameters below, await the returned Promise, and handle loading / error UI in the caller.
* @param file: File caller-supplied value for `file: File`
*/
uploadFile: (file: File) => {
const formData = new FormData()
formData.append('file', file)
return adminApi.post<ObjectStorageFileVO>('/object-storage-file/upload', formData, {
headers: {
'Content-Type': 'multipart/form-data'
}
}) as unknown as Promise<ObjectStorageFileVO>
},
/**
* `initChunkUpload` API call. Use this method from the page script to invoke the backend endpoint tied to this feature.
* Call guide: supply the parameters below, await the returned Promise, and handle loading / error UI in the caller.
* @param data: ChunkUploadInitRequest caller-supplied value for `data: ChunkUploadInitRequest`
*/
2026-03-26 11:41:38 +08:00
initChunkUpload: (data: ChunkUploadInitRequest) => {
return adminApi.post<ChunkUploadSessionVO>('/object-storage-file/upload/init', data) as unknown as Promise<ChunkUploadSessionVO>
},
uploadChunk: (
2026-05-23 18:44:57 +08:00
/**
* 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.
*/
2026-03-26 11:41:38 +08:00
data: { uploadId: string; chunkIndex: number; totalChunks: number; chunk: Blob },
config?: { signal?: AbortSignal; onUploadProgress?: (event: AxiosProgressEvent) => void }
) => {
const formData = new FormData()
formData.append('uploadId', data.uploadId)
formData.append('chunkIndex', String(data.chunkIndex))
formData.append('totalChunks', String(data.totalChunks))
formData.append('chunk', data.chunk)
return adminApi.post<boolean>('/object-storage-file/upload/chunk', formData, {
2026-05-23 18:44:57 +08:00
/**
* 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.
*/
2026-03-26 11:41:38 +08:00
headers: {
'Content-Type': 'multipart/form-data'
},
2026-05-23 18:44:57 +08:00
/**
* 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.
*/
2026-03-26 11:41:38 +08:00
signal: config?.signal,
2026-05-23 18:44:57 +08:00
/**
* 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.
*/
2026-03-26 11:41:38 +08:00
onUploadProgress: config?.onUploadProgress
})
},
/**
* `completeChunkUpload` API call. Use this method from the page script to invoke the backend endpoint tied to this feature.
* Call guide: supply the parameters below, await the returned Promise, and handle loading / error UI in the caller.
* @param uploadId: string caller-supplied value for `uploadId: string`
*/
2026-03-26 11:41:38 +08:00
completeChunkUpload: (uploadId: string) => {
return adminApi.post<ObjectStorageFileVO>('/object-storage-file/upload/complete', { uploadId }) as unknown as Promise<ObjectStorageFileVO>
},
/**
* `cancelChunkUpload` API call. Use this method from the page script to invoke the backend endpoint tied to this feature.
* Call guide: supply the parameters below, await the returned Promise, and handle loading / error UI in the caller.
* @param uploadId: string caller-supplied value for `uploadId: string`
*/
2026-03-26 11:41:38 +08:00
cancelChunkUpload: (uploadId: string) => {
return adminApi.delete<boolean>(`/object-storage-file/upload/${uploadId}`)
},
/**
* `getSignedUrl` API call. Use this method from the page script to invoke the backend endpoint tied to this feature.
* Call guide: supply the parameters below, await the returned Promise, and handle loading / error UI in the caller.
* @param id: IdType caller-supplied value for `id: IdType`
*/
2026-03-27 14:55:41 +08:00
getSignedUrl: (id: IdType) => {
return adminApi.get<string>(`/object-storage-file/get-signed-url/${id}`) as unknown as Promise<string>
}
}
2026-05-23 18:44:57 +08:00
/**
* 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 {
2026-03-27 14:55:41 +08:00
id: IdType
tagName: string
textColor?: string
bgColor?: string
borderColor?: string
sceneGroup?: string
displayName?: string
sortOrder?: number
frontVisible?: number
2026-03-27 14:55:41 +08:00
shopId?: IdType
shopName?: string
type?: number
typeName?: string
createTime: string
updateTime: string
}
/**
* adminTagApi groups all API calls for this page domain.
* Call guide: pass the typed payload or identifier into the method below, and use the returned Promise in the page script.
*/
export const adminTagApi = {
/**
* `listAllTags` API call. Use this method from the page script to invoke the backend endpoint tied to this feature.
* Call guide: supply the parameters below, await the returned Promise, and handle loading / error UI in the caller.
*/
listAllTags: () => {
return adminApi.get<Tag[]>('/tag/list/all') as unknown as Promise<Tag[]>
},
/**
* `listTagsByShopId` API call. Use this method from the page script to invoke the backend endpoint tied to this feature.
* Call guide: supply the parameters below, await the returned Promise, and handle loading / error UI in the caller.
* @param shopId: IdType caller-supplied value for `shopId: IdType`
*/
2026-03-27 14:55:41 +08:00
listTagsByShopId: (shopId: IdType) => {
return adminApi.get<Tag[]>(`/tag/list/by-shop/${shopId}`) as unknown as Promise<Tag[]>
},
/**
* `createTag` API call. Use this method from the page script to invoke the backend endpoint tied to this feature.
* Call guide: supply the parameters below, await the returned Promise, and handle loading / error UI in the caller.
* @param data: { tagName: string; textColor?: string; bgColor?: string; borderColor?: string; shopId?: IdType } caller-supplied value for `data: { tagName: string; textColor?: string; bgColor?: string; borderColor?: string; shopId?: IdType }`
*/
createTag: (data: { tagName: string; textColor?: string; bgColor?: string; borderColor?: string; sceneGroup?: string; displayName?: string; sortOrder?: number; frontVisible?: number; shopId?: IdType }) => {
2026-03-27 14:55:41 +08:00
return adminApi.post<IdType>('/tag/create', data)
},
/**
* `updateTag` API call. Use this method from the page script to invoke the backend endpoint tied to this feature.
* Call guide: supply the parameters below, await the returned Promise, and handle loading / error UI in the caller.
* @param id: IdType caller-supplied value for `id: IdType`
* @param data: { tagName: string; textColor?: string; bgColor?: string; borderColor?: string; shopId?: IdType } caller-supplied value for `data: { tagName: string; textColor?: string; bgColor?: string; borderColor?: string; shopId?: IdType }`
*/
updateTag: (id: IdType, data: { tagName: string; textColor?: string; bgColor?: string; borderColor?: string; sceneGroup?: string; displayName?: string; sortOrder?: number; frontVisible?: number; shopId?: IdType }) => {
return adminApi.put<boolean>(`/tag/update/${id}`, data)
},
/**
* `deleteTag` API call. Use this method from the page script to invoke the backend endpoint tied to this feature.
* Call guide: supply the parameters below, await the returned Promise, and handle loading / error UI in the caller.
* @param id: IdType caller-supplied value for `id: IdType`
*/
2026-03-27 14:55:41 +08:00
deleteTag: (id: IdType) => {
return adminApi.delete<boolean>(`/tag/delete/${id}`)
}
}
2026-05-23 18:44:57 +08:00
/**
* 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 {
2026-03-27 14:55:41 +08:00
id: IdType
nickname: string
account: string
avatar?: string
2026-03-27 14:55:41 +08:00
shopId?: IdType
shopName?: string
createTime: string
updateTime: string
}
/**
* adminArtistApi groups all API calls for this page domain.
* Call guide: pass the typed payload or identifier into the method below, and use the returned Promise in the page script.
*/
export const adminArtistApi = {
/**
* `listArtists` API call. Use this method from the page script to invoke the backend endpoint tied to this feature.
* Call guide: supply the parameters below, await the returned Promise, and handle loading / error UI in the caller.
* @param shopId?: IdType caller-supplied value for `shopId?: IdType`
*/
2026-03-27 14:55:41 +08:00
listArtists: (shopId?: IdType) => {
const params: any = {}
if (shopId) {
params.shopId = shopId
}
return adminApi.get<Artist[]>('/user/list/artists', { params })
}
}
2026-05-23 18:44:57 +08:00
/**
* 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 {
2026-03-27 14:55:41 +08:00
id: IdType
couponCode?: string
couponName: string
couponType: number
couponTypeName?: string
discountValue?: string
minAmount?: number
reduceAmount?: string
totalCount?: number
usedCount?: number
remainingCount?: number
startTime: string
endTime: string
status?: number
statusName?: string
2026-03-27 14:55:41 +08:00
shopId?: IdType
shopName?: string
couponScene?: string
requiredVipLevel?: string
autoMatch?: number
availableTags?: Tag[]
unavailableTags?: Tag[]
createTime: string
updateTime: string
}
/**
* adminCouponApi groups all API calls for this page domain.
* Call guide: pass the typed payload or identifier into the method below, and use the returned Promise in the page script.
*/
export const adminCouponApi = {
/**
* `listAllCoupons` API call. Use this method from the page script to invoke the backend endpoint tied to this feature.
* Call guide: supply the parameters below, await the returned Promise, and handle loading / error UI in the caller.
* @param shopId?: IdType caller-supplied value for `shopId?: IdType`
*/
2026-03-27 14:55:41 +08:00
listAllCoupons: (shopId?: IdType) => {
const params = shopId ? { shopId } : {}
return adminApi.get<Coupon[]>('/coupon/list/all', { params }) as unknown as Promise<Coupon[]>
},
/**
* `createCoupon` API call. Use this method from the page script to invoke the backend endpoint tied to this feature.
* Call guide: supply the parameters below, await the returned Promise, and handle loading / error UI in the caller.
* @param data: any caller-supplied value for `data: any`
*/
createCoupon: (data: any) => {
2026-03-27 14:55:41 +08:00
return adminApi.post<IdType>('/coupon/create', data)
},
/**
* `updateCoupon` API call. Use this method from the page script to invoke the backend endpoint tied to this feature.
* Call guide: supply the parameters below, await the returned Promise, and handle loading / error UI in the caller.
* @param id: IdType caller-supplied value for `id: IdType`
* @param data: any caller-supplied value for `data: any`
*/
2026-03-27 14:55:41 +08:00
updateCoupon: (id: IdType, data: any) => {
return adminApi.put<boolean>(`/coupon/update/${id}`, data)
},
/**
* `deleteCoupon` API call. Use this method from the page script to invoke the backend endpoint tied to this feature.
* Call guide: supply the parameters below, await the returned Promise, and handle loading / error UI in the caller.
* @param id: IdType caller-supplied value for `id: IdType`
*/
2026-03-27 14:55:41 +08:00
deleteCoupon: (id: IdType) => {
return adminApi.delete<boolean>(`/coupon/delete/${id}`)
2026-03-10 23:23:15 +08:00
},
/**
* `distributeCoupon` API call. Use this method from the page script to invoke the backend endpoint tied to this feature.
* Call guide: supply the parameters below, await the returned Promise, and handle loading / error UI in the caller.
* @param data: any caller-supplied value for `data: any`
*/
2026-03-10 23:23:15 +08:00
distributeCoupon: (data: any) => {
return adminApi.post<boolean>('/coupon/distribute', null, { params: data })
2026-02-25 10:37:16 +08:00
}
}
2026-05-23 18:44:57 +08:00
/**
* 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
userNickname?: string
shopId?: IdType
shopName?: string
productId?: IdType
productTitle?: string
commentContent: string
parentCommentId?: IdType
parentCommentContent?: string
createTime?: string
}
/**
* adminCommentApi groups all API calls for this page domain.
* Call guide: pass the typed payload or identifier into the method below, and use the returned Promise in the page script.
*/
export const adminCommentApi = {
/**
* `listComments` API call. Use this method from the page script to invoke the backend endpoint tied to this feature.
* Call guide: supply the parameters below, await the returned Promise, and handle loading / error UI in the caller.
* @param params: { productId?: IdType; userId?: IdType; shopId?: IdType; keyword?: string } caller-supplied value for `params: { productId?: IdType; userId?: IdType; shopId?: IdType; keyword?: string }`
*/
listComments: (params: { productId?: IdType; userId?: IdType; shopId?: IdType; keyword?: string }) => {
return adminApi.get<AdminCommentVO[]>('/comment/list', { params }) as unknown as Promise<AdminCommentVO[]>
},
/**
* `deleteComment` API call. Use this method from the page script to invoke the backend endpoint tied to this feature.
* Call guide: supply the parameters below, await the returned Promise, and handle loading / error UI in the caller.
* @param id: IdType caller-supplied value for `id: IdType`
*/
deleteComment: (id: IdType) => {
return adminApi.delete<boolean>(`/comment/delete/${id}`) as unknown as Promise<boolean>
}
}
2026-05-23 18:44:57 +08:00
/**
* 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.
*/
2026-02-25 14:32:34 +08:00
export interface Product {
2026-03-27 14:55:41 +08:00
id: IdType
shopId: IdType
shopName?: string
2026-02-25 14:32:34 +08:00
title: string
description: string
targetAudience?: string
precautions?: string
2026-02-25 14:32:34 +08:00
price: number
approximateDuration?: string
tags?: string
2026-02-25 14:32:34 +08:00
tagList?: string[]
tagInfos?: any[]
imageFileIds?: string
imageUrls?: string[]
bookableArtists?: string
availableCoupons?: string
frontVisible?: number
sourceType?: string
likeCount?: number
collectCount?: number
2026-02-25 14:32:34 +08:00
createTime: string
updateTime: string
}
/**
* adminProductApi groups all API calls for this page domain.
* Call guide: pass the typed payload or identifier into the method below, and use the returned Promise in the page script.
*/
2026-02-25 14:32:34 +08:00
export const adminProductApi = {
/**
* `listProducts` API call. Use this method from the page script to invoke the backend endpoint tied to this feature.
* Call guide: supply the parameters below, await the returned Promise, and handle loading / error UI in the caller.
* @param params: { page: number; size: number; keyword?: string; shopId?: IdType } caller-supplied value for `params: { page: number; size: number; keyword?: string; shopId?: IdType }`
*/
listProducts: (params: { page: number; size: number; keyword?: string; shopId?: IdType; tagId?: IdType; minPrice?: number; maxPrice?: number; createdFrom?: string; createdTo?: string }) => {
return adminApi.get<{ list: Product[]; total: number; page: number; size: number }>('/product/list', { params })
2026-02-25 14:32:34 +08:00
},
/**
* `listAllProducts` API call. Use this method from the page script to invoke the backend endpoint tied to this feature.
* Call guide: supply the parameters below, await the returned Promise, and handle loading / error UI in the caller.
*/
listAllProducts: () => {
return adminApi.get<Product[]>('/product/list/all')
},
/**
* `createProduct` API call. Use this method from the page script to invoke the backend endpoint tied to this feature.
* Call guide: supply the parameters below, await the returned Promise, and handle loading / error UI in the caller.
* @param data: any caller-supplied value for `data: any`
*/
createProduct: (data: any) => {
2026-03-27 14:55:41 +08:00
return adminApi.post<IdType>('/product/create', data)
2026-02-25 14:32:34 +08:00
},
/**
* `updateProduct` API call. Use this method from the page script to invoke the backend endpoint tied to this feature.
* Call guide: supply the parameters below, await the returned Promise, and handle loading / error UI in the caller.
* @param id: IdType caller-supplied value for `id: IdType`
* @param data: any caller-supplied value for `data: any`
*/
2026-03-27 14:55:41 +08:00
updateProduct: (id: IdType, data: any) => {
2026-02-27 14:20:20 +08:00
return adminApi.put<boolean>(`/product/update/${id}`, data)
2026-02-25 14:32:34 +08:00
},
/**
* `deleteProduct` API call. Use this method from the page script to invoke the backend endpoint tied to this feature.
* Call guide: supply the parameters below, await the returned Promise, and handle loading / error UI in the caller.
* @param id: IdType caller-supplied value for `id: IdType`
*/
2026-03-27 14:55:41 +08:00
deleteProduct: (id: IdType) => {
2026-02-27 14:20:20 +08:00
return adminApi.delete<boolean>(`/product/delete/${id}`)
2026-02-25 14:32:34 +08:00
}
}
2026-05-23 18:44:57 +08:00
/**
* 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.
*/
2026-02-25 14:44:50 +08:00
export interface Shop {
2026-03-27 14:55:41 +08:00
id: IdType
2026-02-25 14:44:50 +08:00
shopName: string
description: string
address: string
mapProvider?: string
longitude?: number | string
latitude?: number | string
2026-02-25 14:44:50 +08:00
businessHours: string
status?: number
coverImageFileId?: string
coverImageUrls?: string[]
imageFileIds?: string
2026-02-26 14:20:35 +08:00
imageUrls?: string[]
themePrimaryColor?: string
themeSecondaryColor?: string
themeAccentColor?: string
themePageBgColor?: string
themeCardBgColor?: string
themeBackgroundImageFileId?: string
authorizationStartDate?: string
authorizationDays?: number
authorizationExpireTime?: string
authorizationExpired?: boolean
authorizationStatusText?: string
2026-02-25 14:44:50 +08:00
createTime: string
updateTime: string
}
2026-05-23 18:44:57 +08:00
/**
* 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.
*/
2026-02-25 14:44:50 +08:00
export interface ShopListResponse {
list: Shop[]
total: number
page: number
size: number
}
2026-05-23 18:44:57 +08:00
/**
* 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.
*/
2026-02-25 14:44:50 +08:00
export interface CreateShopRequest {
shopName: string
description: string
address: string
mapProvider?: string
longitude?: number | string
latitude?: number | string
2026-02-25 14:44:50 +08:00
businessHours: string
coverImageFileId?: string
imageFileIds?: string
themePrimaryColor?: string
themeSecondaryColor?: string
themeAccentColor?: string
themePageBgColor?: string
themeCardBgColor?: string
themeBackgroundImageFileId?: string
status?: number
authorizationStartDate?: string
authorizationDays?: number
authorizationExpireTime?: string
2026-02-25 14:44:50 +08:00
}
/**
* adminShopApi groups all API calls for this page domain.
* Call guide: pass the typed payload or identifier into the method below, and use the returned Promise in the page script.
*/
2026-02-25 14:44:50 +08:00
export const adminShopApi = {
/**
* `listShops` API call. Use this method from the page script to invoke the backend endpoint tied to this feature.
* Call guide: supply the parameters below, await the returned Promise, and handle loading / error UI in the caller.
* @param params: { page: number; size: number; keyword?: string; shopId?: IdType } caller-supplied value for `params: { page: number; size: number; keyword?: string; shopId?: IdType }`
*/
2026-03-27 14:55:41 +08:00
listShops: (params: { page: number; size: number; keyword?: string; shopId?: IdType }) => {
return adminApi.get<ShopListResponse>('/shops/list', { params }) as unknown as Promise<ShopListResponse>
2026-02-25 14:44:50 +08:00
},
/**
* `listAllShops` API call. Use this method from the page script to invoke the backend endpoint tied to this feature.
* Call guide: supply the parameters below, await the returned Promise, and handle loading / error UI in the caller.
*/
listAllShops: () => {
return adminApi.get<Shop[]>('/shops/list/all') as unknown as Promise<Shop[]>
},
/**
* `createShop` API call. Use this method from the page script to invoke the backend endpoint tied to this feature.
* Call guide: supply the parameters below, await the returned Promise, and handle loading / error UI in the caller.
* @param data: CreateShopRequest caller-supplied value for `data: CreateShopRequest`
*/
2026-02-25 14:44:50 +08:00
createShop: (data: CreateShopRequest) => {
2026-03-27 14:55:41 +08:00
return adminApi.post<IdType>('/shops/create', data)
2026-02-25 14:44:50 +08:00
},
/**
* `updateShop` API call. Use this method from the page script to invoke the backend endpoint tied to this feature.
* Call guide: supply the parameters below, await the returned Promise, and handle loading / error UI in the caller.
* @param id: IdType caller-supplied value for `id: IdType`
* @param data: CreateShopRequest caller-supplied value for `data: CreateShopRequest`
*/
2026-03-27 14:55:41 +08:00
updateShop: (id: IdType, data: CreateShopRequest) => {
2026-02-27 14:20:20 +08:00
return adminApi.put<boolean>(`/shops/update/${id}`, data)
2026-02-25 14:44:50 +08:00
},
/**
* `updateShopStatus` API call. Use this method from the page script to invoke the backend endpoint tied to this feature.
* Call guide: supply the parameters below, await the returned Promise, and handle loading / error UI in the caller.
* @param id: IdType caller-supplied value for `id: IdType`
* @param status: number caller-supplied value for `status: number`
*/
2026-03-27 14:55:41 +08:00
updateShopStatus: (id: IdType, status: number) => {
return adminApi.put<boolean>(`/shops/status/${id}`, { status })
2026-02-25 14:44:50 +08:00
}
}
2026-05-23 18:44:57 +08:00
/**
* 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 {
2026-03-27 14:55:41 +08:00
id: IdType
shopId?: IdType
shopName?: string
shopAuthorizationExpireTime?: string
shopAuthorizationExpired?: boolean
2026-03-27 14:55:41 +08:00
shopIds?: IdType[]
shopNames?: string[]
nickname: string
account: string
avatar: string
phone?: string
2026-05-29 13:30:56 +08:00
contactPhone?: string
birthday?: string
wechatId?: string
wechatQrCode?: string
signature?: string
level?: string
type: number
2026-03-27 14:55:41 +08:00
vipId?: IdType
createTime: string
updateTime: string
status?: number
}
2026-05-23 18:44:57 +08:00
/**
* 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
shopName?: string
parentUserId?: IdType
parentUserName?: string
parentRoleType?: number
parentRoleTypeName?: string
sourceType?: string
sourceTypeName?: string
}
2026-05-23 18:44:57 +08:00
/**
* 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
employeeCount: number
managerCount: number
artistCount: number
vipUserCount: number
newUserCount: number
byShop?: Record<string, number>
byRole?: Record<string, number>
byParent?: Record<string, number>
}
2026-05-23 18:44:57 +08:00
/**
* 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
page: number
size: number
}
export interface ArtistScheduleVO {
id: IdType
shopId?: IdType
artistId: IdType
workDate: string
startTime: string
endTime: string
slotMinutes?: number
capacity?: number
status?: number
remark?: string
createTime?: string
}
export interface ArtistScheduleRequest {
shopId?: IdType
artistId?: IdType
workDate?: string
startTime?: string
endTime?: string
slotMinutes?: number
capacity?: number
status?: number
remark?: string
}
export interface ArtistScheduleQuery {
artistId?: IdType
startDate?: string
endDate?: string
}
export interface PaymentOrderVO {
id: IdType
payNo?: string
orderId: IdType
orderNo?: string
userId?: IdType
shopId?: IdType
channel?: string
status?: string
payAmount?: number
paidAmount?: number
payTime?: string
expireTime?: string
remark?: string
}
export interface AfterSaleVO {
id: IdType
afterSaleNo?: string
orderId: IdType
orderItemId?: IdType
userId?: IdType
shopId?: IdType
type?: string
reason?: string
refundAmount?: number
status?: string
auditUserId?: IdType
auditReason?: string
auditTime?: string
refundOrderId?: IdType
createTime?: string
}
export interface AfterSaleAuditRequest {
auditReason?: string
}
export interface AfterSaleQuery {
status?: string
page: number
size: number
}
export interface InventoryItemVO {
id: IdType
shopId?: IdType
category?: string
itemName: string
unit?: string
stockQuantity?: number
warningThreshold?: number
warning?: boolean
status?: number
}
export interface InventoryItemRequest {
shopId?: IdType
category?: string
itemName?: string
unit?: string
stockQuantity?: number
warningThreshold?: number
status?: number
}
export interface InventoryAdjustRequest {
changeType?: string
changeQuantity?: number
remark?: string
}
export interface CampaignVO {
id: IdType
shopId?: IdType
title: string
description?: string
scene?: string
productIds?: string
couponIds?: string
status?: number
startTime?: string
endTime?: string
sortOrder?: number
}
export interface CampaignRequest {
shopId?: IdType
title?: string
description?: string
scene?: string
productIds?: string
couponIds?: string
status?: number
startTime?: string
endTime?: string
sortOrder?: number
}
export interface OperationsAnalyticsVO {
viewCount?: number
favoriteCount?: number
cartCount?: number
orderCount?: number
paidOrderCount?: number
completedOrderCount?: number
reviewCount?: number
rebookCount?: number
totalAmount?: number
}
export const adminArtistScheduleApi = {
listSchedules: (params: ArtistScheduleQuery = {}) => {
return adminApi.get<ArtistScheduleVO[]>('/artist-schedule/list', { params }) as unknown as Promise<ArtistScheduleVO[]>
},
saveSchedule: (data: ArtistScheduleRequest) => {
return adminApi.post<ArtistScheduleVO>('/artist-schedule/save', data) as unknown as Promise<ArtistScheduleVO>
}
}
export const adminPaymentApi = {
manualConfirmOrder: (orderId: IdType, remark?: string) => {
return adminApi.post<PaymentOrderVO>(`/payment/order/${orderId}/manual-confirm`, undefined, {
params: { remark }
}) as unknown as Promise<PaymentOrderVO>
}
}
export const adminAfterSaleApi = {
listAfterSales: (params: AfterSaleQuery) => {
return adminApi.get<PageResult<AfterSaleVO>>('/after-sale/list', { params }) as unknown as Promise<PageResult<AfterSaleVO>>
},
approveAfterSale: (id: IdType, data?: AfterSaleAuditRequest) => {
return adminApi.put<AfterSaleVO>(`/after-sale/${id}/approve`, data || {}) as unknown as Promise<AfterSaleVO>
},
rejectAfterSale: (id: IdType, data?: AfterSaleAuditRequest) => {
return adminApi.put<AfterSaleVO>(`/after-sale/${id}/reject`, data || {}) as unknown as Promise<AfterSaleVO>
}
}
export const adminInventoryApi = {
listItems: (params: { page: number; size: number }) => {
return adminApi.get<PageResult<InventoryItemVO>>('/inventory/list', { params }) as unknown as Promise<PageResult<InventoryItemVO>>
},
saveItem: (data: InventoryItemRequest) => {
return adminApi.post<InventoryItemVO>('/inventory/save', data) as unknown as Promise<InventoryItemVO>
},
adjustStock: (id: IdType, data: InventoryAdjustRequest) => {
return adminApi.post<InventoryItemVO>(`/inventory/${id}/adjust`, data) as unknown as Promise<InventoryItemVO>
}
}
export const adminCampaignApi = {
listCampaigns: (params: { status?: number; page: number; size: number }) => {
return adminApi.get<PageResult<CampaignVO>>('/campaign/list', { params }) as unknown as Promise<PageResult<CampaignVO>>
},
saveCampaign: (data: CampaignRequest) => {
return adminApi.post<CampaignVO>('/campaign/save', data) as unknown as Promise<CampaignVO>
}
}
/**
* adminUserApi groups all API calls for this page domain.
* Call guide: pass the typed payload or identifier into the method below, and use the returned Promise in the page script.
*/
export const adminUserApi = {
// 后台用户列表支持多维筛选;页面侧应优先展示 maskedPhone/maskedEmail,
// 避免在列表中直接暴露完整手机号或邮箱。
/**
* `listUsers` API call. Use this method from the page script to invoke the backend endpoint tied to this feature.
* Call guide: supply the parameters below, await the returned Promise, and handle loading / error UI in the caller.
* @param params: { page: number; size: number; keyword?: string; type?: number; shopId?: IdType; roleId?: IdType; parentUserId?: IdType; sourceType?: string; status?: number; vipLevel?: string; createdFrom?: string; createdTo?: string; hasPhone?: boolean; hasOrder?: boolean } caller-supplied value for `params: { page: number; size: number; keyword?: string; type?: number; shopId?: IdType; roleId?: IdType; parentUserId?: IdType; sourceType?: string; status?: number; vipLevel?: string; createdFrom?: string; createdTo?: string; hasPhone?: boolean; hasOrder?: boolean }`
*/
listUsers: (params: { page: number; size: number; keyword?: string; type?: number; shopId?: IdType; roleId?: IdType; parentUserId?: IdType; sourceType?: string; status?: number; vipLevel?: string; createdFrom?: string; createdTo?: string; hasPhone?: boolean; hasOrder?: boolean }) => {
return adminApi.get<PageResult<UserVO>>('/user/list', { params }) as unknown as Promise<PageResult<UserVO>>
},
/**
* `getUserStatistics` API call. Use this method from the page script to invoke the backend endpoint tied to this feature.
* Call guide: supply the parameters below, await the returned Promise, and handle loading / error UI in the caller.
* @param params: { keyword?: string; type?: number; shopId?: IdType; roleId?: IdType; parentUserId?: IdType; sourceType?: string; status?: number; vipLevel?: string; createdFrom?: string; createdTo?: string; hasPhone?: boolean; hasOrder?: boolean } caller-supplied value for `params: { keyword?: string; type?: number; shopId?: IdType; roleId?: IdType; parentUserId?: IdType; sourceType?: string; status?: number; vipLevel?: string; createdFrom?: string; createdTo?: string; hasPhone?: boolean; hasOrder?: boolean }`
*/
getUserStatistics: (params: { keyword?: string; type?: number; shopId?: IdType; roleId?: IdType; parentUserId?: IdType; sourceType?: string; status?: number; vipLevel?: string; createdFrom?: string; createdTo?: string; hasPhone?: boolean; hasOrder?: boolean }) => {
return adminApi.get<UserStatisticsVO>('/user/statistics', { params }) as unknown as Promise<UserStatisticsVO>
},
/**
* `listAllUsers` API call. Use this method from the page script to invoke the backend endpoint tied to this feature.
* Call guide: supply the parameters below, await the returned Promise, and handle loading / error UI in the caller.
*/
listAllUsers: () => {
return adminApi.get<UserVO[]>('/user/list/all') as unknown as Promise<UserVO[]>
},
/**
* `createUser` API call. Use this method from the page script to invoke the backend endpoint tied to this feature.
* Call guide: supply the parameters below, await the returned Promise, and handle loading / error UI in the caller.
* @param data: any caller-supplied value for `data: any`
*/
createUser: (data: any) => {
2026-03-27 14:55:41 +08:00
return adminApi.post<IdType>('/user/create', data)
},
/**
* `updateUser` API call. Use this method from the page script to invoke the backend endpoint tied to this feature.
* Call guide: supply the parameters below, await the returned Promise, and handle loading / error UI in the caller.
* @param id: IdType caller-supplied value for `id: IdType`
* @param data: any caller-supplied value for `data: any`
*/
2026-03-27 14:55:41 +08:00
updateUser: (id: IdType, data: any) => {
2026-02-27 14:20:20 +08:00
return adminApi.put<boolean>(`/user/update/${id}`, data)
},
/**
* `deleteUser` API call. Use this method from the page script to invoke the backend endpoint tied to this feature.
* Call guide: supply the parameters below, await the returned Promise, and handle loading / error UI in the caller.
* @param id: IdType caller-supplied value for `id: IdType`
*/
2026-03-27 14:55:41 +08:00
deleteUser: (id: IdType) => {
2026-02-27 14:20:20 +08:00
return adminApi.delete<boolean>(`/user/delete/${id}`)
},
/**
* `unbindUser` API call. Use this method from the page script to invoke the backend endpoint tied to this feature.
* Call guide: supply the parameters below, await the returned Promise, and handle loading / error UI in the caller.
* @param id: IdType caller-supplied value for `id: IdType`
*/
2026-03-27 14:55:41 +08:00
unbindUser: (id: IdType) => {
return adminApi.put<boolean>(`/user/unbind/${id}`, {})
},
/**
* `updateUserStatus` API call. Use this method from the page script to invoke the backend endpoint tied to this feature.
* Call guide: supply the parameters below, await the returned Promise, and handle loading / error UI in the caller.
* @param id: IdType caller-supplied value for `id: IdType`
* @param status: number caller-supplied value for `status: number`
*/
2026-03-27 14:55:41 +08:00
updateUserStatus: (id: IdType, status: number) => {
return adminApi.put<boolean>(`/user/status/${id}`, { status })
},
/**
* `getRelationOptions` API call. Use this method from the page script to invoke the backend endpoint tied to this feature.
* Call guide: supply the parameters below, await the returned Promise, and handle loading / error UI in the caller.
* @param shopId?: IdType caller-supplied value for `shopId?: IdType`
*/
getRelationOptions: (shopId?: IdType) => {
return adminApi.get<UserRelationVO[]>(`/user/relation/options`, { params: { shopId } }) as unknown as Promise<UserRelationVO[]>
},
/**
* `updateUserRelation` API call. Use this method from the page script to invoke the backend endpoint tied to this feature.
* Call guide: supply the parameters below, await the returned Promise, and handle loading / error UI in the caller.
* @param id: IdType caller-supplied value for `id: IdType`
* @param data: { shopId?: IdType; parentUserId?: IdType; parentRoleType?: number; sourceType?: string } caller-supplied value for `data: { shopId?: IdType; parentUserId?: IdType; parentRoleType?: number; sourceType?: string }`
*/
updateUserRelation: (id: IdType, data: { shopId?: IdType; parentUserId?: IdType; parentRoleType?: number; sourceType?: string }) => {
return adminApi.put<boolean>(`/user/${id}/relation`, data) as unknown as Promise<boolean>
},
/**
* `resetPassword` API call. Use this method from the page script to invoke the backend endpoint tied to this feature.
* Call guide: supply the parameters below, await the returned Promise, and handle loading / error UI in the caller.
* @param id: IdType caller-supplied value for `id: IdType`
*/
2026-03-27 14:55:41 +08:00
resetPassword: (id: IdType) => {
return adminApi.post<string>(`/user/reset-password/${id}`)
},
/**
* `getUserInfo` API call. Use this method from the page script to invoke the backend endpoint tied to this feature.
* Call guide: supply the parameters below, await the returned Promise, and handle loading / error UI in the caller.
*/
getUserInfo: () => {
return adminApi.get<UserVO>('/user/info') as unknown as Promise<UserVO>
},
/**
* `getUserAsset` API call. Use this method from the page script to invoke the backend endpoint tied to this feature.
* Call guide: supply the parameters below, await the returned Promise, and handle loading / error UI in the caller.
* @param id: IdType caller-supplied value for `id: IdType`
*/
2026-03-27 14:55:41 +08:00
getUserAsset: (id: IdType) => {
return adminApi.get<UserAssetVO>(`/user/${id}/asset`) as unknown as Promise<UserAssetVO>
},
/**
* `getUserBalanceHistory` API call. Use this method from the page script to invoke the backend endpoint tied to this feature.
* Call guide: supply the parameters below, await the returned Promise, and handle loading / error UI in the caller.
* @param id: IdType caller-supplied value for `id: IdType`
*/
2026-03-27 14:55:41 +08:00
getUserBalanceHistory: (id: IdType) => {
return adminApi.get<UserBalanceHistoryItem[]>(`/user/${id}/balance/history`) as unknown as Promise<UserBalanceHistoryItem[]>
},
/**
* `changeUserBalance` API call. Use this method from the page script to invoke the backend endpoint tied to this feature.
* Call guide: supply the parameters below, await the returned Promise, and handle loading / error UI in the caller.
* @param id: IdType caller-supplied value for `id: IdType`
* @param data: AdminUserBalanceChangeRequest caller-supplied value for `data: AdminUserBalanceChangeRequest`
*/
2026-03-27 14:55:41 +08:00
changeUserBalance: (id: IdType, data: AdminUserBalanceChangeRequest) => {
return adminApi.post<UserAssetVO>(`/user/${id}/balance/change`, data) as unknown as Promise<UserAssetVO>
},
/**
* `overrideUserVip` API call. Use this method from the page script to invoke the backend endpoint tied to this feature.
* Call guide: supply the parameters below, await the returned Promise, and handle loading / error UI in the caller.
* @param id: IdType caller-supplied value for `id: IdType`
* @param data: AdminUserVipOverrideRequest caller-supplied value for `data: AdminUserVipOverrideRequest`
*/
2026-03-27 14:55:41 +08:00
overrideUserVip: (id: IdType, data: AdminUserVipOverrideRequest) => {
return adminApi.post<UserAssetVO>(`/user/${id}/vip/override`, data) as unknown as Promise<UserAssetVO>
},
/**
* `recalculateUserVip` API call. Use this method from the page script to invoke the backend endpoint tied to this feature.
* Call guide: supply the parameters below, await the returned Promise, and handle loading / error UI in the caller.
* @param id: IdType caller-supplied value for `id: IdType`
*/
2026-03-27 14:55:41 +08:00
recalculateUserVip: (id: IdType) => {
return adminApi.post<UserAssetVO>(`/user/${id}/vip/recalculate`) as unknown as Promise<UserAssetVO>
}
}
2026-05-23 18:44:57 +08:00
/**
* 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 {
2026-03-27 14:55:41 +08:00
userId: IdType
nickname: string
balance: number
totalRechargeAmount: number
lastRechargeTime?: string
2026-03-27 14:55:41 +08:00
vipInfoId?: IdType
vipLevel: string
2026-03-27 14:55:41 +08:00
benefitId?: IdType
benefitInfo?: string
manualOverride: boolean
vipStartTime?: string
vipExpireTime?: string
}
2026-05-23 18:44:57 +08:00
/**
* 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 {
2026-03-27 14:55:41 +08:00
id: IdType
userId: IdType
userNickname?: string
amount: number
type?: string
currentBalance?: number
beforeBalance?: number
afterBalance?: number
changeScene?: string
2026-03-27 14:55:41 +08:00
relatedOrderId?: IdType
relatedOrderNo?: string
externalOrderNo?: string
2026-03-27 14:55:41 +08:00
operatorId?: IdType
remark?: string
changeTime: string
}
2026-05-23 18:44:57 +08:00
/**
* 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
2026-03-27 14:55:41 +08:00
relatedOrderId?: IdType
externalOrderNo?: string
remark?: string
}
2026-05-23 18:44:57 +08:00
/**
* 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
}
2026-05-23 18:44:57 +08:00
/**
* 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
2026-05-23 18:44:57 +08:00
/**
* 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 {
2026-03-27 14:55:41 +08:00
id: IdType
orderNo: string
2026-03-27 14:55:41 +08:00
userId: IdType
userNickname?: string
2026-03-27 14:55:41 +08:00
shopId: IdType
shopName?: string
2026-03-27 14:55:41 +08:00
artistId?: IdType
artistName?: string
totalAmount: number
actualAmount?: number
discountAmount: number
payAmount: number
paidAmount?: number
paymentStatus?: string
paymentMethod?: string
paymentOrderNo?: string
payTime?: string
refundStatus?: string
2026-06-04 16:39:06 +08:00
customerRemark?: string
quoteStatus?: string
quoteStatusText?: string
quoteUserConfirmed?: boolean
quoteShopConfirmed?: boolean
quoteExpireTime?: string
quoteConfirmedTime?: string
quoteMessages?: any[]
couponName?: string
customerName?: string
customerPhone?: string
customerNickname?: string
customerPhoneMasked?: string
items?: Array<{
id: IdType
productId: IdType
productTitle?: string
artistId?: IdType
artistName?: string
appointmentTime?: string
price: number
2026-06-04 16:39:06 +08:00
referencePrice?: number
quotedPrice?: number
confirmedPrice?: number
quantity: number
}>
status: number
statusText?: string
remark?: string
createTime: string
updateTime: string
}
/**
* adminOrderApi groups all API calls for this page domain.
* Call guide: pass the typed payload or identifier into the method below, and use the returned Promise in the page script.
*/
export const adminOrderApi = {
/**
* `listOrders` API call. Use this method from the page script to invoke the backend endpoint tied to this feature.
* Call guide: supply the parameters below, await the returned Promise, and handle loading / error UI in the caller.
* @param params: { page: number; size: number; keyword?: string; status?: number; shopId?: IdType } caller-supplied value for `params: { page: number; size: number; keyword?: string; status?: number; shopId?: IdType }`
*/
2026-03-27 14:55:41 +08:00
listOrders: (params: { page: number; size: number; keyword?: string; status?: number; shopId?: IdType }) => {
return adminApi.get<PageResult<OrderVO>>('/order/list', { params })
},
/**
* `updateOrderStatus` API call. Use this method from the page script to invoke the backend endpoint tied to this feature.
* Call guide: supply the parameters below, await the returned Promise, and handle loading / error UI in the caller.
* @param id: IdType caller-supplied value for `id: IdType`
* @param status: number caller-supplied value for `status: number`
*/
2026-03-27 14:55:41 +08:00
updateOrderStatus: (id: IdType, status: number) => {
return adminApi.put<boolean>(`/order/update-status/${id}`, {}, { params: { status } })
},
manualConfirmPayment: (id: IdType, remark?: string) => {
return adminPaymentApi.manualConfirmOrder(id, remark)
2026-06-04 16:39:06 +08:00
},
submitQuote: (id: IdType, data: { remark?: string; items: Array<{ orderItemId: IdType; quotedPrice: number }> }) => {
return adminApi.post<OrderVO>(`/order/${id}/quote`, data)
},
confirmQuote: (id: IdType) => {
return adminApi.put<OrderVO>(`/order/${id}/quote/confirm`)
}
}
2026-05-23 18:44:57 +08:00
/**
* 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 {
2026-03-27 14:55:41 +08:00
id: IdType
title: string
price: number
likeCount: number
collectCount: number
}
2026-05-23 18:44:57 +08:00
/**
* 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 {
2026-03-27 14:55:41 +08:00
id: IdType
type: string
title?: string
2026-02-26 17:54:18 +08:00
description: string
time: string
2026-03-10 23:23:15 +08:00
color?: string
2026-02-26 17:54:18 +08:00
}
2026-05-23 18:44:57 +08:00
/**
* 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
totalShops: number
todayOrders: number
totalOrderAmount?: number
todayOrderAmount?: number
weekOrderAmount?: number
totalCustomers?: number
totalArtists?: number
newCustomersToday?: number
newCustomers7Days?: number
newOrders7Days?: number
pendingOrders?: number
completedOrders?: number
hotProducts: HotProductVO[]
recentActivities: RecentActivityVO[]
}
/**
* adminDashboardApi groups all API calls for this page domain.
* Call guide: pass the typed payload or identifier into the method below, and use the returned Promise in the page script.
*/
export const adminDashboardApi = {
/**
* `getStats` API call. Use this method from the page script to invoke the backend endpoint tied to this feature.
* Call guide: supply the parameters below, await the returned Promise, and handle loading / error UI in the caller.
*/
getStats: () => {
return adminApi.get<DashboardStats>('/dashboard/stats')
},
getAnalytics: () => {
return adminApi.get<OperationsAnalyticsVO>('/dashboard/analytics') as unknown as Promise<OperationsAnalyticsVO>
}
}
2026-05-23 18:44:57 +08:00
/**
* 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.
*/
2026-03-04 15:42:43 +08:00
export interface NailArtistInfoVO {
2026-03-27 14:55:41 +08:00
id: IdType
userId: IdType
2026-03-04 15:42:43 +08:00
identity: string
experience: number
skills: string
rating: number
status: number
portfolio: string
moderationStatus?: string
2026-03-04 15:42:43 +08:00
nickname: string
2026-03-27 14:55:41 +08:00
shopId: IdType
2026-03-04 15:42:43 +08:00
shopName: string
userType?: number
userTypeName?: string
participateProduction?: number
workStartTime?: string
workEndTime?: string
2026-03-04 15:42:43 +08:00
}
/**
* adminNailArtistApi groups all API calls for this page domain.
* Call guide: pass the typed payload or identifier into the method below, and use the returned Promise in the page script.
*/
2026-03-04 15:42:43 +08:00
export const adminNailArtistApi = {
/**
* `listNailArtists` API call. Use this method from the page script to invoke the backend endpoint tied to this feature.
* Call guide: supply the parameters below, await the returned Promise, and handle loading / error UI in the caller.
*/
2026-03-04 15:42:43 +08:00
listNailArtists: () => {
return adminApi.get<NailArtistInfoVO[]>('/nail-artist/list') as unknown as Promise<NailArtistInfoVO[]>
2026-03-04 15:42:43 +08:00
},
/**
* `getNailArtistInfo` API call. Use this method from the page script to invoke the backend endpoint tied to this feature.
* Call guide: supply the parameters below, await the returned Promise, and handle loading / error UI in the caller.
* @param userId: IdType caller-supplied value for `userId: IdType`
*/
2026-03-27 14:55:41 +08:00
getNailArtistInfo: (userId: IdType) => {
2026-03-04 15:42:43 +08:00
return adminApi.get<NailArtistInfoVO>(`/nail-artist/get/${userId}`)
},
/**
* `saveNailArtistInfo` API call. Use this method from the page script to invoke the backend endpoint tied to this feature.
* Call guide: supply the parameters below, await the returned Promise, and handle loading / error UI in the caller.
* @param data: any caller-supplied value for `data: any`
*/
2026-03-04 15:42:43 +08:00
saveNailArtistInfo: (data: any) => {
return adminApi.post<NailArtistInfoVO>('/nail-artist/save', data)
}
}
2026-05-23 18:44:57 +08:00
/**
* 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
content: string
imageFileId?: IdType
imageUrl?: string
publisherId: IdType
publisherName?: string
publisherType: number
targetType: string
targetTypeName?: string
targetIds?: IdType[]
popupEnabled: number
status: number
publishTime?: string
createTime?: string
popupShown?: number
readStatus?: number
}
2026-05-23 18:44:57 +08:00
/**
* 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 }>
}
2026-05-23 18:44:57 +08:00
/**
* 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
imageFileId?: IdType
targetType: string
shopIds?: IdType[]
userIds?: IdType[]
popupEnabled?: number
}
/**
* adminSystemMessageApi groups all API calls for this page domain.
* Call guide: pass the typed payload or identifier into the method below, and use the returned Promise in the page script.
*/
export const adminSystemMessageApi = {
// 消息通知会进入用户“消息通知”列表;如果 popupEnabled=1,
// 前端展示弹窗后必须调用 mark popup-shown,保证每人每条只弹一次。
/**
* `listMessages` API call. Use this method from the page script to invoke the backend endpoint tied to this feature.
* Call guide: supply the parameters below, await the returned Promise, and handle loading / error UI in the caller.
*/
listMessages: () => {
return adminApi.get<SystemMessageVO[]>('/system-message/admin/list') as unknown as Promise<SystemMessageVO[]>
},
/**
* `createMessage` API call. Use this method from the page script to invoke the backend endpoint tied to this feature.
* Call guide: supply the parameters below, await the returned Promise, and handle loading / error UI in the caller.
* @param data: SystemMessageCreateRequest caller-supplied value for `data: SystemMessageCreateRequest`
*/
createMessage: (data: SystemMessageCreateRequest) => {
return adminApi.post<IdType>('/system-message/admin/create', data)
},
/**
* `revokeMessage` API call. Use this method from the page script to invoke the backend endpoint tied to this feature.
* Call guide: supply the parameters below, await the returned Promise, and handle loading / error UI in the caller.
* @param id: IdType caller-supplied value for `id: IdType`
*/
revokeMessage: (id: IdType) => {
return adminApi.put<boolean>(`/system-message/admin/${id}/revoke`)
},
/**
* `getTargetOptions` API call. Use this method from the page script to invoke the backend endpoint tied to this feature.
* Call guide: supply the parameters below, await the returned Promise, and handle loading / error UI in the caller.
*/
getTargetOptions: () => {
return adminApi.get<MessageTargetOptionsVO>('/system-message/admin/target-options') as unknown as Promise<MessageTargetOptionsVO>
}
}
2026-05-23 18:44:57 +08:00
/**
* 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
content: string
imageFileIds?: IdType[]
publisherId?: IdType
publisherName?: string
publisherType?: number
targetType: string
targetTypeName?: string
targetIds?: IdType[]
status: number
sortOrder?: number
publishTime?: string
createTime?: string
}
2026-05-23 18:44:57 +08:00
/**
* 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
imageFileIds?: string
targetType: string
shopIds?: IdType[]
userIds?: IdType[]
sortOrder?: number
}
/**
* adminAnnouncementApi groups all API calls for this page domain.
* Call guide: pass the typed payload or identifier into the method below, and use the returned Promise in the page script.
*/
export const adminAnnouncementApi = {
// 公告只在首页顶部滚动显示,不写入消息已读/未读状态。
/**
* `listAnnouncements` API call. Use this method from the page script to invoke the backend endpoint tied to this feature.
* Call guide: supply the parameters below, await the returned Promise, and handle loading / error UI in the caller.
*/
listAnnouncements: () => {
return adminApi.get<AnnouncementVO[]>('/announcement/admin/list') as unknown as Promise<AnnouncementVO[]>
},
/**
* `createAnnouncement` API call. Use this method from the page script to invoke the backend endpoint tied to this feature.
* Call guide: supply the parameters below, await the returned Promise, and handle loading / error UI in the caller.
* @param data: AnnouncementCreateRequest caller-supplied value for `data: AnnouncementCreateRequest`
*/
createAnnouncement: (data: AnnouncementCreateRequest) => {
return adminApi.post<IdType>('/announcement/admin/create', data)
},
/**
* `revokeAnnouncement` API call. Use this method from the page script to invoke the backend endpoint tied to this feature.
* Call guide: supply the parameters below, await the returned Promise, and handle loading / error UI in the caller.
* @param id: IdType caller-supplied value for `id: IdType`
*/
revokeAnnouncement: (id: IdType) => {
return adminApi.put<boolean>(`/announcement/admin/${id}/revoke`)
},
/**
* `getTargetOptions` API call. Use this method from the page script to invoke the backend endpoint tied to this feature.
* Call guide: supply the parameters below, await the returned Promise, and handle loading / error UI in the caller.
*/
getTargetOptions: () => {
return adminApi.get<MessageTargetOptionsVO>('/announcement/admin/target-options') as unknown as Promise<MessageTargetOptionsVO>
}
}
2026-05-23 18:44:57 +08:00
/**
* 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
shopName?: string
title: string
rechargeAmount: number
giftAmount: number
vipLevel: string
description?: string
sortOrder?: number
status: number
createTime?: string
updateTime?: string
}
2026-05-23 18:44:57 +08:00
/**
* 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
rechargeAmount: number
giftAmount: number
vipLevel: string
description?: string
sortOrder?: number
status?: number
}
/**
* adminVipRechargePlanApi groups all API calls for this page domain.
* Call guide: pass the typed payload or identifier into the method below, and use the returned Promise in the page script.
*/
export const adminVipRechargePlanApi = {
/**
* `listPlans` API call. Use this method from the page script to invoke the backend endpoint tied to this feature.
* Call guide: supply the parameters below, await the returned Promise, and handle loading / error UI in the caller.
* @param shopId?: IdType caller-supplied value for `shopId?: IdType`
*/
listPlans: (shopId?: IdType) => {
const params = shopId ? { shopId } : {}
return adminApi.get<VipRechargePlanVO[]>('/vip-recharge-plan/admin/list', { params }) as unknown as Promise<VipRechargePlanVO[]>
},
/**
* `createPlan` API call. Use this method from the page script to invoke the backend endpoint tied to this feature.
* Call guide: supply the parameters below, await the returned Promise, and handle loading / error UI in the caller.
* @param data: VipRechargePlanRequest caller-supplied value for `data: VipRechargePlanRequest`
*/
createPlan: (data: VipRechargePlanRequest) => {
return adminApi.post<IdType>('/vip-recharge-plan/admin/create', data)
},
/**
* `updatePlan` API call. Use this method from the page script to invoke the backend endpoint tied to this feature.
* Call guide: supply the parameters below, await the returned Promise, and handle loading / error UI in the caller.
* @param id: IdType caller-supplied value for `id: IdType`
* @param data: VipRechargePlanRequest caller-supplied value for `data: VipRechargePlanRequest`
*/
updatePlan: (id: IdType, data: VipRechargePlanRequest) => {
return adminApi.put<boolean>(`/vip-recharge-plan/admin/${id}`, data)
},
/**
* `updateStatus` API call. Use this method from the page script to invoke the backend endpoint tied to this feature.
* Call guide: supply the parameters below, await the returned Promise, and handle loading / error UI in the caller.
* @param id: IdType caller-supplied value for `id: IdType`
* @param status: number caller-supplied value for `status: number`
*/
updateStatus: (id: IdType, status: number) => {
return adminApi.put<boolean>(`/vip-recharge-plan/admin/${id}/status`, null, { params: { status } })
},
/**
* `listVipLevelOptions` API call. Use this method from the page script to invoke the backend endpoint tied to this feature.
* Call guide: supply the parameters below, await the returned Promise, and handle loading / error UI in the caller.
* @param shopId?: IdType caller-supplied value for `shopId?: IdType`
*/
listVipLevelOptions: (shopId?: IdType) => {
const params = shopId ? { shopId } : {}
return adminApi.get<string[]>('/vip-recharge-plan/admin/vip-level-options', { params }) as unknown as Promise<string[]>
}
}
2026-05-23 18:44:57 +08:00
/**
* 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
sceneName: string
platform: string
msgType: string
queueName: string
sourceSystem: string
templateCode: string
channelId?: IdType
sendMethod?: string
enabled: number
remark?: string
createTime?: string
updateTime?: string
}
2026-05-23 18:44:57 +08:00
/**
* 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
platform: string
msgType: string
queueName: string
sourceSystem: string
templateCode: string
channelId?: IdType
sendMethod?: string
enabled?: number
remark?: string
}
/**
* adminMessageHubPushConfigApi groups all API calls for this page domain.
* Call guide: pass the typed payload or identifier into the method below, and use the returned Promise in the page script.
*/
export const adminMessageHubPushConfigApi = {
/**
* `listConfigs` API call. Use this method from the page script to invoke the backend endpoint tied to this feature.
* Call guide: supply the parameters below, await the returned Promise, and handle loading / error UI in the caller.
*/
listConfigs: () => {
return adminApi.get<MessageHubPushConfigVO[]>('/messagehub-push-config/admin/list') as unknown as Promise<MessageHubPushConfigVO[]>
},
/**
* `createConfig` API call. Use this method from the page script to invoke the backend endpoint tied to this feature.
* Call guide: supply the parameters below, await the returned Promise, and handle loading / error UI in the caller.
* @param data: MessageHubPushConfigRequest caller-supplied value for `data: MessageHubPushConfigRequest`
*/
createConfig: (data: MessageHubPushConfigRequest) => {
return adminApi.post<IdType>('/messagehub-push-config/admin/create', data)
},
/**
* `updateConfig` API call. Use this method from the page script to invoke the backend endpoint tied to this feature.
* Call guide: supply the parameters below, await the returned Promise, and handle loading / error UI in the caller.
* @param id: IdType caller-supplied value for `id: IdType`
* @param data: MessageHubPushConfigRequest caller-supplied value for `data: MessageHubPushConfigRequest`
*/
updateConfig: (id: IdType, data: MessageHubPushConfigRequest) => {
return adminApi.put<boolean>(`/messagehub-push-config/admin/${id}`, data)
},
/**
* `updateStatus` API call. Use this method from the page script to invoke the backend endpoint tied to this feature.
* Call guide: supply the parameters below, await the returned Promise, and handle loading / error UI in the caller.
* @param id: IdType caller-supplied value for `id: IdType`
* @param enabled: number caller-supplied value for `enabled: number`
*/
updateStatus: (id: IdType, enabled: number) => {
return adminApi.put<boolean>(`/messagehub-push-config/admin/${id}/status`, null, { params: { enabled } })
},
/**
* `testConfig` API call. Use this method from the page script to invoke the backend endpoint tied to this feature.
* Call guide: supply the parameters below, await the returned Promise, and handle loading / error UI in the caller.
* @param id: IdType caller-supplied value for `id: IdType`
* @param phone: string caller-supplied value for `phone: string`
*/
testConfig: (id: IdType, phone: string) => {
return adminApi.post<boolean>(`/messagehub-push-config/admin/${id}/test`, { phone })
}
}
2026-05-23 18:44:57 +08:00
/**
* 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
configKey: string
configName: string
configValue: string
enabled: number
remark?: string
createTime?: string
updateTime?: string
}
2026-05-29 13:30:56 +08:00
export interface AdminDefaultPasswordResponse {
password: string
}
2026-05-23 18:44:57 +08:00
/**
* 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[]>
},
saveConfig: (data: SystemParameterConfigVO) => {
return adminApi.post<boolean>('/system-parameter-config/admin/save', data)
},
getTencentMapKey: () => {
return adminApi.get<{ key: string }>('/system-parameter-config/admin/tencent-map') as unknown as Promise<{ key: string }>
},
getMapConfig: () => {
return adminApi.get<{ provider: 'TENCENT' | 'AMAP'; tencentWebKey?: string; amapWebKey?: string; amapMiniKey?: string }>('/system-parameter-config/admin/map-config') as unknown as Promise<{ provider: 'TENCENT' | 'AMAP'; tencentWebKey?: string; amapWebKey?: string; amapMiniKey?: string }>
2026-05-29 13:30:56 +08:00
},
getUserDefaultPassword: () => {
return adminApi.get<AdminDefaultPasswordResponse>('/system-parameter-config/admin/user-default-password') as unknown as Promise<AdminDefaultPasswordResponse>
}
}
2026-09-07 12:09:42 +08:00
export interface WorkbenchRegistrationApplication {
id: IdType
applicationNo: string
userId: IdType
roleType: 'MANAGER' | 'STAFF'
shopId?: IdType
shopName?: string
shopAddress?: string
status: 'PENDING_ADMIN' | 'PENDING_MANAGER' | 'APPROVED' | 'REJECTED'
rejectReason?: string
createTime?: string
updateTime?: string
applicantNickname?: string
applicantAvatar?: string
applicantMaskedPhone?: string
2026-09-07 12:09:42 +08:00
}
export const adminWorkbenchRegistrationApi = {
list() {
return adminApi.get<WorkbenchRegistrationApplication[]>('/user/workbench/registration/list') as unknown as Promise<WorkbenchRegistrationApplication[]>
},
approve(id: IdType) {
return adminApi.post<boolean>(`/user/workbench/registration/${id}/approve`)
},
reject(id: IdType, reason: string) {
return adminApi.post<boolean>(`/user/workbench/registration/${id}/reject`, { reason })
}
}
2026-10-22 00:27:12 +08:00
export interface AccountClosureRequestVO {
id: IdType
userId: IdType
nickname: string
userType?: number
shopIds?: IdType[]
shopNames?: string[]
status: string
requestedAt?: string
processingTargetText?: string
processedAt?: string
reviewerNote?: string
}
export interface ClosureSuccessorManagerVO {
id: IdType
nickname?: string
shopId?: IdType
}
export interface ContentModerationRecordVO {
id: IdType
contentType: string
businessId?: IdType
authorName?: string
2026-10-22 00:27:12 +08:00
status: string
resultCode?: string
reason?: string
textPreview?: string
images?: Array<{ fileId: IdType; url?: string; status?: string }>
2026-10-22 00:27:12 +08:00
attemptCount?: number
createTime?: string
}
export interface PhoneBackfillReportVO {
dryRun: boolean
userRowsToUpdate: number
orderRowsToUpdate: number
userRowsUpdated: number
orderRowsUpdated: number
accountConflictRows: number
phoneConflictRows: number
conflictingUserIds: IdType[]
}
export const adminPrivacyComplianceApi = {
listClosures() {
return adminApi.get<AccountClosureRequestVO[]>('/privacy/account-closure/pending') as unknown as Promise<AccountClosureRequestVO[]>
},
listSuccessorManagers() {
return adminApi.get<ClosureSuccessorManagerVO[]>('/privacy/account-closure/successor-managers') as unknown as Promise<ClosureSuccessorManagerVO[]>
},
processClosure(id: IdType, data: { decision: string; successorManagerId?: IdType; archiveShopIds?: IdType[]; note?: string }) {
return adminApi.post<boolean>(`/privacy/account-closure/${id}/process`, data)
},
listModeration() {
return adminApi.get<ContentModerationRecordVO[]>('/privacy/content-moderation/pending') as unknown as Promise<ContentModerationRecordVO[]>
},
reviewContent(id: IdType, data: { approved: boolean; reason: string }) {
return adminApi.post<boolean>(`/privacy/content-moderation/${id}/review`, data)
},
phoneBackfillReport() {
return adminApi.get<PhoneBackfillReportVO>('/privacy/phone-backfill/report') as unknown as Promise<PhoneBackfillReportVO>
},
runPhoneBackfill() {
return adminApi.post<PhoneBackfillReportVO>('/privacy/phone-backfill/run') as unknown as Promise<PhoneBackfillReportVO>
}
}
export { adminApi }
2026-02-27 11:05:15 +08:00
export default adminApi