/**
  * 用户登录操作监听
  * @param int $userid 用户ID
  * @param boolean $status 操作的结果,默认操作是成功的
  */
 public function login($userid, $status = true)
 {
     //登录成功
     if ($status) {
         //记录最后一次登录ip和登录时间
         $data = array('last_login_ip' => WebUtils::getClientIP(), 'last_login_time' => time());
         $userService = Beans::get('user.user.service');
         $userService->update($data, $userid);
     }
     //do something after the user has logined
 }
 /**
  * @see \admin\service\interfaces\IAdminService::login()
  */
 public function login($username, $password)
 {
     $conditions = array('username' => $username, 'password' => md5(md5($password)));
     $item = $this->getItem($conditions);
     if (!$item) {
         return false;
     } else {
         //更新登录信息
         $data['last_login_time'] = time();
         $data['last_login_ip'] = WebUtils::getClientIP();
         $this->update($data, $item['id']);
         //记录session信息
         Session::start();
         $_SESSION[IAdminService::ADMIN_SESSION_USER] = $item;
         $this->updateUserPermission($item);
         return $item;
     }
 }