|
@@ -115,13 +115,13 @@ $ws_worker->onWorkerStart = function($ws_worker)
|
|
|
unset($devList[$k]);
|
|
|
continue;
|
|
|
}else{
|
|
|
- $data = ['code'=>'9999','status'=>2,'msg'=>'No firmware file found, please contact your administrator','data'=>['type'=>'devUpdate','id'=>$v['lamp_id'],'status'=>2]];
|
|
|
+ $data = ['code'=>'9999','status'=>2,'msg'=>'No firmware file found, please contact your administrator','data'=>['type'=>'updateDev','id'=>$v['lamp_id'],'status'=>2]];
|
|
|
}
|
|
|
}else{
|
|
|
- $data = ['code'=>'9999','status'=>2,'msg'=>'Device not bound to manufacturer','data'=>['type'=>'devUpdate','id'=>$v['lamp_id'],'status'=>2]];
|
|
|
+ $data = ['code'=>'9999','status'=>2,'msg'=>'Device not bound to manufacturer','data'=>['type'=>'updateDev','id'=>$v['lamp_id'],'status'=>2]];
|
|
|
}
|
|
|
}else{
|
|
|
- $data = ['code'=>'9999','status'=>2,'msg'=>'Device does not exist','data'=>['type'=>'devUpdate','id'=>$v['lamp_id'],'status'=>2]];
|
|
|
+ $data = ['code'=>'9999','status'=>2,'msg'=>'Device does not exist','data'=>['type'=>'updateDev','id'=>$v['lamp_id'],'status'=>2]];
|
|
|
}
|
|
|
$client->send(json_encode($data));
|
|
|
unset($devList[$k]);
|
|
@@ -139,20 +139,20 @@ $ws_worker->onWorkerStart = function($ws_worker)
|
|
|
foreach ($temp as $k => $v) {
|
|
|
if ($v['type'] == 0) { // 升级指令还没返回
|
|
|
if (time() - $v['time'] > 10) { // 指令超时
|
|
|
- $data = ['code'=>'9999','status'=>2,'msg'=>'The command is timed out, please try again later','data'=>['type'=>'devUpdate','id'=>$v['lamp_id'],'status'=>2]];
|
|
|
+ $data = ['code'=>'9999','status'=>2,'msg'=>'The command is timed out, please try again later','data'=>['type'=>'updateDev','id'=>$v['lamp_id'],'status'=>2]];
|
|
|
unset($devUpdateList[$k]);
|
|
|
}
|
|
|
}elseif ($v['type'] == 1) { // 升级中
|
|
|
if (time() - $v['time'] > 60 * 5) { // 指令超时
|
|
|
- $data = ['code'=>'9999','status'=>2,'msg'=>'Please try again later. Please upgrade the device','data'=>['type'=>'devUpdate','id'=>$v['lamp_id'],'status'=>2]];
|
|
|
+ $data = ['code'=>'9999','status'=>2,'msg'=>'Please try again later. Please upgrade the device','data'=>['type'=>'updateDev','id'=>$v['lamp_id'],'status'=>2]];
|
|
|
unset($devUpdateList[$k]);
|
|
|
}else{
|
|
|
if ($devUpdateList[$k]['step'] < 95) $devUpdateList[$k]['step'] += 1;
|
|
|
|
|
|
- $data = ['code'=>'0000','status'=>2,'msg'=>'Successful operation','data'=>['type'=>'devUpdate','id'=>$v['lamp_id'],'step'=>$v['step'],'status'=>2]];
|
|
|
+ $data = ['code'=>'0000','status'=>2,'msg'=>'Successful operation','data'=>['type'=>'updateDev','id'=>$v['lamp_id'],'step'=>$v['step'],'status'=>2]];
|
|
|
}
|
|
|
}elseif ($v['type'] == 2) { // 升级成功
|
|
|
- $data = ['code'=>'0000','status'=>2,'msg'=>'Successful operation','data'=>['type'=>'devUpdate','id'=>$v['lamp_id'],'step'=>100,'status'=>2]];
|
|
|
+ $data = ['code'=>'0000','status'=>2,'msg'=>'Successful operation','data'=>['type'=>'updateDev','id'=>$v['lamp_id'],'step'=>100,'status'=>2]];
|
|
|
unset($devUpdateList[$k]);
|
|
|
}
|
|
|
$v['client']->send(json_encode($data));
|