2026-04-21 22:07:29 +08:00
|
|
|
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
|
2026-04-28 16:08:07 +08:00
|
|
|
config?: string | null
|
2026-04-21 22:07:29 +08:00
|
|
|
createdAt: string
|
|
|
|
|
}
|
|
|
|
|
|
2026-04-29 12:33:26 +08:00
|
|
|
export interface ImServiceConfig {
|
|
|
|
|
allowStrangerMessage: boolean
|
|
|
|
|
allowFriendRequest: boolean
|
|
|
|
|
friendRequestMode: 'REQUIRE_CONFIRM' | 'DIRECT_ACCEPT' | 'DISALLOW'
|
|
|
|
|
allowGroupJoinRequest: boolean
|
|
|
|
|
blacklistSendSuccess: boolean
|
|
|
|
|
messageRecallMinutes: number
|
|
|
|
|
historyRetentionDays: number
|
|
|
|
|
conversationPullLimit: number
|
|
|
|
|
multiClientConversationDeleteSync: boolean
|
|
|
|
|
}
|
|
|
|
|
|
2026-04-29 17:35:52 +08:00
|
|
|
export interface UpdateServiceConfig {
|
|
|
|
|
defaultStoreTargets?: string[]
|
|
|
|
|
defaultPublishMode?: 'MANUAL' | 'NOW' | 'SCHEDULED' | 'AUTO_REVIEW'
|
|
|
|
|
defaultPublishImmediately?: boolean
|
|
|
|
|
defaultScheduledPublishAt?: string
|
|
|
|
|
defaultAutoPublishAfterReview?: boolean
|
|
|
|
|
defaultWebhookUrl?: string
|
|
|
|
|
defaultForceUpdate?: boolean
|
|
|
|
|
defaultGrayEnabled?: boolean
|
|
|
|
|
defaultGrayPercent?: number
|
|
|
|
|
defaultPackageName?: string
|
|
|
|
|
defaultAppStoreUrl?: string
|
|
|
|
|
defaultMarketUrl?: string
|
|
|
|
|
}
|
|
|
|
|
|
2026-04-21 22:07:29 +08:00
|
|
|
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`),
|
|
|
|
|
|
2026-04-29 17:35:52 +08:00
|
|
|
getService: (appId: string, platform: string, serviceType: string) =>
|
|
|
|
|
client.get<{ data: FeatureService }>(`/apps/${appId}/services/item`, {
|
|
|
|
|
params: { platform, serviceType },
|
|
|
|
|
}),
|
|
|
|
|
|
2026-04-21 22:07:29 +08:00
|
|
|
toggleService: (appId: string, platform: string, serviceType: string, enable: boolean) =>
|
|
|
|
|
client.post<{ data: FeatureService }>(`/apps/${appId}/services/toggle`, null, {
|
|
|
|
|
params: { platform, serviceType, enable },
|
|
|
|
|
}),
|
|
|
|
|
|
2026-04-29 12:33:26 +08:00
|
|
|
updateServiceConfig: (
|
|
|
|
|
appId: string,
|
|
|
|
|
platform: string,
|
|
|
|
|
serviceType: string,
|
2026-04-29 17:35:52 +08:00
|
|
|
config: Partial<ImServiceConfig> & Partial<UpdateServiceConfig>,
|
2026-04-29 12:33:26 +08:00
|
|
|
) =>
|
|
|
|
|
client.put<{ data: FeatureService }>(`/apps/${appId}/services/config`, config, {
|
|
|
|
|
params: { platform, serviceType },
|
2026-04-28 16:08:07 +08:00
|
|
|
}),
|
|
|
|
|
|
2026-04-24 20:54:03 +08:00
|
|
|
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 }),
|
2026-04-21 22:07:29 +08:00
|
|
|
}
|