| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970 |
- /**
- * 设备管理相关API
- */
- import { get, post, put } from '@/utils/request';
- export interface DeviceQueryParams {
- page?: number;
- pageSize?: number;
- deviceId?: string;
- shopId?: number;
- status?: number;
- storeName?: string;
- }
- export interface DeviceListResponse {
- list: any[];
- total: number;
- page: number;
- pageSize: number;
- }
- /**
- * 获取设备列表
- */
- export async function getDeviceList(params: DeviceQueryParams = {}): Promise<DeviceListResponse> {
- return get('/devices/list', params);
- }
- /**
- * 获取设备详情
- */
- export async function getDeviceDetail(deviceId: number): Promise<any> {
- return get(`/devices/${deviceId}`);
- }
- /**
- * 获取设备统计数据
- */
- export async function getDeviceStats(): Promise<any> {
- return get('/devices/statistics');
- }
- /**
- * 远程开门
- */
- export async function openDeviceDoor(deviceId: number, doorIndex?: string): Promise<void> {
- await post(`/devices/${deviceId}/open`, { doorIndex: doorIndex || 'A' });
- }
- /**
- * 设置设备温度
- */
- export async function setDeviceTemperature(deviceId: number, temperature: number): Promise<void> {
- await put(`/devices/${deviceId}/temperature`, { temperature });
- }
- /**
- * 设置设备音量
- */
- export async function setDeviceVolume(deviceId: number, volume: number): Promise<void> {
- await put(`/devices/${deviceId}/volume`, { volume });
- }
- /**
- * 获取设备门记录
- */
- export async function getDeviceDoorRecords(deviceId: string, params: { page?: number; pageSize?: number } = {}): Promise<any> {
- return get(`/devices/${deviceId}/door-records`, params);
- }
|