示例#1
0
文件: User.php 项目: xswolf/baihey
 public function indexIsShowData($user_id)
 {
     if ($user_id) {
         $blacked = UserFollow::getInstance()->getFollowList('blacked', $user_id);
         $follow = UserFollow::getInstance()->getFollowList('followed', $user_id);
         $blackedList = [];
         $followList = [];
         foreach ($blacked as $k => $v) {
             $blackedList[] = $v['user_id'];
         }
         foreach ($follow as $k => $v) {
             $followList[] = $v['user_id'];
         }
         $honestyStatus = UserPhoto::getInstance()->getPhotoList($user_id, 2, 2);
         $headpicStatus = UserPhoto::getInstance()->userHeadpic($user_id);
         return ['status' => 1, 'blacked' => $blackedList, 'follow' => $followList, 'honestyStatus' => $honestyStatus, 'headpicStatus' => $headpicStatus];
     } else {
         return ['status' => 1, 'blacked' => [], 'follow' => [], 'honestyStatus' => [], 'headpicStatus' => []];
     }
 }
示例#2
0
 /**
  * 设置已看状态
  * @return string|void
  */
 public function actionSetChecked()
 {
     if (UserFollow::getInstance()->setFollowChecked($this->get['user_id'])) {
         return $this->renderAjax(['status' => 1, 'message' => '设置成功']);
     }
     return $this->renderAjax(['status' => 0, 'message' => '设置失败']);
 }
示例#3
0
 /**
  * 获取user_info页面所需信息
  */
 public function actionUserInfoPageById()
 {
     $user_id = Cookie::getInstance()->getCookie('bhy_id')->value;
     // 获取用户信息
     $userInfo = User::getInstance()->getUserById($this->get['id']);
     // 获取admin用户信息
     $authUser = new \backend\models\User();
     $authUserInfo = $authUser->authUserById($this->get['id']);
     $authUserInfo = $authUserInfo ? $authUserInfo : [];
     // 获取用户相册
     $userPhoto = UserPhoto::getInstance()->getPhotoList($this->get['id']);
     // 获取用户动态
     $dynamic = UserDynamic::getInstance()->getDynamicList($this->get['id']);
     // 获取关注状态
     $followStatus = UserFollow::getInstance()->getFollowStatus(['user_id' => $user_id, 'follow_id' => $this->get['id']]);
     $followStatus = $followStatus ? $followStatus['status'] : false;
     // 获取被关注状态
     $followedStatus = UserFollow::getInstance()->getFollowStatus(['user_id' => $this->get['id'], 'follow_id' => $user_id]);
     $followedStatus = $followedStatus ? $followedStatus['status'] : false;
     if ($userInfo) {
         $this->renderAjax(['status' => 1, 'userInfo' => $userInfo, 'authUserInfo' => $authUserInfo, 'userPhoto' => $userPhoto, 'dynamic' => $dynamic, 'followStatus' => $followStatus, 'followedStatus' => $followedStatus, 'msg' => 'user_info页面获取信息成功']);
     } else {
         $this->renderAjax(['status' => 0, 'userInfo' => $userInfo, 'authUserInfo' => $authUserInfo, 'userPhoto' => $userPhoto, 'dynamic' => $dynamic, 'followStatus' => $followStatus, 'followedStatus' => $followedStatus, 'msg' => 'user_info页面获取信息失败']);
     }
 }