diff --git a/app/command/admin/Worker.php b/app/command/admin/Worker.php index d68a2bc..f88dfc2 100644 --- a/app/command/admin/Worker.php +++ b/app/command/admin/Worker.php @@ -87,17 +87,19 @@ class Worker extends Command 'client_name'=> $connection->clientName, 'user_id' => $connection->userId, ])->find(); - $client->update(['is_lock'=>1,'lock_password'=>$lock_password,'lock_time'=>date('Y-m-d H:i:s')]); - // 锁定屏幕 - $connection->send(json_encode(['event'=>'LOCK_CLIENT_SCREEN'])); + if($client) { + $client->save(['is_lock'=>1,'lock_password'=>$lock_password,'lock_time'=>date('Y-m-d H:i:s')]); + // 锁定屏幕 + $connection->send(json_encode(['event'=>'LOCK_CLIENT_SCREEN'])); - SysUserClientLog::create([ - 'event' => 'UNLOCK', - 'message'=> "A. 锁定客户端", - 'data' => json_encode(['inputPass'=> $lock_password]), - 'create_time' => date('Y-m-d H:i:s'), - 'client_data_id'=> $client['id'] - ]); + SysUserClientLog::create([ + 'event' => 'UNLOCK', + 'message'=> "A. 锁定客户端", + 'data' => json_encode(['inputPass'=> $lock_password]), + 'create_time' => date('Y-m-d H:i:s'), + 'client_data_id'=> $client['id'] + ]); + } } } }