<?php

namespace app\controller;

use support\Request;

class IndexController
{
    public function index(Request $request)
    {
        $session = $request->session();
        $user=$session->get('user',null);
        $realname=$session->get('realname',null);
        if($user==null||$realname==null){
            $display='none';
        }else{
            $display='block';
        }
       return view('index', ['user' => $user,'realname' => $realname,'display' => $display]);
    }

    public function view(Request $request)
    {
        return view('index/view', ['name' => 'webman']);
    }

    public function json(Request $request)
    {
        return json(['code' => 0, 'msg' => 'ok']);
    }

}
