Exemplo n.º 1
0
 /**
  * 我看过谁
  */
 public function tovisitAction()
 {
     $space = $this->_getSpaceDs()->getSpace($this->loginUser->uid);
     $visitors = $space['tovisitors'] ? unserialize($space['tovisitors']) : array();
     $uids = array_keys($visitors);
     if ($uids) {
         $userList = Wekit::load('user.PwUser')->fetchUserByUid($uids, PwUser::FETCH_MAIN | PwUser::FETCH_DATA | PwUser::FETCH_INFO);
         $userList = $this->_buildData($userList, $uids);
         $follows = $this->_getAttentionDs()->fetchFollows($this->loginUser->uid, $uids);
         $fans = $this->_getAttentionDs()->fetchFans($this->loginUser->uid, $uids);
         $friends = array_intersect_key($fans, $follows);
         $this->setOutput($friends, 'friends');
         $this->setOutput($userList, 'userList');
         $this->setOutput($follows, 'follows');
         $this->setOutput($fans, 'fans');
     } else {
         Wind::import('SRV:user.vo.PwUserSo');
         $vo = new PwUserSo();
         $vo->orderbyLastpost(false);
         $lastPostUser = Wekit::load('SRV:user.PwUserSearch')->searchUser($vo, 2);
         if ($lastPostUser) {
             unset($lastPostUser[$this->loginUser->uid]);
             $lastPostUser = array_keys($lastPostUser);
             $this->setOutput($lastPostUser[0], 'lastPostUser');
         }
     }
     $this->setOutput($visitors, 'visitors');
 }
Exemplo n.º 2
0
 /** 
  * 搜索用户
  */
 public function searchAction()
 {
     list($username, $usertag) = $this->getInput(array('username', 'usertag'));
     $page = intval($this->getInput('page'));
     $username = trim($username);
     $usertag = trim($usertag);
     $page < 1 && ($page = 1);
     $perpage = 20;
     list($start, $limit) = Pw::page2limit($page, $perpage);
     $usertags = $this->_getUserTagService()->getUserTagList($this->loginUser->uid);
     !$usertags && ($hotTags = $this->_getUserTagDs()->getHotTag(10));
     $args = array();
     if ($username) {
         // 按用户名搜索
         Wind::import('SRV:user.vo.PwUserSo');
         $vo = new PwUserSo();
         $vo->setUsername($username);
         $searchDs = Wekit::load('SRV:user.PwUserSearch');
         $count = $searchDs->countSearchUser($vo);
         if ($count) {
             $users = $searchDs->searchUser($vo, $limit, $start);
             $uids = array_keys($users);
         }
         $args['username'] = $username;
     }
     if ($usertag) {
         // 按用户标签搜索
         $tagInfo = $this->_getUserTagDs()->getTagByName($usertag);
         if ($tagInfo) {
             $count = $this->_getUserTagRelationDs()->countRelationByTagid($tagInfo['tag_id']);
             $tagRelations = $this->_getUserTagRelationDs()->getRelationByTagid($tagInfo['tag_id'], $limit, $start);
             $uids = array();
             foreach ($tagRelations as $v) {
                 $uids[] = $v['uid'];
             }
         }
         $args['usertag'] = $usertag;
     }
     if ($uids) {
         $userList = Wekit::load('user.PwUser')->fetchUserByUid($uids, PwUser::FETCH_MAIN | PwUser::FETCH_DATA | PwUser::FETCH_INFO);
         $follows = $this->_getAttentionDs()->fetchFollows($this->loginUser->uid, $uids);
         $fans = $this->_getAttentionDs()->fetchFans($this->loginUser->uid, $uids);
         $friends = array_intersect_key($fans, $follows);
         $this->setOutput($fans, 'fans');
         $this->setOutput($friends, 'friends');
         $this->setOutput($userList, 'userList');
         $this->setOutput($follows, 'follows');
     }
     $this->setOutput($page, 'page');
     $this->setOutput($perpage, 'perpage');
     $this->setOutput($count, 'count');
     $this->setOutput($args, 'args');
     $this->setOutput($hotTags, 'hotTags');
     $this->setOutput($usertags, 'usertags');
 }
