Test.php 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  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 EasyWeChat\Kernel\Messages\Text;
  8. use Illuminate\Console\Command;
  9. use Illuminate\Support\Facades\Cache;
  10. use Illuminate\Support\Facades\DB;
  11. class Test extends Command
  12. {
  13. /**
  14. * The name and signature of the console command.
  15. *
  16. * @var string
  17. */
  18. protected $signature = 'WechatPlatform:Test';
  19. /**
  20. * The console command description.
  21. *
  22. * @var string
  23. */
  24. protected $description = 'Command description';
  25. /**
  26. * Execute the console command.
  27. */
  28. public function handle()
  29. {
  30. $config = [
  31. 'app_id' => 'wxf313b3506bac2647',
  32. 'secret' => 'aaf348571cbc5d554e4de1bcd3cb0342',
  33. 'token' => 'jXP3Cdl6GofhWVsQTtgwLv2tMZG9nHlPgErZm6ixaSl',
  34. 'aes_key' => 'GtG7s1v7QV8kRfpWeGmDnwhwdPPKSrA35rIhmrwenpq',
  35. 'http' => [
  36. 'max_retries' => 1,
  37. 'retry_delay' => 500,
  38. 'timeout' => 5.0,
  39. ],
  40. ];
  41. $openPlatform = Factory::openPlatform($config);
  42. $openPlatform->rebind('cache', Cache::store('redis'));
  43. $officialAccount = $openPlatform->officialAccount('wxebcb86ec4b80eaca',
  44. 'refreshtoken@@@pOdN-RBZ1f475kZxXM66IcG2keHkv8V0mDs97JYa2TQ');
  45. $text = new Text('kkkkkk');
  46. $res = $officialAccount->customer_service->message($text)
  47. ->to('oHhd20dzCcfVjWt4OcGzFWISp6A4')
  48. ->send();
  49. dump($res);
  50. }
  51. }