MainController.php 978 B

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  1. <?php
  2. namespace shop\controllers;
  3. use Yii;
  4. use GatewayClient\Gateway;
  5. class MainController extends BaseController
  6. {
  7. public function actionDemo()
  8. {
  9. return $this->renderPartial('demo');
  10. }
  11. public function actionIndex()
  12. {
  13. return $this->renderPartial('index');
  14. }
  15. //新客户 shish 2019.12.29
  16. public function actionVisit()
  17. {
  18. $data = json_encode(array(
  19. 'type' => 'msg',
  20. 'msg' => 'aaaa',
  21. ));
  22. $id = 'merchantConsole_' . $this->merchantId;
  23. $online = Gateway::getClientIdByUid($id);
  24. if ($online) {
  25. //直接发送
  26. Gateway::sendToUid($id, json_encode($data));
  27. } else {
  28. //保存
  29. }
  30. }
  31. //新订单 shish 2019.12.29
  32. public function actionOrder()
  33. {
  34. $data = json_encode(array(
  35. 'type' => 'msg',
  36. 'msg' => 'aaaa',
  37. ));
  38. $id = 'merchantConsole_' . $this->merchantId;
  39. $online = Gateway::getClientIdByUid($id);
  40. if ($online) {
  41. //直接发送
  42. Gateway::sendToUid($id, json_encode($data));
  43. } else {
  44. //保存
  45. }
  46. }
  47. }