application/core/manage/logic/MemberLogic.php
public function checkLogin($user_name, $user_pass)
    {
        $map = [
            'user_name' => $user_name,
            'user_passwd' => $this->encryptPasswd($user_pass)
        ];
        $user = $this->model->where($map)->find();
        
        // 用户状态
        if (empty($user)) {
            return Format::formatResult(self::TYPE_USER_EMPTY, '账号或者密码错误');
        } elseif ($user['user_status'] == 0) {
            return Format::formatResult(self::TYPE_USER_UNUSE, '未启用的账号');
        } elseif ($user['user_status'] == - 1) {
            return Format::formatResult(self::TYPE_USER_BANED, '该账号已经被禁用');
        }
        
        // 群组状态
        $group = MemberGroupLogic::model()->get($user['id']);
        if (empty($group)) {
            return Format::formatResult(self::TYPE_GROUP_EMPTY, '尚未分配用户群组');
        } elseif ($group['group_status'] == 0) {
            return Format::formatResult(self::TYPE_GROUP_BANNED, '用户所在群组被禁止登录');
        }
        
        // 登录日志
        $this->logLogin($user['id']);
        
        return Format::formatResult(self::TYPE_USER_LOGIN, '用户登录成功', [
            'user' => $user,
            'group' => $group
        ]);
    }
public function checkLogin($user_name, $user_pass)
    {
        $map = [
            'user_name' => $user_name,
            'user_passwd' => $this->encryptPasswd($user_pass)
        ];
        $user = $this->model->where($map)->find();
        
        // 用户状态
        if (empty($user)) {
            return Format::formatResult(self::TYPE_USER_EMPTY, '账号或者密码错误');
        } elseif ($user['user_status'] == 0) {
            return Format::formatResult(self::TYPE_USER_UNUSE, '未启用的账号');
        } elseif ($user['user_status'] == - 1) {
            return Format::formatResult(self::TYPE_USER_BANED, '该账号已经被禁用');
        }
        
        // 群组状态
        $group = MemberGroupLogic::model()->get($user['id']);
        if (empty($group)) {
            return Format::formatResult(self::TYPE_GROUP_EMPTY, '尚未分配用户群组');
        } elseif ($group['group_status'] == 0) {
            return Format::formatResult(self::TYPE_GROUP_BANNED, '用户所在群组被禁止登录');
        }
        
        // 登录日志
        $this->logLogin($user['id']);
        
        return Format::formatResult(self::TYPE_USER_LOGIN, '用户登录成功', [
            'user' => $user,
            'group' => $group
        ]);
    }
public function checkLogin ( $ user_name , $ user_pass ) { $ map = [ 'user_name' => $ user_name , 'user_passwd' => $ this -> encryptPasswd ( $ user_pass ) ] ; $ user = $ this -> model -> where ( $ map ) -> find ( ) ; // 用户状态 if ( empty ( $ user ) ) { return Format :: formatResult ( self :: TYPE_USER_EMPTY , '账号或者密码错误'); } elseif ( $ user [ 'user_status' ] == 0 ) { return Format :: formatResult ( self :: TYPE_USER_UNUSE , '未启用的账号'); } elseif ( $ user [ 'user_status' ] == - 1 ) { return Format :: formatResult ( self :: TYPE_USER_BANED , '该账号已经被禁用'); } // 群组状态 $ group = MemberGroupLogic :: model ( ) -> get ( $ user [ 'id' ] ) ; if ( empty ( $ group ) ) { return Format :: formatResult ( self :: TYPE_GROUP_EMPTY , '尚未分配用户群组'); } elseif ( $ group [ 'group_status' ] == 0 ) { return Format :: formatResult ( self :: TYPE_GROUP_BANNED , '用户所在群组被禁止登录'); } // 登录日志 $ this -> logLogin ( $ user [ 'id' ] ) ; return Format :: formatResult ( self :: TYPE_USER_LOGIN , '用户登录成功', [ 'user' => $ user , 'group' => $ group ] ) ; }
验证登录

@param string $user_name
@param string $user_pass
@return array
验证登录