$data = json_decode($result, true); file_put_contents("1.txt", $result . "\n", FILE_APPEND); $msgType = $data[msgType]; $content = $data[content]; $seq = (int) $data[seq]; $lightStatus = $data[lightStatus]; $irStatus = $data[irStatus]; $devId = $data[devId]; } echo "test"; die; //发送查询设备id,如果不存在则在数据库里面进行注册 if ($msgType == "queryDevId") { $retDevId = "retDevId"; //查询数据库,获取返回的设备ID $devId = (int) querysql($chipId); // echo $devId; // die; if (empty($devId)) { //将值写入数据库 $devId = (int) insertsql($chipId, $devType); } //返回json数据 $data = json_encode(array('msgType' => $retDevId, 'seq' => $seq, 'devId' => $devId)); echo $data; die; } //发送设备状态更新信息 if ($msgType == "updateData") { $retUpdateData = "retUpdateData"; $notify = "no";
$userPassword = $data[password]; $msgType = $data[msgType]; $content = $data[content]; $seq = $data[seq]; $lightStatus = $data[lightStatus]; $irStatus = $data[irStatus]; //echo $msgType; echo $result; //echo $data die; //发送查询设备id,如果不存在则在数据库里面进行注册 if ($msgType == "queryDevId") { $chipId = $data[chipId]; $retDevId = "retDevId"; //查询数据库,获取返回的设备ID $devId = querysql($chipId); // echo $devId; // die; if (empty($devId)) { //将值写入数据库 $devId = insertsql($chipId); } //返回json数据 $data = json_encode(array('msgType' => $retDevId, 'seq' => $seq, 'devId' => $devId)); echo $data; die; } //发送设备状态更新信息 if ($msgType == "updateData") { $retUpdateData = "retUpdateData"; $notify = "no";