刷新所有用户基本信息

@since 0.0.1
@param {integer} [$page=1] 页码
@return {boolean}
@example \Yii::$app->wechat->refreshUsers($page);
494140
public function refreshUsers($page = 1) {
		$query = WechatUser::find()->where(['appid' => $this->app->appid])->select('openid');

		$pageSize = 100;
		$pagination = new Pagination([
			'totalCount' => $query->count(),
			'defaultPageSize' => $pageSize,
			'pageSizeLimit' => [0, $pageSize],
		]);
		$pagination->setPage($page - 1, true);

		$users = $query->offset($pagination->offset)
			->limit($pagination->limit)
			->asArray()
			->all();

		$user_list = [];
		foreach($users as $user) {
			$user['lang'] = \Yii::$app->language;
			$user_list['user_list'][] = $user;
		}

		if($user_list) {
			$data = $this->getData('/cgi-bin/user/info/batchget', [
				'access_token' => $this->getAccessToken(),
			], Json::encode($user_list));
			if(isset($data['user_info_list'])) {
				foreach($data['user_info_list'] as $_user) {
					$user = WechatUser::findOne(['appid' => $this->app->appid, 'openid' => $_user['openid']]);
					if(!$user) {
						$user = new WechatUser;
						$user->appid = $this->app->appid;
						$user->openid = $_user['openid'];
					}
					$user->subscribe = $_user['subscribe'];
					if($user->subscribe == 1) {
						$user->subscribed_at = $_user['subscribed_at'];
						$user->name = $_user['nickname'];
						$user->sex = $_user['sex'];
						$user->country = $_user['country'];
						$user->city = $_user['city'];
						$user->province = $_user['province'];
						$user->language = $_user['language'];
						$user->headimgurl = $_user['headimgurl'];
						$user->remark = $_user['remark'];
						$user->groupid = $_user['groupid'];
					}
					if(isset($_user['unionid'])) {
						$user->unionid = $_user['unionid'];
					}
					$user->save();
				}
			}
		}

		return $page < $pagination->pageCount ? $this->refreshUsers($page + 1) : $this->errcode == 0;
	}
476140
public function actionUpdate($id)
    {
        $model = $this->findModel($id);
        if (!empty($this->module->params['pageSizeAdmin'])) {
            $model->pageSize = intval($this->module->params['pageSizeAdmin']);
        }
        $post = Yii::$app->request->post();
        if ($model->load($post) && $model->save()) {
            return $this->redirect(['index', 'page' => $model->page, 'id' => $model->id]);
        } else {
            $rolesModels = [];
            if ($this->showRoles && !$model->isNewRecord) {
                $authItemModel = $this->module->model('AuthItem');
                $allRoles = $authItemModel::find()->where(['like', 'name', 'role'])->all();
                foreach ($allRoles as $role) {
                    $data = [
                        'item_name' => $role->name,
                        'user_id'   => $model->id,
                    ];
                    
                    $authAssignmentModel = $this->module->model('AuthAssignment');
                    $next = $authAssignmentModel::find()->where($data)->one();
                    if (empty($next)) {
                        $data['value'] = false;
                        $next = $this->module->model('AuthAssignment', [$data]);
                    } else {
                        $next->value = true;
                    }
                    $rolesModels[] = $next;
                }
            }
            return $this->render('update', [
                'model' => $model,
                'rolesModels' => $rolesModels,
            ]);
        }
    }
360082
public function update(PageRequest $request, Page $page)
    {
        try {
            $attributes = $request->all();

            $page->update($attributes);
            return $this->response->message(trans('messages.success.updated', ['Module' => trans('page::page.name')]))
                ->code(204)
                ->status('success')
                ->url(guard_url('page/page/' . $page->getRouteKey()))
                ->redirect();
        } catch (Exception $e) {
            return $this->response->message($e->getMessage())
                ->code(400)
                ->status('error')
                ->url(guard_url('page/page/' . $page->getRouteKey()))
                ->redirect();
        }

    }