Exemplo n.º 3
0
 public function run()
 {
     /* @var $groupDs PwUserGroups */
     $groupDs = Wekit::load('usergroup.PwUserGroups');
     $groups = $groupDs->getNonUpgradeGroups();
     $groups[0] = $this->upgradeGroups;
     ksort($groups);
     list($sName, $sUid, $sEmail, $sGroup, $page) = $this->getInput(array('username', 'uid', 'email', 'gid', 'page'));
     $vo = new PwUserSo();
     $sName && $vo->setUsername($sName);
     $sUid && $vo->setUid($sUid);
     $sEmail && $vo->setEmail($sEmail);
     !$sGroup || in_array(-1, $sGroup) || $vo->setGid($sGroup);
     $page = intval($page) == 0 ? 1 : abs(intval($page));
     /* @var $searchDs PwUserSearch */
     $searchDs = Wekit::load('SRV:user.PwUserSearch');
     $count = $searchDs->countSearchUser($vo);
     $result = array();
     if (0 < $count) {
         $totalPage = ceil($count / $this->pageNumber);
         $page > $totalPage && ($page = $totalPage);
         /* @var $searchDs PwUserSearch */
         $searchDs = Wekit::load('user.PwUserSearch');
         list($start, $limit) = Pw::page2limit($page, $this->pageNumber);
         $result = $searchDs->searchUser($vo, $limit, $start);
         if ($result) {
             /* @var $userDs PwUser */
             $userDs = Wekit::load('user.PwUser');
             $list = $userDs->fetchUserByUid(array_keys($result), PwUser::FETCH_DATA);
             $result = WindUtility::mergeArray($result, $list);
         }
     }
     $data = $vo->getData();
     (!$sGroup || in_array(-1, $sGroup)) && ($data['gid'] = array(-1));
     $this->setOutput($data, 'args');
     $this->setOutput($page, 'page');
     $this->setOutput($this->pageNumber, 'perPage');
     $this->setOutput($count, 'count');
     $this->setOutput($result, 'list');
     $this->setOutput($groups, 'groups');
 }
 /**
  * 用于推送时的指定数据获取
  * @see src/service/design/srv/model/PwDesignModelBase::_fetchData()
  */
 protected function fetchData($ids)
 {
     Wind::import('SRV:user.vo.PwUserSo');
     $so = new PwUserSo();
     $so->setUid($ids);
     $list = Wekit::load('user.PwUserSearch')->searchUserAllData($so);
     return $this->_buildSignKey($list);
 }
Exemplo n.º 5
0
 /**
  * 根据条件统计用户
  *
  * @param PwUserSo $vo
  * @return array
  */
 public function countSearchUser(PwUserSo $vo)
 {
     return $this->_getDao()->countSearchUser($vo->getData());
 }
Exemplo n.º 6
0
 /**
  * do群发消息
  *
  * @return void
  */
 public function doSendAction()
 {
     list($type, $content, $title, $step, $countStep) = $this->getInput(array('type', 'content', 'title', 'step', 'countStep'));
     !$content && $this->showError('Message:content.empty');
     if ($step > $countStep) {
         $this->showMessage("ADMIN:success");
     }
     $step = $step ? $step : 1;
     switch ($type) {
         case 1:
             // 根据用户组
             list($user_groups, $grouptype) = $this->getInput(array('user_groups', 'grouptype'));
             Wind::import('SRV:user.vo.PwUserSo');
             $vo = new PwUserSo();
             $searchDs = Wekit::load('SRV:user.PwUserSearch');
             if (!$user_groups) {
                 $this->showError('Message:user.groups.empty');
             }
             if ($grouptype == 'memberid') {
                 $vo->setMemberid($user_groups);
             } else {
                 $vo->setGid($user_groups);
             }
             $count = $searchDs->countSearchUser($vo);
             $countStep = ceil($count / $this->perstep);
             if ($step <= $countStep) {
                 list($start, $limit) = Pw::page2limit($step, $this->perstep);
                 $userInfos = $searchDs->searchUser($vo, $limit, $start);
             }
             break;
         case 2:
             // 根据用户名
             $touser = $this->getInput('touser');
             !$touser && $this->showError('Message:receive.user.empty');
             $touser = explode(' ', $touser);
             $count = count($touser);
             $countStep = ceil($count / $this->perstep);
             if ($step <= $countStep) {
                 $userDs = Wekit::load('user.PwUser');
                 list($start, $limit) = Pw::page2limit($step, $this->perstep);
                 $userInfos = $userDs->fetchUserByName(array_slice($touser, $start, $limit));
             }
             break;
         case 3:
             // 根据在线用户(精确在线)
             $onlineService = Wekit::load('online.srv.PwOnlineCountService');
             list($count, $userInfos) = $onlineService->getVisitorList('', $step, $this->perstep, true);
             $countStep = ceil($count / $this->perstep);
             break;
     }
     $result = $this->sendNoticeByUsers((array) $userInfos, $content, strip_tags($title));
     if ($result instanceof PwError) {
         $this->showError($result->getError());
     }
     $haveBuild = $step * $this->perstep;
     $haveBuild = $haveBuild > $count ? $count : $haveBuild;
     $step++;
     usleep(500);
     $data = array('step' => $step, 'countStep' => $countStep, 'count' => $count, 'haveBuild' => $haveBuild);
     echo Pw::jsonEncode(array('data' => $data));
     exit;
 }
 /**
  * 根据规则获取推荐关注 | 先从在线用户取数据,大站20个在线用户总有的吧,20个在线用户都没有,那就慢查吧根据发帖数
  * 
  * @param $uid 
  * @param $num 
  * @return array
  */
 public function getRecommendAttention($uid, $num)
 {
     $uids = $this->getOnlneUids(20);
     $onlineCount = count($uids);
     if ($onlineCount < $num) {
         $num = $num - $onlineCount;
         Wind::import('SRV:user.vo.PwUserSo');
         $vo = new PwUserSo();
         $vo->orderbyPostnum(true);
         $searchDs = Wekit::load('SRV:user.PwUserSearch');
         $result = $searchDs->searchUser($vo, $num);
         $uids = array_merge($uids, array_keys($result));
     }
     return array_unique(array_diff($uids, array($uid)));
 }
