当前位置: 首页>>代码示例>>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;未经允许,请勿转载。