Inspire.php 2.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788
  1. <?php
  2. namespace App\Console\Commands;
  3. use App\Managers\IMManager;
  4. use App\Utils\ImUtil;
  5. use Illuminate\Console\Command;
  6. class Inspire extends Command
  7. {
  8. /**
  9. * The name and signature of the console command.
  10. *
  11. * @var string
  12. */
  13. protected $signature = 'inspire';
  14. /**
  15. * The console command description.
  16. *
  17. * @var string
  18. */
  19. protected $description = 'Command description';
  20. protected $imManager;
  21. protected $imUtil;
  22. public function __construct(IMManager $imManager, ImUtil $imUtil)
  23. {
  24. parent::__construct();
  25. $this->imManager = $imManager;
  26. $this->imUtil = $imUtil;
  27. }
  28. /**
  29. * Execute the console command.
  30. *
  31. * @return mixed
  32. */
  33. public function handle()
  34. {
  35. // $this->imUtil->dirtyWordAdd([
  36. // '操你妈',
  37. // '你妈逼',
  38. // ]);
  39. // $this->imUtil->getDirtyWords();
  40. dump($this->imUtil->deleteDirtyWords([
  41. '你妈逼',
  42. ]));
  43. dd($this->imUtil->getDirtyWords());
  44. // dd($this->imManager->createUserLatestMessageByUserId(
  45. // 1,
  46. // 1,
  47. // 1,
  48. // 1,
  49. // 1,
  50. // 1,
  51. // [],
  52. // ));
  53. // $this->imManager->createUserLatestMessageTableByUserId(0);
  54. //
  55. // $this->imManager->createUserLatestMessageTableByUserId(1000000);
  56. $x = $this->imUtil->registerUser('test', 'test', '', 1);
  57. dd($x);
  58. die;
  59. dd(json_decode($this->imUtil->sendMessage('test', 'test1', [
  60. [
  61. 'MsgType' => 'TIMTextElem',
  62. 'MsgContent' => [
  63. 'Text' => 'xxxx',
  64. ]
  65. ],
  66. [
  67. 'MsgType' => 'TIMSoundElem',
  68. 'MsgContent' => [
  69. 'Url' => 'https://1234-5678187359-1253735226.cos.ap-shanghai.myqcloud.com/abc123/c9be9d32c05bfb77b3edafa4312c6c7d',
  70. "Size" => 62351,
  71. "Second" => 1,
  72. "Download_Flag" => 2
  73. ]
  74. ],
  75. ])));
  76. }
  77. }