当前位置: 首页>>代码示例>>PHP>>正文


PHP User::getFindUser方法代码示例

本文整理汇总了PHP中backend\models\User::getFindUser方法的典型用法代码示例。如果您正苦于以下问题:PHP User::getFindUser方法的具体用法?PHP User::getFindUser怎么用?PHP User::getFindUser使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在backend\models\User的用法示例。


在下文中一共展示了User::getFindUser方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: actionIndex

 public function actionIndex()
 {
     $this->layout = false;
     if (\Yii::$app->request->isAjax) {
         $user = new User();
         $data = \Yii::$app->request->post();
         $userInfo = $user->getFindUser(['name' => $data['name']]);
         $pass = md5(md5($data['password']));
         \Yii::$app->response->format = \yii\web\Response::FORMAT_JSON;
         //将响应数据转json格式
         if (!$userInfo || $userInfo['password'] != $pass) {
             //验证用户登录信息
             return ['msg' => '用户名或密码错误', 'status' => 0];
         } else {
             if ($member = \common\models\User::getInstance()->getUserByPhone($userInfo['phone'])) {
                 $userInfo['member'] = $member;
             }
             $auth = \Yii::$app->authManager;
             $userRole = $auth->getAssignments($userInfo['id']);
             $role = "";
             foreach ($userRole as $k => $v) {
                 if ($k == 'admin') {
                     $role = "admin";
                     break;
                 }
                 $role .= "," . $k;
             }
             $userInfo['role'] = $role;
             $user->setUserSession($userInfo);
             //设置Session
             return ['msg' => '登录成功', 'status' => 1];
         }
     }
     return $this->render('index.html');
 }
开发者ID:xswolf,项目名称:baihey,代码行数:35,代码来源:LoginController.php

示例2: actionEditUser

 /**
  * @return string
  * 编辑用户
  */
 public function actionEditUser()
 {
     $auth = \Yii::$app->authManager;
     $request = \Yii::$app->request;
     $userModel = new User();
     $user = $userModel->getFindUser(['id' => $request->get('id')]);
     $userRole = $auth->getAssignments($request->get('id'));
     $roleList = $auth->getRoles();
     //用户已有角色处理
     $list = array();
     foreach ($roleList as $key => $val) {
         if (!empty($userRole) && array_key_exists($key, $userRole)) {
             $list[$key] = 1;
         } else {
             $list[$key] = 0;
         }
     }
     if ($request->post()) {
         if ($userModel->editUser($request->post())) {
             $this->__success('更新成功', 'list-user');
         } else {
             $this->__error('更新失败');
         }
     }
     $this->assign('user', $user);
     $this->assign('list', $list);
     return $this->render();
 }
开发者ID:xswolf,项目名称:baihey,代码行数:32,代码来源:UserController.php

示例3: actionInfo

 public function actionInfo()
 {
     $userId = \Yii::$app->request->get('id');
     $user = User::getInstance()->getUserById($userId);
     $user['info'] = json_decode($user['info']);
     $user['auth'] = json_decode($user['auth']);
     // 获取登陆次数
     $loginTime = User::getInstance()->getLoginTimes($userId);
     $moneyAll = User::getInstance()->getPayAll($userId);
     // 获取红娘名称
     $userModel = new UserModel();
     $matchmaker = $userModel->getFindUser(['id' => $user['matchmaker']]);
     $matchmaking = $userModel->getFindUser(['id' => $user['matchmaking']]);
     $this->assign('user', $user);
     $this->assign('loginTime', $loginTime);
     $this->assign('moneyAll', $moneyAll);
     $this->assign('matchmaker', $matchmaker['name']);
     $this->assign('matchmaking', $matchmaking['name']);
     $this->assign('photoList', UserPhoto::getInstance()->getPhotoList(\Yii::$app->request->get('id')));
     // 消息
     $messageList = UserMessage::getInstance()->chatList($userId);
     foreach ($messageList as $k => $v) {
         $messageList[$k]['info'] = json_decode($messageList[$k]['info']);
     }
     $this->assign('messageList', $messageList);
     // 动态
     $dynamicList = UserDynamic::getInstance()->getDynamicList($userId, 0, 1000, -2);
     $this->assign('dynamicList', $dynamicList);
     // 认证
     $identify = UserPhoto::getInstance()->getPhotoList($userId, [2, 3, 4, 5, 6]);
     $identifyType = [];
     foreach ($identify as $k => $v) {
         if ($v['is_check'] == '0') {
             unset($identify[$k]);
             continue;
         }
         $identifyType[$v['type']][] = $v;
     }
     $this->assign('identify', $identify);
     $this->assign('identifyType', $identifyType);
     // 红娘列表
     $adminUserList = AuthUser::getInstance()->getUserByRole(['普通服务红娘', 'VIP服务红娘', '贵宾服务红娘', '钻石服务红娘']);
     $this->assign('adminUserList', $adminUserList);
     // 配对记录
     $pairLogList = \common\models\PairLog::getInstance()->getPairLog($userId);
     //        var_dump($pairLogList);exit();
     $this->assign('pairLogList', $pairLogList);
     return $this->render();
 }
开发者ID:xswolf,项目名称:baihey,代码行数:49,代码来源:MemberController.php


注:本文中的backend\models\User::getFindUser方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。