Exemplo n.º 8
0
 /**
  * 认证会员管理
  *
  */
 public function usersAction()
 {
     list($page, $perpage, $username, $type) = $this->getInput(array('page', 'perpage', 'username', 'type'));
     $page = $page ? $page : 1;
     $perpage = $perpage ? $perpage : $this->perpage;
     list($start, $limit) = Pw::page2limit($page, $perpage);
     if ($username) {
         Wind::import('SRV:user.vo.PwUserSo');
         $vo = new PwUserSo();
         $vo->setUsername($username);
         $searchDs = Wekit::load('SRV:user.PwUserSearch');
         $userInfos = $searchDs->searchUser($vo, $perpage);
     }
     Wind::import('EXT:verify.service.vo.App_Verify_So');
     $so = new App_Verify_So();
     $userInfos && $so->setUid(array_keys($userInfos));
     if ($type) {
         $bitType = 1 << $type - 1;
         $so->setType($bitType);
     }
     $count = $this->_getDs()->countSearchVerify($so);
     if ($count) {
         $list = $this->_getDs()->searchVerify($so, $limit, $start);
         $list = $this->_buildData($list);
     }
     $verifyTypes = $this->_getService()->getVerifyType();
     $this->setOutput($verifyTypes, 'verifyTypes');
     $this->setOutput($page, 'page');
     $this->setOutput($perpage, 'perpage');
     $this->setOutput($count, 'count');
     $this->setOutput($list, 'list');
     $this->setOutput(array('username' => $username, 'type' => $type), 'args');
 }
Exemplo n.º 9
0
 public function userAction()
 {
     if (($result = $this->_checkRight()) instanceof PwError) {
         $this->showError($result->getError());
     }
     list($page, $perpage, $keywords, $limittime, $orderby) = $this->getInput(array('page', 'perpage', 'keywords', 'limittime', 'orderby'));
     $args = array();
     if ($keywords) {
         //最后搜索时间
         if (($result = $this->_checkSearch()) instanceof PwError) {
             $this->showError($result->getError());
         }
         $page = $page ? $page : 1;
         $perpage = $perpage ? $perpage : $this->perpage;
         list($start, $limit) = Pw::page2limit($page, $perpage);
         Wind::import('SRV:user.vo.PwUserSo');
         $keywords = urldecode($keywords);
         $so = new PwUserSo();
         $so->setUsername($keywords)->orderbyLastpost(0);
         $limittime && $so->setRegdate($this->_getLimitTime($limittime));
         $count = $this->_getSearchService()->countSearchUser($so);
         $count = $count > $this->maxNum ? $this->maxNum : $count;
         if ($count) {
             $users = $this->_getSearchService()->searchUser($so, $limit, $start);
             $users = $this->_getSearchService()->buildUsers($users, $keywords);
             $uids = array_keys($users);
             $follows = Wekit::load('attention.PwAttention')->fetchFollows($this->loginUser->uid, $uids);
             $fans = Wekit::load('attention.PwAttention')->fetchFans($this->loginUser->uid, $uids);
             $friends = array_intersect_key($fans, $follows);
             $this->setOutput($fans, 'fans');
             $this->setOutput($friends, 'friends');
             $this->setOutput($follows, 'follows');
             $this->_replaceRecord($keywords, App_Search_Record::TYPE_USER);
         }
         $this->setOutput($page, 'page');
         $this->setOutput($perpage, 'perpage');
         $this->setOutput($count, 'count');
         $this->setOutput(array('keywords' => $keywords), 'args');
         $this->setOutput($users, 'users');
     }
     $this->setOutput(App_Search_Record::TYPE_USER, 'recordType');
     $this->setTemplate('index_user');
     //seo设置
     $seoBo->setCustomSeo($keywords . ' - {sitename}', '', '');
 }