Exemple #1
0
 /**
  * 权限验证
  * @return bool
  */
 public function isCan()
 {
     $auth = \Yii::$app->authManager;
     $action = explode('?', \Yii::$app->request->getUrl());
     // 此方法无需验证
     if (!AuthUser::getInstance()->getNodeByName($action[0])) {
         return true;
     }
     $userInfo = \Yii::$app->session->get(USER_SESSION);
     if ($userInfo['name'] == 'admin') {
         return true;
     }
     $uid = $userInfo['id'];
     $permissions = $auth->getPermissionsByUser($uid);
     foreach ($permissions as $vo) {
         if ($action[0] == $vo->description) {
             return true;
         }
     }
     if (\Yii::$app->request->isAjax) {
         echo '无权限';
         exit;
     }
     $this->__error('对不起,您现在还没获此操作的权限');
 }
 /**
  * 用户红娘列表
  */
 public function actionUserMatchmakerList()
 {
     $list = AuthUser::getInstance()->getUserMatchmaker($this->get);
     $this->renderAjax(['status' => 1, 'data' => $list]);
 }
Exemple #3
0
 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();
 }