WsController.php 937 B

12345678910111213141516171819202122232425262728293031323334353637383940
  1. <?php
  2. /**
  3. * User: admin
  4. * Date Time: 2021/5/8 20:26
  5. */
  6. namespace hd\controllers;
  7. use bizGhs\ws\services\WsService;
  8. use common\components\util;
  9. use Yii;
  10. use GatewayClient\Gateway;
  11. class WsController extends BaseController
  12. {
  13. //绑定用户
  14. public function actionBind()
  15. {
  16. $post = Yii::$app->request->post();
  17. $clientId = isset($post['clientId']) ? $post['clientId'] : '';
  18. $shopAdminId = $this->shopAdminId;
  19. Gateway::bindUid($clientId, $shopAdminId);
  20. util::complete();
  21. }
  22. //关闭当前链接
  23. public function actionClose()
  24. {
  25. $post = Yii::$app->request->post();
  26. $clientId = isset($post['clientId']) ? $post['clientId'] : '';
  27. Gateway::closeClient($clientId);
  28. }
  29. //模拟推送ws (仅供测试联调用)
  30. public function actionSend()
  31. {
  32. WsService::arrivalNotice($this->shopAdminId,9866.29);
  33. util::complete();
  34. }
  35. }