<?php

namespace App\Console\Commands;

use App\Managers\IMManager;
use App\Utils\ImUtil;
use Illuminate\Console\Command;

class Inspire extends Command
{
    /**
     * The name and signature of the console command.
     *
     * @var string
     */
    protected $signature = 'inspire';

    /**
     * The console command description.
     *
     * @var string
     */
    protected $description = 'Command description';

    protected $imManager;
    protected $imUtil;

    public function __construct(IMManager $imManager, ImUtil $imUtil)
    {
        parent::__construct();
        $this->imManager = $imManager;
        $this->imUtil = $imUtil;
    }

    /**
     * Execute the console command.
     *
     * @return mixed
     */
    public function handle()
    {
//        $this->imUtil->dirtyWordAdd([
//            '操你妈',
//            '你妈逼',
//        ]);
//        $this->imUtil->getDirtyWords();
        dump($this->imUtil->deleteDirtyWords([
            '你妈逼',
        ]));
        dd($this->imUtil->getDirtyWords());
//        dd($this->imManager->createUserLatestMessageByUserId(
//            1,
//            1,
//            1,
//            1,
//            1,
//            1,
//            [],
//        ));
//        $this->imManager->createUserLatestMessageTableByUserId(0);
//
//        $this->imManager->createUserLatestMessageTableByUserId(1000000);


        $x = $this->imUtil->registerUser('test', 'test', '', 1);
        dd($x);
        die;
        dd(json_decode($this->imUtil->sendMessage('test', 'test1', [
            [
                'MsgType' => 'TIMTextElem',
                'MsgContent' => [
                    'Text' => 'xxxx',
                ]
            ],
            [
                'MsgType' => 'TIMSoundElem',
                'MsgContent' => [
                    'Url' => 'https://1234-5678187359-1253735226.cos.ap-shanghai.myqcloud.com/abc123/c9be9d32c05bfb77b3edafa4312c6c7d',
                    "Size" => 62351,
                    "Second" => 1,
                    "Download_Flag" => 2

                ]
            ],
        ])));
    }
}
