国产+高潮+在线,国产 av 仑乱内谢,www国产亚洲精品久久,51国产偷自视频区视频,成人午夜精品网站在线观看

GatewayClient,報(bào)找不到類

li460620829

[attach]2323[/attach]
?

3590 2 0
2個(gè)回答

li460620829

我下載好了,沒(méi)composer install之前,能找到,發(fā)不出去消息。install之后,就報(bào)找不到class了,哪位大佬幫幫忙呀

  • 暫無(wú)評(píng)論
xiuwang

把類文件手動(dòng)require進(jìn)去

  • li460620829 2019-07-25

    老哥,現(xiàn)在類不報(bào)錯(cuò)了,但是發(fā)不出去消息,客戶端直接發(fā)能行,幫忙看看唄,千恩萬(wàn)謝。
    <?php
    namespace app\admin\controller;

    require_once env('root_path') . 'vendor/workerman/gatewayclient/Gateway.php';
    use app\admin\model\Friend;
    use think\Controller;
    use GatewayClient\Gateway;
    use think\Request;
    use app\admin\validate\Index as IndexValidata;
    use think\Response;
    use think\facade\Session;

    class Index extends Controller
    {
    public function index()
    {
    $arr = ['id'=>1,'name'=>'老趙','url'=>'images/head/1.jpg'];
    Session::set('user',$arr);
    $friend = Friend::with(['user'=>function($query){
    $query->field('id,username,url,autograph');
    }])->where('user_id',1)->field('friend_id')->select();
    $friend_array=$friend->toArray();
    $record = [];
    if(!empty($friend_array)){
    $route = '../../../public/static/record/'.$friend_array[0]['friend_id'].'.text';
    if(file_exists($route)){
    $f= fopen($route,'\n\r');
    while (!feof($f))
    {
    for ($i = 0; $i < 10 && !feof($f); $i++) {
    $record[] = fgets($f);
    }
    }
    fclose($f);
    }
    }
    $this->assign('record',$record);
    $this->assign('user',$arr);
    $this->assign('friend',$friend);
    return $this->fetch();
    }

    /**
     * 聊天id:client_id和user_id做綁定
     *
     * @param Request $request
     * @param client_id     聊天id
     * @return Response
     */
    public function bindUid(Request $request): Response
    {
        $validata = new IndexValidata();
        if(!$validata->scene('client_id')->check($request->post())){
            return output(1,$validata->getError());
        };
        Gateway::$registerAddress = '127.0.0.1:1238';
        #聊天id:client_id和user_id做綁定
        Gateway::bindUid($request->post('client_id'),Session::get('user.id'));
        return output(0);
    }
    
    /**
     * 發(fā)消息
     * @param Request $request
     * @param id      發(fā)給誰(shuí)
     * @param text    發(fā)什么
     * @return Response
     */
    public function sendMessage(Request $request): Response
    {
        $validata = new IndexValidata();
        if(!$validata->scene('sendMessage')->check($request->post())){
            return output(1,$validata->getError());
        };
        #消息內(nèi)容
        $arr = [
            'error' => 0,
            'type'  => 'reply',
            'data'  => [
                'message'   => $request->post("text")
            ]
        ];
        #連接服務(wù)
        Gateway::$registerAddress = '127.0.0.1:1238';
        #給uid發(fā)
        Gateway::sendToAll(json($arr));
        return output(0);
    }
年代過(guò)于久遠(yuǎn),無(wú)法發(fā)表回答
??