|
|
@@ -0,0 +1,27 @@
|
|
|
+<?php
|
|
|
+
|
|
|
+// websocket相关
|
|
|
+namespace ghs\controllers;
|
|
|
+
|
|
|
+use Yii;
|
|
|
+use GatewayClient\Gateway;
|
|
|
+class WsController extends BaseController
|
|
|
+{
|
|
|
+
|
|
|
+ //绑定用户
|
|
|
+ public function actionBind()
|
|
|
+ {
|
|
|
+ $post = Yii::$app->request->post();
|
|
|
+ $clientId = isset($post['clientId']) ? $post['clientId'] : '';
|
|
|
+ $adminId = $this->adminId;
|
|
|
+ Gateway::bindUid($clientId, $adminId);
|
|
|
+ }
|
|
|
+
|
|
|
+ //关闭当前链接
|
|
|
+ public function actionClose()
|
|
|
+ {
|
|
|
+ $post = Yii::$app->request->post();
|
|
|
+ $clientId = isset($post['clientId']) ? $post['clientId'] : '';
|
|
|
+ Gateway::closeClient($clientId);
|
|
|
+ }
|
|
|
+}
|