XuqmGroup-Web/tenant-platform/src/api/app.ts
XuqmGroup 662df6e090 feat(sample): 添加示例应用的核心功能模块
- 实现环境配置管理,支持外部和本地主机模式切换
- 集成Demo API接口,包含登录、注册、文件上传等功能
- 构建附件处理仓库,支持图片、视频、音频和文件发送
- 开发认证仓库,管理用户会话和IM令牌刷新机制
- 添加语音录制功能,支持实时音频消息录制
- 创建依赖注入容器,统一管理应用组件实例
- 实现登录界面,提供用户认证交互功能
- 开发聊天界面,集成消息收发和媒体处理功能
2026-04-28 16:08:07 +08:00

67 行
2.0 KiB
TypeScript

import client from './client'
export interface App {
id: string
tenantId: string
packageName: string
name: string
description?: string
iconUrl?: string
appKey: string
appSecret: string
createdAt: string
}
export interface CreateAppRequest {
packageName: string
name: string
description?: string
iconUrl?: string
}
export interface FeatureService {
id: string
appId: string
platform: 'ANDROID' | 'IOS' | 'HARMONY'
serviceType: 'IM' | 'PUSH' | 'UPDATE'
enabled: boolean
config?: string | null
createdAt: string
}
export const appApi = {
list: () => client.get<{ data: App[] }>('/apps'),
get: (id: string) => client.get<{ data: App }>(`/apps/${id}`),
create: (data: CreateAppRequest) => client.post<{ data: App }>('/apps', data),
update: (id: string, data: CreateAppRequest) => client.put<{ data: App }>(`/apps/${id}`, data),
delete: (id: string) => client.delete(`/apps/${id}`),
getServices: (appId: string) =>
client.get<{ data: FeatureService[] }>(`/apps/${appId}/services`),
toggleService: (appId: string, platform: string, serviceType: string, enable: boolean) =>
client.post<{ data: FeatureService }>(`/apps/${appId}/services/toggle`, null, {
params: { platform, serviceType, enable },
}),
updateServiceConfig: (appId: string, platform: string, serviceType: string, allowStrangerMessage: boolean) =>
client.put<{ data: FeatureService }>(`/apps/${appId}/services/config`, null, {
params: { platform, serviceType, allowStrangerMessage },
}),
requestSecretVerify: (appId: string, purpose: 'REVEAL_SECRET' | 'RESET_SECRET') =>
client.post<{ data: null }>(`/apps/${appId}/request-secret-verify`, null, {
params: { purpose },
}),
revealSecret: (appId: string, code: string) =>
client.post<{ data: { appSecret: string } }>(`/apps/${appId}/reveal-secret`, { code }),
resetSecret: (appId: string, code: string) =>
client.post<{ data: { appSecret: string } }>(`/apps/${appId}/reset-secret`, { code }),
}