config['api_id'], 'cache-control:no-cache', 'Content-Type:application/json', 'datetime:' . time(), 'token:' . $token, ]; // 请求数据 $data = [ 'device_id' => $device_id ]; // 发送请求 $result = $this->httpPData($this->url . 'v1/Index/findDeviceStatus', $data, $header); // 记录日志 $uid = defined('UID') ? UID : ''; platformLog($data, $result, 'zixishi_tuya_find_device_status_' . $uid); return $result; } /** * 控制设备 * @param string $device_id 设备ID * @param string $token * @date 2022-11-24 */ public function controlDevice($device_id, $commands, $token) { // header $header = [ 'appid:' . $this->config['api_id'], 'cache-control:no-cache', 'Content-Type:application/json', 'datetime:' . time(), 'token:' . $token ]; // 请求数据 $data = [ 'device_id' => $device_id, 'commands' => $commands ]; // 发送请求 $result = $this->httpPData($this->url . 'v1/Index/controlDevice', $data, $header); // 记录日志 $uid = defined('UID') ? UID : ''; platformLog($data, $result, 'zixishi_tuya_control_device_uid_' . $uid); return $result; } }