up. ws update.
This commit is contained in:
parent
b14fcbf06d
commit
25988682cc
@ -68,8 +68,9 @@ class Worker extends Command
|
|||||||
// 绑定成功通知
|
// 绑定成功通知
|
||||||
$connection->send(json_encode(['event'=>'BIND_USER_SUCCESS','userId'=>$auth->userId]));
|
$connection->send(json_encode(['event'=>'BIND_USER_SUCCESS','userId'=>$auth->userId]));
|
||||||
$client = SysUserClient::where([
|
$client = SysUserClient::where([
|
||||||
'client_id' => $connection->clientId,
|
'client_id' => $clientId,
|
||||||
'client_name'=> $connection->clientName
|
'client_name'=> $clientName,
|
||||||
|
'user_id' => $connection->userId,
|
||||||
])->find();
|
])->find();
|
||||||
if($client && $client['is_lock']) {
|
if($client && $client['is_lock']) {
|
||||||
// 锁定屏幕
|
// 锁定屏幕
|
||||||
@ -82,7 +83,8 @@ class Worker extends Command
|
|||||||
var_dump("锁定客户端/通知全部ws触发锁定操作");
|
var_dump("锁定客户端/通知全部ws触发锁定操作");
|
||||||
SysUserClient::where([
|
SysUserClient::where([
|
||||||
'client_id' => $connection->clientId,
|
'client_id' => $connection->clientId,
|
||||||
'client_name'=> $connection->clientName
|
'client_name'=> $connection->clientName,
|
||||||
|
'user_id' => $connection->userId,
|
||||||
])->update(['is_lock'=>1,'lock_password'=>$lock_password,'lock_time'=>date('Y-m-d H:i:s')]);
|
])->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']));
|
$connection->send(json_encode(['event'=>'LOCK_CLIENT_SCREEN']));
|
||||||
|
|||||||
@ -4,6 +4,7 @@ namespace app\controller\admin\auth;
|
|||||||
|
|
||||||
use app\BaseController;
|
use app\BaseController;
|
||||||
use app\entity\SysUser;
|
use app\entity\SysUser;
|
||||||
|
use app\entity\SysUserClient;
|
||||||
use app\enum\UserLoginEnum;
|
use app\enum\UserLoginEnum;
|
||||||
use app\service\admin\LoginService;
|
use app\service\admin\LoginService;
|
||||||
use think\db\exception\DataNotFoundException;
|
use think\db\exception\DataNotFoundException;
|
||||||
@ -41,4 +42,24 @@ class AuthController extends BaseController
|
|||||||
$srv->logout($this->request, $this->auth->getUser());
|
$srv->logout($this->request, $this->auth->getUser());
|
||||||
return $this->writeSuccess('退出成功');
|
return $this->writeSuccess('退出成功');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function unlock()
|
||||||
|
{
|
||||||
|
$client = $this->request->getClient();
|
||||||
|
$lock_password = $this->request->post('lock_password');
|
||||||
|
$clientModel = SysUserClient::where([
|
||||||
|
'client_id' => $client->id,
|
||||||
|
'client_name'=> $client->name,
|
||||||
|
'user_id' => $this->auth->userId,
|
||||||
|
])->find();
|
||||||
|
if($clientModel) {
|
||||||
|
if($clientModel['lock_password'] !== $lock_password) {
|
||||||
|
return $this->writeSuccess('密码错误');
|
||||||
|
}
|
||||||
|
$clientModel->save(['is_lock'=>0,'lock_password'=>'','lock_time'=>null]);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
return $this->writeSuccess('解锁成功');
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -55,6 +55,7 @@ Route::group("adminapi", function () {
|
|||||||
Route::group("auth", function () {
|
Route::group("auth", function () {
|
||||||
Route::post("logout", [auth\AuthController::class, "logout"])->name("admin.SysUserLogout");
|
Route::post("logout", [auth\AuthController::class, "logout"])->name("admin.SysUserLogout");
|
||||||
Route::get("user", [auth\AuthController::class, "user"])->name("admin.SysUserInfo");
|
Route::get("user", [auth\AuthController::class, "user"])->name("admin.SysUserInfo");
|
||||||
|
Route::post("unlock", [auth\AuthController::class, "unlock"])->name("admin.SysClientUnlock");
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
<template>
|
<template>
|
||||||
<ele-modal
|
<ele-modal
|
||||||
title="安全锁定"
|
title="设备已被锁定"
|
||||||
:width="480"
|
:width="480"
|
||||||
v-model="visible"
|
v-model="visible"
|
||||||
:modal-penetrable="false"
|
:modal-penetrable="false"
|
||||||
@ -12,7 +12,22 @@
|
|||||||
:show-close="false"
|
:show-close="false"
|
||||||
:fullscreen="true"
|
:fullscreen="true"
|
||||||
>
|
>
|
||||||
屏幕已锁定
|
<div style="text-align: center">
|
||||||
|
<h1>请输入锁屏密码进行解锁</h1>
|
||||||
|
</div>
|
||||||
|
<div style="margin-top: 10%">
|
||||||
|
<el-input
|
||||||
|
type="password"
|
||||||
|
v-model="lockPassword"
|
||||||
|
size="large"
|
||||||
|
placeholder="请输入密码解锁"
|
||||||
|
/>
|
||||||
|
<div style="margin-top: 20px">
|
||||||
|
<el-button class="ele-fluid" type="primary" @click="confirmUnlock"
|
||||||
|
>解锁客户端</el-button
|
||||||
|
>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
</ele-modal>
|
</ele-modal>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
@ -21,9 +36,9 @@
|
|||||||
import { WsEvent, wsEventManager } from '@/plugins/websocket';
|
import { WsEvent, wsEventManager } from '@/plugins/websocket';
|
||||||
|
|
||||||
const visible = ref(false);
|
const visible = ref(false);
|
||||||
|
const lockPassword = ref('');
|
||||||
|
const confirmUnlock = () => {};
|
||||||
wsEventManager.subscribe(WsEvent.LOCK_CLIENT_SCREEN, () => {
|
wsEventManager.subscribe(WsEvent.LOCK_CLIENT_SCREEN, () => {
|
||||||
console.log("LOCK_CLIENT_SCREEN->")
|
|
||||||
visible.value = true;
|
visible.value = true;
|
||||||
});
|
});
|
||||||
</script>
|
</script>
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user