队列优化

This commit is contained in:
Ghost
2025-04-01 09:26:06 +08:00
parent dfe73f9a22
commit 23fcc47d55
10 changed files with 274 additions and 55 deletions

View File

@@ -14,12 +14,16 @@ class DeviceController extends BaseController
* 获取设备列表
* @return \think\response\Json
*/
public function getlist($pageIndex = '',$pageSize = '',$authorization = '')
public function getlist($pageIndex = '',$pageSize = '',$authorization = '',$isJob = false)
{
// 获取授权token
$authorization = !empty($authorization) ? $authorization : trim($this->request->header('authorization', ''));
if (empty($authorization)) {
return errorJson('缺少授权信息');
if($isJob){
return json_encode(['code'=>500,'msg'=>'缺少授权信息']);
}else{
return errorJson('缺少授权信息');
}
}
try {
@@ -61,9 +65,17 @@ class DeviceController extends BaseController
}
}
return successJson($response);
if($isJob){
return json_encode(['code'=>200,'msg'=>'success','data'=>$response]);
}else{
return successJson($response);
}
} catch (\Exception $e) {
return errorJson('获取设备列表失败:' . $e->getMessage());
if($isJob){
return json_encode(['code'=>500,'msg'=>'获取设备列表失败:' . $e->getMessage()]);
}else{
return errorJson('获取设备列表失败:' . $e->getMessage());
}
}
}