IndexController.php 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  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. "openid" => "_000KmfiVkio30K9VxoeLUUY3_hngEWcgR7u",
  19. "service_id" => "105"
  20. ]);
  21. echo "asd";
  22. // $param = [
  23. // "events" => [
  24. // [
  25. // "channel" => "private-user-1",
  26. // "name" => "channel_added"
  27. // ]
  28. // ]
  29. // ];
  30. // $key = hash_hmac('sha256', json_encode($param), config('plugin.webman.push.app.app_secret'), false);
  31. // echo $key."\n";
  32. }
  33. public function view(Request $request)
  34. {
  35. return view('index/view', ['name' => 'webman']);
  36. }
  37. public function json(Request $request)
  38. {
  39. return json(['code' => 0, 'msg' => 'ok']);
  40. }
  41. }