<?php
declare (strict_types = 1);

namespace app\listener\space;

use app\services\opening\OpeningTcService;
use freedom\utils\SocketSession;
use think\swoole\Websocket;

class OpeningTc
{
    /**
     * 事件监听处理
     *
     * @return void
     */
    public function handle(array $event, WebSocket $ws)
    {
        $preliminaryCheckRes = SocketSession::preliminaryCheck($event,'space');
        if($preliminaryCheckRes['status'] == true){
            $tableInfo = $preliminaryCheckRes['data'];
            OpeningTcService::openingTc($event,$tableInfo,$ws);
        }else{
            $ws->emit('openingTc', ['status' => false, 'msg' => $preliminaryCheckRes['msg']]);
        }
    }
}
