當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。