feat(M08-D): 补设备运营后台

This commit is contained in:
Codex
2026-08-10 12:27:05 +08:00
parent 7c5f55cccf
commit 5c9fd697f3
6 changed files with 304 additions and 2 deletions
+38
View File
@@ -5,6 +5,8 @@ import type {
CleaningTask,
CleaningTaskEvent,
CleaningTaskMember,
DeviceTopology,
DeviceType,
BusinessStatistics,
ManagedRoom,
MemberCard,
@@ -381,6 +383,42 @@ export function getMember(session: ApiSession, memberId: string) {
return request<MemberDetail>(session, `/members/${encodeURIComponent(memberId)}`);
}
export function getDeviceTopology(session: ApiSession, storeId: string) {
return request<DeviceTopology>(session, `/device-topology?${new URLSearchParams({ storeId })}`);
}
export function createDeviceAsset(session: ApiSession, input: {
storeId: string; roomId: string | null; deviceId: string; imei: string; iccid: string | null;
deviceType: DeviceType; model: string; firmwareVersion: string;
signalStrength: number | null; capabilities: string[];
}) {
return request<{ assetId: string }>(session, '/devices', { method: 'POST', body: JSON.stringify(input) });
}
export function bindDeviceChannel(session: ApiSession, input: {
assetId: string; storeId: string; roomId: string; channelCode: string; purpose: string;
}) {
return request<{ assetId: string; targetKey: string }>(session, '/device-channels', { method: 'POST', body: JSON.stringify(input) });
}
export function bindSubDevice(session: ApiSession, input: {
parentAssetId: string; childAssetId: string; storeId: string; roomId: string;
subId: string; subtype: string;
}) {
return request<{ childAssetId: string; parentAssetId: string }>(session, '/device-links', { method: 'POST', body: JSON.stringify(input) });
}
export function addDeviceMaintenance(session: ApiSession, assetId: string, input: {
storeId: string; roomId: string | null; recordType: 'INSPECTION' | 'REPAIR' | 'REPLACEMENT';
status: 'OPEN' | 'RESOLVED'; description: string;
}) {
return request<{ maintenanceId: string }>(session, `/devices/${encodeURIComponent(assetId)}/maintenance`, { method: 'POST', body: JSON.stringify(input) });
}
export function controlDevice(session: ApiSession, action: 'door' | 'power' | 'socket/switch', input: Record<string, unknown>) {
return request<{ commandId?: string; status?: string }>(session, `/device-control/${action}`, { method: 'POST', body: JSON.stringify(input) });
}
export function createStaffUser(
session: ApiSession,
input: { nickname: string; phone: string; note?: string; roles: StaffRole[]; storeIds: string[] }