Test.php 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. <?php
  2. namespace App\Console\Commands\WechatPlatform;
  3. use App\Jobs\WechatPlatform\GZHSendKFMessage;
  4. use App\Service\Util\Support\Trace\TraceContext;
  5. use App\Service\WechatPlatform\WechatPlatformConstService;
  6. use EasyWeChat\Factory;
  7. use Illuminate\Console\Command;
  8. use Illuminate\Support\Facades\DB;
  9. class KFMessageSend extends Command
  10. {
  11. /**
  12. * The name and signature of the console command.
  13. *
  14. * @var string
  15. */
  16. protected $signature = 'WechatPlatform:Test';
  17. /**
  18. * The console command description.
  19. *
  20. * @var string
  21. */
  22. protected $description = 'Command description';
  23. /**
  24. * Execute the console command.
  25. */
  26. public function handle()
  27. {
  28. $config = [
  29. 'app_id' => 'wxf313b3506bac2647',
  30. 'secret' => 'aaf348571cbc5d554e4de1bcd3cb0342',
  31. 'token' => 'jXP3Cdl6GofhWVsQTtgwLv2tMZG9nHlPgErZm6ixaSl',
  32. 'aes_key' => 'GtG7s1v7QV8kRfpWeGmDnwhwdPPKSrA35rIhmrwenpq',
  33. 'http' => [
  34. 'max_retries' => 1,
  35. 'retry_delay' => 500,
  36. 'timeout' => 5.0,
  37. ],
  38. ];
  39. $openPlatform = Factory::openPlatform($config);
  40. $officialAccount = $openPlatform->officialAccount('wxebcb86ec4b80eaca',
  41. 'refreshtoken@@@pOdN-RBZ1f475kZxXM66IcG2keHkv8V0mDs97JYa2TQ');
  42. $officialAccount->customer_service->message('hello, '. date('Y-m-d H:i:s'))
  43. ->to('oHhd20dzCcfVjWt4OcGzFWISp6A4')
  44. ->send();
  45. }
  46. }