當前位置: 首頁>>代碼示例>>PHP>>正文


PHP User::findByMobile方法代碼示例

本文整理匯總了PHP中common\models\User::findByMobile方法的典型用法代碼示例。如果您正苦於以下問題:PHP User::findByMobile方法的具體用法?PHP User::findByMobile怎麽用?PHP User::findByMobile使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在common\models\User的用法示例。


在下文中一共展示了User::findByMobile方法的9個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: getUser

 /**
  * Finds user by [[mobile]]
  *
  * @return User|null
  */
 public function getUser()
 {
     if ($this->_user === null) {
         $this->_user = User::findByMobile($this->mobile);
     }
     return $this->_user;
 }
開發者ID:daixianceng,項目名稱:xiaoego.com,代碼行數:12,代碼來源:LoginForm.php

示例2: generateToken

 public function generateToken()
 {
     $mobile = $this->_session['passwordResetMobile'];
     $this->_user = User::findByMobile($mobile);
     if (!User::isPasswordResetTokenValid($this->_user->password_reset_token)) {
         $this->_user->generatePasswordResetToken();
     }
     return $this->_user->save(false);
 }
開發者ID:daixianceng,項目名稱:xiaoego.com,代碼行數:9,代碼來源:PasswordResetVerifyForm.php

示例3: actionGetcode

 public function actionGetcode()
 {
     $request = \Yii::$app->request;
     $mobile = $request->_get('mobile', NULL);
     $from = $request->_get('from', '');
     $type = $request->_get('type', '');
     if (!EasyHelpers::checkMobile($mobile)) {
         return ['code' => 2, 'msg' => '手機號碼格式不正確', 'data' => []];
     }
     if ($from && $from == 'signup') {
         $types = \Yii::$app->params['types'];
         if (!in_array($type, $types)) {
             return ['code' => 1, 'msg' => '用戶類型不正確', 'data' => []];
         }
         if (in_array($type, ['master', 'user'])) {
             $where = 'userMobile=\'' . $mobile . '\' AND `type`=\'' . $type . '\'';
         } else {
             $where = 'userMobile=\'' . $mobile . '\' AND `type`<>\'master\' AND `type`<>\'user\'';
         }
         $isSignup = User::find()->where($where)->One();
         if ($isSignup) {
             return ['code' => 1, 'msg' => '手機號碼已注冊', 'data' => []];
         }
     }
     if ($from && $from == 'resetpwd') {
         $user = User::findByMobile($mobile);
         if (!$user) {
             return ['code' => 2, 'msg' => '手機號碼未注冊', 'data' => []];
         }
     }
     if ($from && $from == 'bindMobile-new') {
         $newuser = User::findByMobile($mobile);
         if ($newuser) {
             return ['code' => 1, 'msg' => '新手機號已注冊', 'data' => []];
         }
     }
     $code = EasyHelpers::getVerifyCode($mobile);
     $phone = $mobile;
     if (!$phone) {
         $identity = \Yii::$app->user->identity;
         $phone = $identity ? $identity->userMobile : '';
     }
     if (!$phone) {
         return ['code' => 2, 'msg' => '手機號碼缺失', 'data' => []];
     }
     $resource = '瞄再買';
     Sendmsg::widget(['callback' => [$this, 'saveMsg'], 'mobile' => $phone, 'params' => ['text' => '手機', 'code' => $code, 'resource' => $resource], 'callbackParams' => ['code' => $code, 'mobile' => $phone], 'template' => 'verifyCode']);
     $resMsg = $this->resMessage;
     if ($resMsg) {
         if (!isset($resMsg[0])) {
             $resMsg[0] = $resMsg['returnMsg'];
         }
         return ['code' => 2, 'msg' => $resMsg[0], 'data' => []];
     }
     return ['code' => 0, 'msg' => '驗證碼發送成功'];
 }
開發者ID:BlackCodes,項目名稱:Mymine,代碼行數:56,代碼來源:VerifyController.php

示例4: resetPassword

 /**
  * Resets password.
  *
  * @return boolean if password was reset.
  */
 public function resetPassword()
 {
     $user = User::findByMobile($this->userMobile);
     $user->setPassword($this->password);
     $res = $user->save();
     if ($res !== false) {
         return true;
     } else {
         $this->addError('save', '更改失敗');
         return false;
     }
 }
開發者ID:BlackCodes,項目名稱:Mymine,代碼行數:17,代碼來源:ResetPasswordForm.php

示例5: getUser

 /**
  * Finds user by [[username]]
  *
  * @return User|null
  */
 public function getUser()
 {
     if ($this->_user === false) {
         $userName = $this->username;
         if (EasyHelpers::checkEmail($userName)) {
             // do username;
             $this->_user = User::findByEmail($userName);
         } elseif (EasyHelpers::checkMobile($userName)) {
             // do mobile;
             $this->_user = User::findByMobile($userName);
         } else {
             return false;
         }
     }
     return $this->_user;
 }
開發者ID:BlackCodes,項目名稱:Mymine,代碼行數:21,代碼來源:LoginForm.php

