scene('Login') ->check($data); } catch(ValidateException $e){ return json(['code'=>-1,'msg'=>$e->getError()]); } $user = new \app\admin\model\Admin(); $res = $user->login($data); if ($res == 1) { $res = ['code'=>0,'msg'=>'登陆成功']; //$res['data']['access_token'] = $data['__token__']; } else { $res = ['code'=>-1,'msg'=>$res,'url'=>'admin/login']; } return json($res); } return View::fetch('login'); } //注册 public function reg() { if(Session::has('admin_id')){ return redirect('/admin/index/index'); } return View::fetch('reg'); } //忘记密码 public function forget() { if(Session::has('admin_id')){ return redirect('/admin/index/index'); } return View::fetch('forget'); } }