获取用户列表列表
@param $page 页码(从0开始)
@param $pagesize 每页大小
@param $groupid 分组id
@return array ({contacts:[{id:12345667,nick_name:"昵称",remark_name:"备注名",group_id:0},{}....]})
353052
function getUserList($page=0,$pagesize=10,$groupid=0){
		$send_snoopy = new Snoopy;
		$t = time().strval(mt_rand(100,999));
		$send_snoopy->referer = "https://mp.weixin.qq.com/cgi-bin/contactmanage?t=user/index&pagesize=".$pagesize."&pageidx=".$page."&type=0&groupid=0&lang=zh_CN&token=".$this->_token;
		$send_snoopy->rawheaders['Cookie']= $this->cookie;
		$submit = "https://mp.weixin.qq.com/cgi-bin/contactmanage?t=user/index&pagesize=".$pagesize."&pageidx=".$page."&type=0&groupid=$groupid&lang=zh_CN&f=json&token=".$this->_token;
		$send_snoopy->fetch($submit);
		$result = $send_snoopy->results;
		$this->log('userlist:'.$result);
		$json = json_decode($result,true);
		if (isset($json['contact_list'])) {
			$json = json_decode($json['contact_list'],true);
			if (isset($json['contacts']))
				return $json['contacts'];
		}
		return false;
	}
336894
public function All($Page = '') {
      $Session = Gdn::Session();
      $this->Title(T('Inbox'));
      Gdn_Theme::Section('ConversationList');

      list($Offset, $Limit) = OffsetLimit($Page, C('Conversations.Conversations.PerPage', 50));
      
      // Calculate offset
      $this->Offset = $Offset;
      
      $UserID = $this->Request->Get('userid', Gdn::Session()->UserID);
      if ($UserID != Gdn::Session()->UserID) {
         if (!C('Conversations.Moderation.Allow', FALSE)) {
            throw PermissionException();
         }
         $this->Permission('Conversations.Moderation.Manage');
      }
      
      $Conversations = $this->ConversationModel->Get2($UserID, $Offset, $Limit);
      $this->SetData('Conversations', $Conversations->ResultArray());
      
      // Get Conversations Count
      //$CountConversations = $this->ConversationModel->GetCount($UserID);
      //$this->SetData('CountConversations', $CountConversations);
      
      // Build the pager
      if (!$this->Data('_PagerUrl'))
         $this->SetData('_PagerUrl', 'messages/all/{Page}');
      $this->SetData('_Page', $Page);
      $this->SetData('_Limit', $Limit);
      $this->SetData('_CurrentRecords', count($Conversations->ResultArray()));
      
      // Deliver json data if necessary
      if ($this->_DeliveryType != DELIVERY_TYPE_ALL && $this->_DeliveryMethod == DELIVERY_METHOD_XHTML) {
         $this->SetJson('LessRow', $this->Pager->ToString('less'));
         $this->SetJson('MoreRow', $this->Pager->ToString('more'));
         $this->View = 'conversations';
      }
      
      // Build and display page.
      $this->Render();
   }
1043874
public function getNearByPoiList($page = 1, $page_rows = 1000)
    {
        $url = "https://api.weixin.qq.com/wxa/getnearbypoilist?page={$page}&page_rows={$page_rows}&access_token=ACCESS_TOKEN";
        $this->registerApi($url, __FUNCTION__, func_get_args());
        return $this->callGetApi($url);
    }
727433
private function getPagination($page)
    {
        $limit = 5;
        if ($page !== null) {
            if ($page === 'all') {
                $limit = null;
                $page = null;
            } else {
                $page = (int) $page;
            }
        } else {
            $page = 1;
        }

        return ['page' => $page, 'limit' => $limit];
    }
1345419
private function GrantOnPage(Page $page)
    {
        $groups = MembergroupUtil::PageMembergroups($page);
        return $this->GrantByProperties($page->GetGuestsOnly(), $page->GetPublish(), 
                $page->GetPublishFrom(), $page->GetPublishTo(), $groups);
        
    }
207264
public function getRecent($resource_id, $page_size = 20, $page = 1)
    {
        $resource_id = (int) $resource_id;
        if ($resource_id <= 0) {
            throw new \TeamWorkPm\Exception('Invalid param resource_id');
        }

        $page_size = abs((int) $page_size);
        $page      = abs((int) $page);

        $params = [
            'page' => $page,
            'pageSize'=> $page_size
        ];

        return $this->rest->get(
            "$this->resource/$resource_id/$this->action",
            $params
        );
    }
1290735
public function groupJoin($userId, $groupId, $groupName) {
        try{
            if(empty($userId))
                throw new Exception('被同步群信息的用户 Id 不能为空');
            if(empty($groupId))
                throw new Exception('加入的群 Id 不能为空');
            if(empty($groupName))
                throw new Exception('加入的群 Id 对应的名称不能为空');
            $ret = $this->curl('/group/join',
                array(
                    'userId' => $userId,
                    'groupId' => $groupId,
                    'groupName' => $groupName
                )
            );
            if(empty($ret))
                throw new Exception('请求失败');
            return $ret;
        }catch (Exception $e) {
            print_r($e->getMessage());
        }
    }
