/** * 设备管理相关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 { return get('/devices/list', params); } /** * 获取设备详情 */ export async function getDeviceDetail(deviceId: number): Promise { return get(`/devices/${deviceId}`); } /** * 获取设备统计数据 */ export async function getDeviceStats(): Promise { return get('/devices/statistics'); } /** * 远程开门 */ export async function openDeviceDoor(deviceId: number, doorIndex?: string): Promise { await post(`/devices/${deviceId}/open`, { doorIndex: doorIndex || 'A' }); } /** * 设置设备温度 */ export async function setDeviceTemperature(deviceId: number, temperature: number): Promise { await put(`/devices/${deviceId}/temperature`, { temperature }); } /** * 设置设备音量 */ export async function setDeviceVolume(deviceId: number, volume: number): Promise { await put(`/devices/${deviceId}/volume`, { volume }); } /** * 获取设备门记录 */ export async function getDeviceDoorRecords(deviceId: string, params: { page?: number; pageSize?: number } = {}): Promise { return get(`/devices/${deviceId}/door-records`, params); }