<?php

namespace app\person\controller;

use app\person\common\PersonController;
use app\admin\model\Person as PersonModel;

/**
 * Description of Index
 *
 * @author sgq
 */
class Index extends PersonController {

    public function index() {
        $vars["user"] = [
            "name" => $this->user["name"],
            "rolename" => $this->user["rolename"],
            "avatar" => $this->user["avatar"]
        ];
        $menus = \app\common\api\MenuApi::getPersonMenuList($this->user["type"]);
        $vars["menus"] = $menus;
        return view("", $vars);
    }

    public function center_page() {
        $uid = $this->user["uid"];
        $person = PersonModel::where("id", $uid)->find();
        if (!$person["active"]) {
            $person["activeName"];
        } else if ($person["active"] == 1) {
            $person["activeName"] = "账号有效";
            $person["activeMsg"] = "";
        } else if ($person["active"] == 2) {
            $person["activeName"] = "冻结/拉黑";
        }
        return view("", ["person" => $person]);
    }

}