266402
public function actionIndex($page = 1, $id = 0)
    {
        $searchModel = $this->module->model('UserSearch');
        $params = Yii::$app->request->queryParams;
        $dataProvider = $searchModel->search($params);

        $pager = $dataProvider->getPagination();
        $pager->pageSize = intval($this->module->params['pageSizeAdmin']);
        $pager->totalCount = $dataProvider->getTotalCount();

        // page number correction
        $maxPage = ceil($pager->totalCount / $pager->pageSize);
        if ($page > $maxPage) {
            $pager->page = $maxPage - 1;
        } else {
            $pager->page = $page - 1; //! from 0
        }

        return $this->render('index', [
            'searchModel' => $searchModel,
            'dataProvider' => $dataProvider,
            'currentId'    => $id,
        ]);
    }
1099177
public static <T> List<T> page(int pageNo, int pageSize, List<T> list) {
		if (isEmpty(list)) {
			return new ArrayList<>(0);
		}

		int resultSize = list.size();
		// 每页条目数大于总数直接返回所有
		if (resultSize <= pageSize) {
			if (pageNo <= 1) {
				return Collections.unmodifiableList(list);
			} else {
				// 越界直接返回空
				return new ArrayList<>(0);
			}
		}
		final int[] startEnd = PageUtil.transToStartEnd(pageNo, pageSize);
		if (startEnd[1] > resultSize) {
			startEnd[1] = resultSize;
		}
		return list.subList(startEnd[0], startEnd[1]);
	}
491251
public function querySendDetails($phone, $sendDate, $page=1, $pageSize=10, $bizId="") {
        if(!$phone || !$sendDate){
            return $this->error('参数有误');
        }
        $request = new QuerySendDetailsRequest();
        $request->setPhoneNumber($phone);
        $request->setSendDate($sendDate);
        $request->setPageSize($pageSize);
        $request->setCurrentPage($page);
        if($bizId){
            $request->setBizId($bizId);
        }
        return $this->parseResponse($request, '查询');
    }
39711
public function handleIds($page, $pageSize, $linkField)
    {
        $productsTable = $this->getTable('catalog_product_entity');

        $itemsCountQuery = $this->_resource->getConnection()->select()
            ->from($productsTable, ['count' => 'count(' . $linkField . ')']);

        $numberOfItems = $this->_resource->getConnection()->fetchOne($itemsCountQuery);

        $subFields = ['eid' => 'entity_id'];
        if ($linkField !== 'entity_id') {
            $subFields['eeid'] = $linkField;
        }

        $subSelect = $this->_resource->getConnection()->select()
            ->from($productsTable, $subFields)
            ->order('entity_id')
            ->limit($pageSize, $page);

        $fields = ['minId' => 'min(tmp.eid)', 'maxId' => 'max(tmp.eid)'];
        if ($linkField !== 'entity_id') {
            $fields['minEId'] = 'min(tmp.eeid)';
            $fields['maxEId'] = 'max(tmp.eeid)';
        }

        $idQuery = $this->_resource->getConnection()->select()
            ->from(['tmp' => $subSelect], $fields);

        $minMaxValues = $this->_resource->getConnection()->fetchRow($idQuery);

        $returnArray = [
            'numberOfItems' => (int)$numberOfItems,
            'minId'         => (int)$minMaxValues['minId'],
            'maxId'         => (int)$minMaxValues['maxId'],
        ];

        if (array_key_exists('minEId', $minMaxValues) && array_key_exists('maxEId', $minMaxValues)) {
            $returnArray['minEId'] = $minMaxValues['minEId'];
            $returnArray['maxEId'] = $minMaxValues['maxEId'];
        }

        return $returnArray;
    }
1202038
public function getGuildMember4GuildId($id, $page = 1)
    {
        $memberList = $this->getGuildMemberList4GuildId($id);

        $result = null;
        if ($memberList) {
            $result = $this->getPaginator4QueryBuilder($memberList, $page);
        }

        return $result;
    }
275237
public function getAllGroups($page, $max = 50)
    {
        $query = $this->groupRepo->findAll(false);
        return $this->pagerFactory->createPager($query, $page, $max);
    }
195141
public function ClubUsers(int $id, int $page = 1): array
    {
        return $this->myanimelist->getClubUsers(
            new Request\Club\UserListRequest($id, $page)
        );
    }
83715
public function view(Person $person, Page $page)
    {
        if (!$page->aclEnabled()) {
            return true;
        }

        if ($page->wasCreatedBy($person) || $this->managesPages()) {
            return true;
        }

        $aclGroupIds = $page->getAclGroupIds();

        if (count($aclGroupIds) === 0) {
            return true;
        }

        $groups = $person->getGroups();

        foreach ($groups as $group) {
            if ($aclGroupIds->contains($group->getId())) {
                return true;
            }
        }

        return false;
    }
26905
final public function page($page = 1, $num = 10)
    {
        $page = max($page, 1);
        $start = ($page - 1) * $num;
        $this->limit($num, $start);
        $bak = $this->_sql;
        $infos = $this->_getAll();

        $this->_sql = $bak;
        $querySql = $this->sql;
        $total = $this->count();
        //重新组装两个SQL
        $this->sql = "Rows:" . $querySql . "\n Count:" . $this->sql;
        return [$infos, $total];
    }
406337
public function getApps($page=1, $size=10) {
        $pageable = new Pageable(['page'=>$page, 'size'=>$size]);
        $appClient = new AppClient($this->client);
        $response = $appClient->listAll($pageable);
        return $this->parseResponse($response, '获取App列表');
    }