public function loginAction() { $username = '******'; $password = '******'; //$operation = new UserOperation($this->di); $user = Users::findFirst("username='******'"); var_dump($user); exit; }
/** * 根据文章发布数量获取用户 * @param number $limit * @return multitype:unknown */ public function getUsersByCount($limit = 5) { $articles = Articles::count(array('conditions' => 'is_delete=0', 'group' => 'author_id', 'order' => 'rowcount desc', 'columns' => 'author_id', 'limit' => $limit)); $users = array(); foreach ($articles as $article) { $user = Users::findFirst($article->author_id); if ($user) { $users[] = $user; } } return $users; }
/** * 检查邮箱是否已绑定 * @param string $email 邮箱 * @return boolean */ public function checkEmailExist($email) { $user = Users::findFirst("email='{$email}'"); if ($user) { return true; } return false; }