Ver Fonte

兼容会员登录

zxiansheng há 4 anos atrás
pai
commit
2b35bf0461

+ 2 - 1
common/components/ActiveRecord.php

@@ -295,7 +295,8 @@ class ActiveRecord extends \yii\db\ActiveRecord {
             self::$query->asArray();
         }
         $lists = self::$query->all();
-        //self::$rawSql = self::$query->createCommand()->getRawSql();
+        // self::$rawSql = self::$query->createCommand()->getRawSql();
+        // var_dump(self::$rawSql);exit;
         self::$query = null;
         unset($countQuery);
         $startNum = $pagination->page * $pagination->pageSize + 1;

+ 1 - 1
common/models/User.php

@@ -108,7 +108,7 @@ class User extends \common\components\ActiveRecord
     public function rules()
     {
         return [
-            [['USER_NAME', 'PASSWORD_HASH', 'PAY_PASSWORD', 'REAL_NAME', 'ID_CARD', 'AVATAR'], 'required'],
+            [['USER_NAME', 'PASSWORD_HASH', 'PAY_PASSWORD', 'REAL_NAME', 'ID_CARD'], 'required'],
             [['NATION', 'ID_TYPE', 'BANK_PROVINCE', 'BANK_CITY', 'BANK_COUNTY', 'CREATED_AT', 'UPDATED_AT', 'STATUS', 'DEC_CLOSED', 'DEC_CLOSED_AT', 'PROVINCE', 'CITY', 'COUNTY', 'DELETED', 'DELETED_AT', 'IS_DEC', 'IS_ATLAS', 'IS_RECHARGE', 'PERIOD_AT', 'DEC_PROVINCE', 'DEC_CITY', 'DEC_COUNTY', 'IS_UNION', 'STATUS_AT', 'VERIFIED', 'VERIFIED_AT', 'ALLOW_LOGIN', 'NOT_OPERATING', 'REG_FROM', 'BANK_UPDATED_AT', 'IS_DIRECT_SELLER', 'DEC_LV_UPDATED_AT', 'DEC_LV_UPDATED_PERIOD', 'PART_FUNC_CLOSED', 'LAST_DEC_LV_UPDATED_PERIOD', 'LAST_DEC_LV_UPDATED_AT', 'DEC_CREATED_AT', 'DEC_CREATED_PERIOD', 'PASSWORD_CHANGED', 'SUB_COM_LEADER', 'READ_AGREEMENT', 'IS_FIRST_OPEN', 'IS_MODIFY_PASSWORD'], 'integer'],
             [['ZG_UPGRADE_PV'], 'number'],
             [['ID', 'OPEN_BANK', 'BANK_NO', 'DEC_LV', 'EMP_LV', 'SUB_COM_ID', 'DEC_ID', 'DEC_ROLE_ID', 'ID_CARD_PREFIX', 'SEX', 'DEC_PHONE', 'GUARANTOR', 'USER_CREATOR', 'USER_UPDATER', 'LAST_DEC_LV'], 'string', 'max' => 32],

+ 1 - 1
frontendApi/modules/v1/controllers/DashboardController.php

@@ -49,7 +49,7 @@ class DashboardController extends BaseController
         }
         $empLv = $baseInfo['EMP_LV'];
         $empLvName = $baseInfo['EMP_LV_NAME'];
-        if($baseInfo['SHOW_EMP_LV']){
+        if(isset($baseInfo['SHOW_EMP_LV'])){
             $empLv = $baseInfo['SHOW_EMP_LV'];
             $empLvName = Cache::getEmpLevelConfig()[$baseInfo['SHOW_EMP_LV']]['LEVEL_NAME'];
         }

+ 11 - 11
frontendApi/modules/v1/models/LoginForm.php

@@ -57,9 +57,9 @@ class LoginForm extends Model
         if (!$this->hasErrors()) {
             $user = $this->getUser();
             if(!$user){
+                
                 $this->addError($attribute, '用户名错误');
             } else {
-
 //                $userInfo = UserInfo::findOneAsArray('USER_ID=:USER_ID', [':USER_ID'=>$user['ID']]);
 //                if($userInfo['CLOSE_LOGIN'] == 1){
 //                    $this->addError($attribute, '会员已被禁止登录');
@@ -80,10 +80,8 @@ class LoginForm extends Model
             'FAIL_NUMS' => 1,
         ], 'USER_NAME=:USER_NAME', ['USER_NAME' => $this->userName]);
         $transaction->commit();
-
         $cacheKey = sprintf(self::FRONTEND_LOGIN_FAIL_TIMES, $this->userName);
         Yii::$app->tokenRedis->incr($cacheKey);
-
         if(isset($this->_user)){
             UserLoginLogger::fail($this->_userInfo,$returnResult);
         }
@@ -117,11 +115,11 @@ class LoginForm extends Model
             if(!$this->_user){
                 throw new Exception('账号不存在');
             }
-
-            // if (!$this->_user->validatePassword($this->password)) {
-            //     $this->_updateFailTimes($transaction,'用户名或密码错误');
-            //     throw new Exception('用户名或密码错误');
-            // }
+            if (!$this->_user->validatePassword($this->password)) {
+                $this->_updateFailTimes($transaction,'用户名或密码错误');
+                throw new Exception('用户名或密码错误');
+            }
+            
             // 找到会员的基本信息来判断其是否可登录
             if(!$this->_user['ALLOW_LOGIN']){
                 $this->_updateFailTimes($transaction,'会员编号异常');
@@ -145,6 +143,7 @@ class LoginForm extends Model
             } elseif($this->_user['IS_MODIFY_PASSWORD'] == 1){
                 throw new Exception(self::ERROR_IS_MODIFY_PASSWORD);
             }
+            
             //验证IP
             /*$bindIp = trim($this->_user['BIND_IP']);
             if(!empty($bindIp) && !(new LoginIpChecker(Yii::$app->request->getUserIP(), $bindIp))->validate()){
@@ -167,7 +166,6 @@ class LoginForm extends Model
 
             $this->_updateSuccessTimes();
             $transaction->commit();
-
             UserLoginLogger::success($this->_userInfo);
             return Yii::$app->user->loginWithUAndP($this->_user);
         }catch(\Exception $e){
@@ -186,8 +184,10 @@ class LoginForm extends Model
     public function getUser() {
         if ($this->_user === null) {
             $this->_user = User::findByUsername($this->userName);
-            $this->_userInfo = UserInfo::findOne(['USER_NAME' =>$this->userName]);
-        }
+            $this->_userInfo = User::findByUsername($this->userName);
+            //$this->_userInfo = UserInfo::findOne(['USER_NAME' =>$this->userName]);
+        } 
+
         return $this->_user;
     }