Ejemplo n.º 1
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');
 }
Ejemplo n.º 2
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');
 }
Ejemplo n.º 3
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');
 }
Ejemplo n.º 4
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}', '', '');
 }