含 AI 助手、抖音 OAuth、流量池推送、支付获客、SuperAdmin 设备与场景管理等本地迭代;以本地为准单向推送,未拉取远程。 Co-authored-by: Cursor <cursoragent@cursor.com>
64 lines
1.6 KiB
TypeScript
64 lines
1.6 KiB
TypeScript
import { apiRequest, ApiResponse } from './api-utils';
|
|
|
|
export interface DashboardSummary {
|
|
projectTotal: number;
|
|
projectActive: number;
|
|
projectDisabled: number;
|
|
deviceTotal: number;
|
|
deviceOnline: number;
|
|
deviceOffline: number;
|
|
customerTotal: number;
|
|
s2BoundProjects: number;
|
|
s2UnboundProjects: number;
|
|
}
|
|
|
|
export interface ProjectOverviewRow {
|
|
id: number;
|
|
companyId: number;
|
|
name: string;
|
|
status: number;
|
|
account: string;
|
|
phone: string;
|
|
s2Bound: boolean;
|
|
s2_accountId: string;
|
|
deviceCount: number;
|
|
deviceOnline: number;
|
|
customerCount: number;
|
|
subUserCount: number;
|
|
health: 'ok' | 'warn' | 'error';
|
|
createTime: string;
|
|
}
|
|
|
|
export async function getDashboardOverview(
|
|
page = 1,
|
|
limit = 10,
|
|
keyword = ''
|
|
): Promise<
|
|
ApiResponse<{
|
|
summary: DashboardSummary;
|
|
projects: { list: ProjectOverviewRow[]; total: number; page: number; limit: number };
|
|
}>
|
|
> {
|
|
const params = new URLSearchParams({ page: String(page), limit: String(limit) });
|
|
if (keyword) params.append('keyword', keyword);
|
|
return apiRequest(`/dashboard/overview?${params.toString()}`);
|
|
}
|
|
|
|
export async function getUnifiedAccounts(projectId: number): Promise<ApiResponse<any>> {
|
|
return apiRequest(`/company/accounts/${projectId}`);
|
|
}
|
|
|
|
export async function saveUnifiedAccounts(payload: {
|
|
projectId: number;
|
|
scope: 'master' | 'sub';
|
|
userId?: number;
|
|
account?: string;
|
|
username?: string;
|
|
phone?: string;
|
|
password?: string;
|
|
status?: number;
|
|
typeId?: number;
|
|
}): Promise<ApiResponse<any>> {
|
|
return apiRequest('/company/accounts/save', 'POST', payload);
|
|
}
|