/** * 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. */ import axios, { AxiosError, type AxiosProgressEvent } from 'axios' import { message } from 'ant-design-vue' import { ADMIN_API_BASE_URL } from '../config/api' import type { IdType } from '@/utils/id' 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: 60000, headers: { 'Content-Type': 'application/json' } }) /** * 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) { prom.reject(error) } else { prom.resolve(token) } }) 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 } const authHeader = request?.headers?.Authorization || request?.headers?.authorization if (typeof authHeader !== 'string') { return null } 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) { lastErrorTime = now lastErrorMessage = msg message.error(msg) } } /** * 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 } clearAdminSessionStorage() if (Date.now() - lastErrorTime > ERROR_DEBOUNCE_TIME || lastErrorMessage !== '登录已过期,请重新登录') { showError('登录已过期,请重新登录') } setTimeout(() => { window.location.href = '/admin/login' }, 300) } adminApi.interceptors.request.use( async config => { let token: string | null = null if (!isAuthFreePath(config.url)) { token = getStoredAdminAccessToken() if (token) { config.headers.Authorization = `Bearer ${token}` } } ;(config as any)._authToken = token || null return attachRequestSignature(config, token, { authFree: isAuthFreePath(config.url) }) }, error => Promise.reject(error) ) adminApi.interceptors.response.use( response => { const res = response.data if (res.code !== 200) { const errorMsg = res.message || '请求失败' if (!errorMsg.includes('权限') && !errorMsg.includes('permission')) { showError(errorMsg) } else { console.error('权限不足:', errorMsg) } return Promise.reject(new Error(errorMsg)) } return res.data as any }, async (error: AxiosError) => { const originalRequest = error.config as any if (error.response?.status === 401) { 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) }) } 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) handleAdminTokenExpired(requestToken) return Promise.reject(refreshError) } finally { isRefreshing = false } } handleAdminTokenExpired(requestToken) } else if (error.response?.status !== 403) { const errorMsg = (error.response?.data as any)?.message || error.message || '请求失败' showError(errorMsg) } else { console.error('权限不足:', error) } 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)) } console.error('Admin API Error:', error) return Promise.reject(error) } ) /** * 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 } /** * 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 } export interface AdminPasswordChangeRequest { currentPassword: string newPassword: string } /** * 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. */ /** * 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 } /** * 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. */ 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` */ login: (data: AdminLoginRequest) => { return adminApi.post('/auth/login', data) }, /** * `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('/auth/logout') }, /** * `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 }) }, changePassword: (data: AdminPasswordChangeRequest) => { return adminApi.post('/auth/password', data) } } /** * 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('/legal-agreement/list'), create: (data: LegalAgreementAdminRequest) => adminApi.post('/legal-agreement/create', data), update: (id: IdType, data: LegalAgreementAdminRequest) => adminApi.put(`/legal-agreement/${id}`, data), publish: (id: IdType) => adminApi.put(`/legal-agreement/${id}/publish`), disable: (id: IdType) => adminApi.put(`/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 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 } /** * 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 contentType: string fileFingerprint: string 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 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('/object-storage-file/upload', formData, { headers: { 'Content-Type': 'multipart/form-data' } }) as unknown as Promise }, /** * `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` */ initChunkUpload: (data: ChunkUploadInitRequest) => { return adminApi.post('/object-storage-file/upload/init', data) as unknown as Promise }, 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 } ) => { 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('/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 }) }, /** * `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` */ completeChunkUpload: (uploadId: string) => { return adminApi.post('/object-storage-file/upload/complete', { uploadId }) as unknown as Promise }, /** * `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` */ cancelChunkUpload: (uploadId: string) => { return adminApi.delete(`/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` */ getSignedUrl: (id: IdType) => { return adminApi.get(`/object-storage-file/get-signed-url/${id}`) as unknown as Promise } } /** * 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 textColor?: string bgColor?: string borderColor?: string sceneGroup?: string displayName?: string sortOrder?: number frontVisible?: number 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/list/all') as unknown as Promise }, /** * `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` */ listTagsByShopId: (shopId: IdType) => { return adminApi.get(`/tag/list/by-shop/${shopId}`) as unknown as Promise }, /** * `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 }) => { return adminApi.post('/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(`/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` */ deleteTag: (id: IdType) => { return adminApi.delete(`/tag/delete/${id}`) } } /** * 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 account: string avatar?: string 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` */ listArtists: (shopId?: IdType) => { const params: any = {} if (shopId) { params.shopId = shopId } return adminApi.get('/user/list/artists', { params }) } } /** * 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('/comment/list', { params }) as unknown as Promise }, /** * `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(`/comment/delete/${id}`) as unknown as Promise } } /** * 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 shopName?: string title: string description: string targetAudience?: string precautions?: string price: number approximateDuration?: string tags?: string tagList?: string[] tagInfos?: any[] imageFileIds?: string imageUrls?: string[] bookableArtists?: string frontVisible?: number sourceType?: string 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. */ 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 }) }, /** * `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/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) => { return adminApi.post('/product/create', data) }, /** * `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` */ updateProduct: (id: IdType, data: any) => { return adminApi.put(`/product/update/${id}`, data) }, /** * `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` */ deleteProduct: (id: IdType) => { return adminApi.delete(`/product/delete/${id}`) } } /** * 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 description: string address: string mapProvider?: string longitude?: number | string latitude?: number | string businessHours: string status?: number coverImageFileId?: string coverImageUrls?: string[] imageFileIds?: string imageUrls?: string[] themePrimaryColor?: string themeSecondaryColor?: string themeAccentColor?: string themePageBgColor?: string themeCardBgColor?: string themeBackgroundImageFileId?: string authorizationStartDate?: string authorizationDays?: number authorizationExpireTime?: string authorizationExpired?: boolean authorizationStatusText?: string businessExpireTime?: string businessExpired?: boolean businessRemainingDays?: number createTime: string 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 page: number size: number } export interface ShopBusinessExpiry { shopId: IdType businessExpireTime?: string businessExpired?: boolean businessRemainingDays?: 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 address: string mapProvider?: string longitude?: number | string latitude?: number | string 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 } /** * 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. */ 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 }` */ listShops: (params: { page: number; size: number; keyword?: string; shopId?: IdType }) => { return adminApi.get('/shops/list', { params }) as unknown as Promise }, /** * `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('/shops/list/all') as unknown as Promise }, listBusinessExpiries: (shopIds: IdType[]) => { return adminApi.get('/shops/business-expiries', { params: { shopIds: shopIds.join(',') } }) as unknown as Promise }, updateBusinessExpiry: (id: IdType, expireDate: string) => { return adminApi.put(`/shops/${id}/business-expiry`, { expireDate }) }, /** * `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` */ createShop: (data: CreateShopRequest) => { return adminApi.post('/shops/create', data) }, /** * `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` */ updateShop: (id: IdType, data: CreateShopRequest) => { return adminApi.put(`/shops/update/${id}`, data) }, /** * `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` */ updateShopStatus: (id: IdType, status: number) => { return adminApi.put(`/shops/status/${id}`, { status }) } } /** * 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 shopName?: string shopAuthorizationExpireTime?: string shopAuthorizationExpired?: boolean shopIds?: IdType[] shopNames?: string[] nickname: string account: string avatar: string phone?: string contactPhone?: string birthday?: string wechatId?: string wechatQrCode?: string signature?: string level?: string type: number vipId?: IdType createTime: string updateTime: string 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 shopName?: string parentUserId?: IdType parentUserName?: string parentRoleType?: number parentRoleTypeName?: string sourceType?: string 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 employeeCount: number managerCount: number artistCount: number vipUserCount: number newUserCount: number byShop?: Record byRole?: Record byParent?: Record } /** * 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 { 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 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 SalonDashboardOverviewVO { date: string degraded?: boolean degradedMessage?: string platform: { activeShopCount: number activeManagerCount: number activeStaffCount: number customerCount: number styleCount: number } today: { appointmentCount: number serviceInProgressCount: number completedServiceCount: number orderAmount: number pendingOrderCount: number } attention: { registrationReviewCount: number contentReviewCount: number afterSaleCount: number artistChangeCount: number lowStockCount: number } trend: Array<{ date: string; appointmentCount: number; completedCount: number; amount: number }> shopRanking: Array<{ shopId: IdType; shopName: string; appointmentCount: number; completedCount: number; amount: number }> } export const adminArtistScheduleApi = { listSchedules: (params: ArtistScheduleQuery = {}) => { return adminApi.get('/artist-schedule/list', { params }) as unknown as Promise }, saveSchedule: (data: ArtistScheduleRequest) => { return adminApi.post('/artist-schedule/save', data) as unknown as Promise } } export const adminAfterSaleApi = { listAfterSales: (params: AfterSaleQuery) => { return adminApi.get>('/after-sale/list', { params }) as unknown as Promise> }, approveAfterSale: (id: IdType, data?: AfterSaleAuditRequest) => { return adminApi.put(`/after-sale/${id}/approve`, data || {}) as unknown as Promise }, rejectAfterSale: (id: IdType, data?: AfterSaleAuditRequest) => { return adminApi.put(`/after-sale/${id}/reject`, data || {}) as unknown as Promise } } export const adminInventoryApi = { listItems: (params: { page: number; size: number }) => { return adminApi.get>('/inventory/list', { params }) as unknown as Promise> }, saveItem: (data: InventoryItemRequest) => { return adminApi.post('/inventory/save', data) as unknown as Promise }, adjustStock: (id: IdType, data: InventoryAdjustRequest) => { return adminApi.post(`/inventory/${id}/adjust`, data) as unknown as Promise } } /** * 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>('/user/list', { params }) as unknown as Promise> }, /** * `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('/user/statistics', { params }) as unknown as Promise }, /** * `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('/user/list/all') as unknown as Promise }, /** * `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) => { return adminApi.post('/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` */ updateUser: (id: IdType, data: any) => { return adminApi.put(`/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` */ deleteUser: (id: IdType) => { return adminApi.delete(`/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` */ unbindUser: (id: IdType) => { return adminApi.put(`/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` */ updateUserStatus: (id: IdType, status: number) => { return adminApi.put(`/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(`/user/relation/options`, { params: { shopId } }) as unknown as Promise }, /** * `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(`/user/${id}/relation`, data) as unknown as Promise }, /** * `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` */ resetPassword: (id: IdType) => { return adminApi.post(`/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('/user/info') as unknown as Promise }, } /** * 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 userId: IdType userNickname?: string shopId: IdType shopName?: string artistId?: IdType artistName?: string totalAmount: number actualAmount?: number discountAmount: number payAmount: number paidAmount?: number paymentStatus?: string paymentMethod?: string paymentOrderNo?: string payTime?: string refundStatus?: string 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 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 }` */ listOrders: (params: { page: number; size: number; keyword?: string; status?: number; shopId?: IdType }) => { return adminApi.get>('/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` */ updateOrderStatus: (id: IdType, status: number) => { return adminApi.put(`/order/update-status/${id}`, {}, { params: { status } }) }, submitQuote: (id: IdType, data: { remark?: string; items: Array<{ orderItemId: IdType; quotedPrice: number }> }) => { return adminApi.post(`/order/${id}/quote`, data) }, confirmQuote: (id: IdType) => { return adminApi.put(`/order/${id}/quote/confirm`) } } /** * 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 = { getOverview: (params?: { date?: string; days?: 7 | 30 }) => { return adminApi.get('/dashboard/overview', { params }) as unknown as Promise } } /** * 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 identity: string experience: number skills: string rating: number status: number portfolio: string moderationStatus?: string nickname: string shopId: IdType shopName: string userType?: number userTypeName?: string participateProduction?: number workStartTime?: string workEndTime?: string } /** * 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. */ 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. */ listNailArtists: () => { return adminApi.get('/nail-artist/list') as unknown as Promise }, /** * `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` */ getNailArtistInfo: (userId: IdType) => { return adminApi.get(`/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` */ saveNailArtistInfo: (data: any) => { return adminApi.post('/nail-artist/save', data) } } /** * 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 } /** * 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 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('/system-message/admin/list') as unknown as Promise }, /** * `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('/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(`/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('/system-message/admin/target-options') as unknown as Promise } } /** * 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 } /** * 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('/announcement/admin/list') as unknown as Promise }, /** * `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('/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(`/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('/announcement/admin/target-options') as unknown as Promise } } /** * 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 } /** * 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('/messagehub-push-config/admin/list') as unknown as Promise }, /** * `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('/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(`/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(`/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(`/messagehub-push-config/admin/${id}/test`, { phone }) } } /** * 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 } export interface AdminDefaultPasswordResponse { password: string } export interface SecureIntegrationConfigVO { mapProvider: 'TENCENT' | 'AMAP' mapEnabled: boolean tencentWebKeyConfigured: boolean amapWebKeyConfigured: boolean amapMiniKeyConfigured: boolean mapLegacyMigrationPending: boolean moderationProvider: 'DISABLED' | 'MOCK' | 'WECHAT' moderationCallbackUrl: string moderationCallbackTokenConfigured: boolean moderationEncodingAesKeyConfigured: boolean moderationCallbackReady: boolean moderationReady: boolean wechatMiniAppConfigured: boolean wechatMiniAppId: string mockProviderAllowed: boolean encryptionKeyConfigured: boolean updatedAt?: string } export interface SecureIntegrationConfigUpdate { mapProvider?: 'TENCENT' | 'AMAP' mapEnabled?: boolean tencentWebKey?: string amapWebKey?: string amapMiniKey?: string clearTencentWebKey?: boolean clearAmapWebKey?: boolean clearAmapMiniKey?: boolean moderationProvider?: 'DISABLED' | 'MOCK' | 'WECHAT' moderationCallbackUrl?: string moderationCallbackToken?: string moderationEncodingAesKey?: string clearModerationCallbackToken?: boolean clearModerationEncodingAesKey?: boolean } /** * 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('/system-parameter-config/admin/list', { params: { configGroup } }) as unknown as Promise }, saveConfig: (data: SystemParameterConfigVO) => { return adminApi.post('/system-parameter-config/admin/save', data) }, getUserDefaultPassword: () => { return adminApi.get('/system-parameter-config/admin/user-default-password') as unknown as Promise } } export const adminSecureIntegrationConfigApi = { getConfig: () => adminApi.get('/system-settings/secure-integration') as unknown as Promise, getMapRuntimeConfig: () => adminApi.get<{ provider: 'TENCENT' | 'AMAP'; enabled: string; key: string }>('/system-settings/secure-integration/map-runtime') as unknown as Promise<{ provider: 'TENCENT' | 'AMAP'; enabled: string; key: string }>, saveMapConfig: (data: SecureIntegrationConfigUpdate) => adminApi.post('/system-settings/secure-integration/map', data) as unknown as Promise, saveModerationConfig: (data: SecureIntegrationConfigUpdate) => adminApi.post('/system-settings/secure-integration/content-moderation', data) as unknown as Promise } 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 contentModerationStatus?: string contentModerationReason?: string } export const adminWorkbenchRegistrationApi = { list() { return adminApi.get('/user/workbench/registration/list') as unknown as Promise }, approve(id: IdType) { return adminApi.post(`/user/workbench/registration/${id}/approve`) }, reject(id: IdType, reason: string) { return adminApi.post(`/user/workbench/registration/${id}/reject`, { reason }) } } 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 status: string resultCode?: string reason?: string textPreview?: string images?: Array<{ fileId: IdType; url?: string; status?: string }> 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('/privacy/account-closure/pending') as unknown as Promise }, listSuccessorManagers() { return adminApi.get('/privacy/account-closure/successor-managers') as unknown as Promise }, processClosure(id: IdType, data: { decision: string; successorManagerId?: IdType; archiveShopIds?: IdType[]; note?: string }) { return adminApi.post(`/privacy/account-closure/${id}/process`, data) }, listModeration() { return adminApi.get('/privacy/content-moderation/pending') as unknown as Promise }, reviewContent(id: IdType, data: { approved: boolean; reason: string }) { return adminApi.post(`/privacy/content-moderation/${id}/review`, data) }, phoneBackfillReport() { return adminApi.get('/privacy/phone-backfill/report') as unknown as Promise }, runPhoneBackfill() { return adminApi.post('/privacy/phone-backfill/run') as unknown as Promise } } export { adminApi } export default adminApi