GatewayTool.php 552 B

12345678910111213141516171819202122232425262728
  1. <?php
  2. /**
  3. * qq: 1123416584
  4. * Time: 2022/4/1 11:46 上午
  5. */
  6. namespace addons\notice\library;
  7. use GatewayClient\Gateway;
  8. class GatewayTool
  9. {
  10. public static function init()
  11. {
  12. $register_port = get_addon_config('notice')['register_port'] ?? '';
  13. Gateway::$registerAddress = '127.0.0.1:'.$register_port;
  14. }
  15. public static function sendByUid($uid, $type, $data)
  16. {
  17. $data = [
  18. 'type' => $type,
  19. 'data' => $data,
  20. ];
  21. Gateway::sendToUid($uid, json_encode($data, true));
  22. }
  23. }