Esempio n. 1
0
 public function _initialize()
 {
     if (!UserModel::instance()->isLogin()) {
         // 判断用户是否登录
         $this->redirect("user/login");
     } else {
         $this->user = UserModel::instance();
         $this->user->setUser(session(C("LOGIN_SESSION")));
         if ($this->user->getId() == 1) {
             // 管理员
             layout(false);
             $list = PlatformShopModel::instance()->getList();
             $this->assign("list", $list);
         } else {
             // 店铺用户
             if ($this->user->getShopStatus() == 0) {
                 $this->redirect("user/login", ['error' => 1]);
             }
         }
     }
 }