1219381
public function set_currentpage($page) {
        global $DB;

        if ($this->check_page_access($page)) {
            $DB->set_field('quiz_attempts', 'currentpage', $page, array('id' => $this->get_attemptid()));
            return true;
        }
        return false;
    }
794505
public function listAction($page = 1)
    {
        $paginator = $this->get("knp_paginator");

        if ($paginator instanceof \Knp\Component\Pager\Paginator) ;

        $query = $this->getPaginatorQuery();

        if ($this->getRequest()->get("sort")) {
            $query->orderBy($this->getRequest()->get("sort"), strtolower($this->getRequest()->get("direction")) == "asc" ? "asc" : "desc");
        }

        $pagination = $paginator->paginate(
            $query,
            $page
        );

        $pagination->setTemplate('KnpPaginatorBundle:Pagination:twitter_bootstrap_v3_pagination.html.twig');

        return array(
            'page' => $page,
            'pagination' => $pagination,
            'sort' => $this->getRequest()->get('sort'),
            'direction' => $this->getRequest()->get('direction'),
            'route' => $this->getRouteName(),
            'routeParams' => $this->getRouteParams(),
            'template' => $this->getListTemplate()
        );
    }
978681
public function actionIndex($page = 1)
    {
        $sort = [];
        $params = Yii::$app->request->queryParams;
        if (empty($params['sort'])) {
            $sort['defaultOrder'] = ['parent_uid' => SORT_ASC, 'module_id' => SORT_ASC];
        } else {
            if($params['sort'] == 'module_id') {
                $sort['defaultOrder'] = ['parent_uid' => SORT_ASC, 'module_id' => SORT_ASC];
                unset($params['sort']);
            } else if ($params['sort'] == '-module_id') {
                $sort['defaultOrder'] = ['parent_uid' => SORT_DESC, 'module_id' => SORT_DESC];
                unset($params['sort']);
            }
            Yii::$app->request->setQueryParams($params);
        }

        $dataProvider = new ActiveDataProvider([
            'query' => Modmgr::find(),
            'sort' => $sort,
        ]);

        $pager = $dataProvider->getPagination();
        $pager->pageSize = $this->pageSize;
        $pager->page = $page - 1; //! from 0

        return $this->render('index', [
            'dataProvider' => $dataProvider,
        ]);
    }
892540
public function getPage($page) {
			if (array_key_exists($page, $this->pageCache))
				return $this->pageCache[$page];

			if (!file_exists(sprintf('%s/pages/%s.php', $this->getPluginRoot(), $page)))
				return '<div><strong>Page not found.</strong></div>';
			else {
				ob_start();

				include sprintf('%s/pages/%s.php', $this->getPluginRoot(), $page);

				$data = ob_get_clean();
			}

			$this->pageCache[$page] = $data;

			return $data;
		}
799020
public function setApplicationPage($page)
    {
        if (null !== $page) {
            Assert::string($page, 'The application page must be a string or null. Got: %s');
            Assert::notEmpty($page, 'The application page must not be empty.');
        }

        $this->applicationPage = $page;
    }
1048782
public function setCurrentPage($page)
  {
    $this->currentPage = $page;
    $this->forcedPage = true;
    $this->updateTable();
  }
192935
public function _INDEX_NewPage(&$page)
    {
        if ($page) {
            $oldPage = $this->pdf->getPage();
            $this->pdf->setPage($page);
            $this->pdf->SetXY($this->_margeLeft, $this->_margeTop);
            $this->_maxH = 0;
            $page++;
            return $oldPage;
        } else {
            $this->_setNewPage();
            return null;
        }
    }
1354392
public function fetch($page = 1) {
    $params = $this->params;
    if ($this->paginate) {
      $params = array_merge($params, array('page' => $page));
    }

    $response = $this->client->get($this->path(), $params);
    $data = $response->json();

    if ($this->paginate) {
      $this->total = $data['total'];
      $this->pages = $data['pages'];
      $this->limit = $data['limit'];
      $this->currentPage = $data['current_page'];
      foreach ($data[static::$name] as $i => $deviceData) {
        $position = $i + ($this->currentPage - 1) * $this->limit;
        $this->setResource($position, $deviceData);
      }
    } else {
      $data = current($data);
      $this->total = count($data);
      foreach ($data as $i => $deviceData) {
        $this->setResource($i, $deviceData);
      }
    }
  }
