IndexController.php 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. <?php
  2. namespace app\controller;
  3. use support\Request;
  4. use Webman\Push\Api;
  5. class IndexController
  6. {
  7. public function index(Request $request)
  8. {
  9. $api = new Api('http://127.0.0.1:3232', config('plugin.webman.push.app.app_key'),config('plugin.webman.push.app.app_secret'));
  10. $api->trigger("user-_000KmfiVkio30K9VxoeLUUY3_hngEWcgR7u","message",[
  11. "type" => "text",
  12. "time" => time() * 1000,
  13. "msgId" => time(),
  14. "content" => "哈稍等哈就说客家话",
  15. "source" => 2,
  16. "avatar" => "https://washmy.oss-cn-guangzhou.aliyuncs.com/storage/20260511/23627b2cb8f73a8a90b95c31d726e6ecad0cbb9a.png",
  17. "poi_id" => "7644106137976965139"
  18. ]);
  19. echo "asd";
  20. // $param = [
  21. // "events" => [
  22. // [
  23. // "channel" => "private-user-1",
  24. // "name" => "channel_added"
  25. // ]
  26. // ]
  27. // ];
  28. // $key = hash_hmac('sha256', json_encode($param), config('plugin.webman.push.app.app_secret'), false);
  29. // echo $key."\n";
  30. }
  31. public function view(Request $request)
  32. {
  33. return view('index/view', ['name' => 'webman']);
  34. }
  35. public function json(Request $request)
  36. {
  37. return json(['code' => 0, 'msg' => 'ok']);
  38. }
  39. }