示例6: getUser

 /**
  * Finds user by [[username]]
  *
  * @return User|null
  */
 protected function getUser()
 {
     if ($this->_user === null) {
         $this->_user = User::findByUsername($this->username);
     }
     if ($this->_user === null) {
         $this->_user = User::findByEmail($this->username);
     }
     if ($this->_user === null) {
         $this->_user = User::findByMobile($this->username);
     }
     if ($this->_user && !in_array($this->_user->group, [User::GROUP_ADMIN, User::GROUP_WRITER])) {
         return false;
     }
     return $this->_user;
 }
開發者ID:specialnote,項目名稱:myYii,代碼行數:21,代碼來源:LoginForm.php

示例7: getUser

 /**
  * Finds user by [[username]]
  *
  * @return User|null
  */
 protected function getUser()
 {
     if ($this->_user === null) {
         $this->_user = User::findByUsername($this->username);
     }
     if ($this->_user === null) {
         $this->_user = User::findByEmail($this->username);
     }
     if ($this->_user === null) {
         $this->_user = User::findByMobile($this->username);
     }
     return $this->_user;
 }
開發者ID:specialnote,項目名稱:myYii,代碼行數:18,代碼來源:LoginForm.php

示例8: actionGetstoreinfo

 /**
  * 根據手機號獲取店鋪信息
  * @return type
  */
 public function actionGetstoreinfo()
 {
     $request = \Yii::$app->request;
     $userMobile = $request->_get('userMobile', 0);
     $userId = $request->_get('userId', 0);
     $usign = $request->_get('usign', '');
     if ($usign != EasyHelpers::encrypty($userId, \Yii::$app->params['key'])) {
         return ['code' => 5, 'msg' => '非法數據'];
     }
     if (!$userMobile) {
         return ['code' => 1, 'msg' => '非法數據'];
     }
     if (!EasyHelpers::checkMobile($userMobile)) {
         return ['code' => 1, 'msg' => '手機號格式不正確'];
     }
     $user = User::findByMobile($userMobile);
     if (!$user) {
         return ['code' => 1, 'msg' => '用戶不存在'];
     } else {
         if ($user->userId == $userId) {
             return ['code' => 1, 'msg' => '不能給自己發送'];
         }
         $store = Store::getStoreInfo($user->userId);
         if (!$store) {
             return ['code' => 1, 'msg' => '用戶沒有店鋪'];
         }
         if ($store['status'] != 'approval') {
             return ['code' => 1, 'msg' => '用戶店鋪沒有通過審核'];
         }
     }
     $data['userId'] = $store['userId'];
     $data['storeName'] = $store['storeName'];
     $data['logo'] = EasyHelpers::getStoreLogoUrl($store['logo']);
     return ['code' => 0, 'msg' => '操作成功', 'data' => $data];
 }
開發者ID:BlackCodes,項目名稱:Mymine,代碼行數:39,代碼來源:StoreController.php

示例9: actionBindmobile

 /**
  * bind mobile api
  * @return type
  */
 public function actionBindmobile()
 {
     $request = \Yii::$app->request;
     $data['oldmobile'] = $request->_get('oldmobile', '');
     $data['oldcode'] = $request->_get('oldcode', '');
     $data['newmobile'] = $request->_get('newmobile', '');
     $data['newcode'] = $request->_get('newcode', '');
     $data['userId'] = $request->_get('userId', '');
     $data['usign'] = $request->_get('usign', '');
     if ($data['usign'] != EasyHelpers::encrypty($data['userId'], \Yii::$app->params['key'])) {
         return ['code' => 5, 'msg' => '非法數據'];
     }
     $Iduser = \common\models\User::findOne(['userId' => $data['userId']]);
     if ($Iduser && $data['oldmobile'] != $Iduser['userMobile']) {
         return ['code' => 6, 'msg' => '非法數據'];
     }
     $oldcode = EasyHelpers::getVerifyCode($data['oldmobile']);
     $newcode = EasyHelpers::getVerifyCode($data['newmobile']);
     if ($data['oldcode'] != $oldcode) {
         return ['code' => 1, 'msg' => '已綁定手機號驗證碼不正確'];
     }
     if ($data['newcode'] != $newcode) {
         return ['code' => 1, 'msg' => '新手機號驗證碼不正確'];
     }
     $user = \common\models\User::findByMobile($data['oldmobile']);
     $newuser = \common\models\User::findByMobile($data['newmobile']);
     if ($newuser) {
         ['code' => 1, 'msg' => '新手機號已經注冊'];
     }
     if ($user) {
         $user->userMobile = $data['newmobile'];
         if ($user->save()) {
             return ['code' => 0, 'msg' => '手機綁定成功,請重新登錄'];
         }
     }
     return ['code' => 1, 'msg' => '用戶信息拉取失敗'];
 }
開發者ID:BlackCodes,項目名稱:Mymine,代碼行數:41,代碼來源:SiteController.php


注:本文中的common\models\User::findByMobile方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。