diff --git a/tenant-platform/src/api/push.ts b/tenant-platform/src/api/push.ts new file mode 100644 index 0000000..6223e79 --- /dev/null +++ b/tenant-platform/src/api/push.ts @@ -0,0 +1,80 @@ +import client from '@/api/client' + +export interface DeviceInfo { + id: string + vendor: string + tokenPreview: string + platform: string | null + deviceId: string | null + brand: string | null + model: string | null + osVersion: string | null + appVersion: string | null + receivePush: boolean + lastLoginAt: string | null + updatedAt: string | null +} + +export interface UserPushStatus { + tokenType: string + appId: string + userId: string + online: boolean + lastSeenAt: number + canSendOfflineMessage: boolean + deliverableDevice: DeviceInfo | null + deliverableDevices: DeviceInfo[] + devices: DeviceInfo[] +} + +export interface DeviceLoginLog { + id: string + appId: string + userId: string + vendor: string + deviceId: string | null + brand: string | null + model: string | null + platform: string | null + osVersion: string | null + appVersion: string | null + createdAt: string +} + +export interface PagedLogs { + content: DeviceLoginLog[] + total: number + totalPages: number +} + +export interface TestPushResult { + appId: string + userId: string + sent: boolean + targetCount: number + targets: DeviceInfo[] +} + +export const pushAdminApi = { + getUserStatus(appId: string, userId: string) { + return client.get<{ data: UserPushStatus }>('/push/admin/user-status', { + params: { appId, userId }, + }) + }, + + getDeviceLogs(appId: string, userId: string, page = 0, size = 20) { + return client.get<{ data: PagedLogs }>('/push/admin/device-logs', { + params: { appId, userId, page, size }, + }) + }, + + testOffline(appId: string, userId: string, title: string, body: string, payload?: string) { + return client.post<{ data: TestPushResult }>('/push/admin/test-offline', { + appId, + userId, + title, + body, + payload: payload ?? null, + }) + }, +} diff --git a/tenant-platform/src/router/index.ts b/tenant-platform/src/router/index.ts index 90a7c05..f56f990 100644 --- a/tenant-platform/src/router/index.ts +++ b/tenant-platform/src/router/index.ts @@ -57,6 +57,10 @@ const router = createRouter({ path: 'apps/:appId/push-config', component: () => import('@/views/push/PushConfigView.vue'), }, + { + path: 'apps/:appId/push-management', + component: () => import('@/views/push/PushManagementView.vue'), + }, { path: 'apps/:appId/im-webhooks', component: () => import('@/views/im/ImWebhookView.vue'), diff --git a/tenant-platform/src/views/apps/AppDetailView.vue b/tenant-platform/src/views/apps/AppDetailView.vue index 3c69d8b..49121b3 100644 --- a/tenant-platform/src/views/apps/AppDetailView.vue +++ b/tenant-platform/src/views/apps/AppDetailView.vue @@ -77,9 +77,14 @@
- - 推送配置 → - + 申请开通 diff --git a/tenant-platform/src/views/push/PushManagementView.vue b/tenant-platform/src/views/push/PushManagementView.vue new file mode 100644 index 0000000..576831d --- /dev/null +++ b/tenant-platform/src/views/push/PushManagementView.vue @@ -0,0 +1,234 @@ + + + diff --git a/tenant-platform/vite.config.ts b/tenant-platform/vite.config.ts index 53f5cbb..96e3425 100644 --- a/tenant-platform/vite.config.ts +++ b/tenant-platform/vite.config.ts @@ -42,6 +42,10 @@ export default defineConfig(({ mode }) => { server: { port: 5173, proxy: { + '/api/push': { + target: 'http://127.0.0.1:8083', + changeOrigin: true, + }, '/api': { target: 'http://127.0.0.1:8081', changeOrigin: true,