668750
public function getOnlinePrevSibling(Page $page)
    {
        $query = $this->createQueryBuilder('p')
                ->andIsSiblingsOf($page, true, ['_leftnode' => 'DESC', '_position' => 'DESC'], 1, 0)
                ->andIsOnline();

        if (true === $page->hasMainSection()) {
            $query->andIsSection()
                    ->andWhere($query->getSectionAlias().'._leftnode < :leftnode')
                    ->setParameter('leftnode', $page->getLeftnode());
        } else {
            $qOR = $query->expr()->orX();
            $qOR->add('p._section != p')
                    ->add($query->getSectionAlias().'._parent = :parent');

            $query->andWhere('p._position < :position')
                    ->andWhere($qOR)
                    ->setParameter('position', $page->getPosition())
                    ->setParameter('parent', $page->getParent()->getSection());
        }

        return $query->getQuery()
                        ->getOneOrNullResult();
    }
1291910
static function FindPageRights(Page $page)
    {
        $currPage = $page;
        $result = null;
        do 
        {
            $result = $currPage->GetUserGroupRights();
            $currPage = $currPage->GetParent();
        } 
        while (!$result && $currPage);
        if (!$result && $page->GetSite())
        {
            $siteRights = $page->GetSite()->GetUserGroupRights();
            if ($siteRights)
            {
                return $siteRights->GetPageRights();
            }
        }
        return $result;
    }
998705
public function getMetadataAction(Page $page)
    {
        $metadata = null !== $page->getMetaData() ? $page->getMetaData()->jsonSerialize() : array();
        if (empty($metadata)) {
            $metadata = $this->application->getContainer()->get('nestednode.metadata.resolver')->resolve($page);
        }

        return $this->createJsonResponse($metadata);
    }
322050
private function updatePageMenuPosition(Page $page)
    {
        $pageMenuRepository = $this->doctrine->getRepository('FulgurioLightCMSBundle:PageMenu');
        $em = $this->doctrine->getManager();
        $data = $this->request->get('page');
        if (isset($data['availableMenu']))
        {
            if (!is_null($page->getId()))
            {
                $menus = $page->getMenu();
                $alreadyInMenu = array();
                foreach ($menus as $menu)
                {
                    if (!in_array($menu->getLabel(), $data['availableMenu']))
                    {
                        $pageMenuRepository->upMenuPagesPosition($menu->getLabel(), $menu->getPosition() + 1);
                        $em->remove($menu);
                    }
                    else
                    {
                        $alreadyInMenu[] = $menu->getLabel();
                    }
                }
            }
            foreach ($data['availableMenu'] as $menuLabel)
            {
                // If it s a new page, or if it a page which we had a new menu
                if (!isset($alreadyInMenu) || !in_array($menuLabel, $alreadyInMenu))
                {
                    $menu = new PageMenu();
                    $menu->setPosition($pageMenuRepository->getNextMenuPosition($menuLabel));
                    $menu->setLabel($menuLabel);
                    $menu->setPage($page);
                    $em->persist($menu);
                }
            }
        }
        else if (!is_null($page->getId()))
        {
            $menus = $page->getMenu();
            foreach ($menus as $menu)
            {
                $pageMenuRepository->upMenuPagesPosition($menu->getLabel(), $menu->getPosition() + 1);
                $em->remove($menu);
            }
        }
    }
757896
public function getFeedNew($page = 1)
    {
        $this->checkPageNumber($page);

        return $this->adapter->get(sprintf('/feed/new?page=%d', $page));
    }
419832
public function index($page = null)
    {
        $url = sprintf('buckets/%d/client/correspondences.json', $this->bucket);

        $correspondences = $this->client->get($url, [
            'query' => [
                'page' => $page,
            ],
        ]);

        return $this->indexResponse($correspondences, ClientCorrespondence::class);
    }