获取用户列表

@since 0.0.1
@param {string} [$next_openid] 第一个拉取的OPENID, 不填默认从头开始拉取
@return {boolean}
@example \Yii::$app->wechat->getUsers($next_openid);
188185
public function getUsers($next_openid = null) {
		$data = $this->getData('/cgi-bin/user/get', [
			'access_token' => $this->getAccessToken(),
			'next_openid' => $next_openid,
		]);

		if(isset($data['count']) && $data['count'] && isset($data['data']) && isset($data['data']['openid'])) {
			foreach($data['data']['openid'] as $openid) {
				if($user = WechatUser::findOne(['appid' => $this->app->appid, 'openid' => $openid])) {
					if($user->subscribe == 0) {
						$user->subscribe = 1;
						$user->save();
					}
				} else {
					$user = new WechatUser;
					$user->appid = $this->app->appid;
					$user->openid = $openid;
					$user->subscribe = 1;
					$user->save();
				}
			}
		}

		return isset($data['next_openid']) && $data['next_openid'] ? $this->getUsers($data['next_openid']) : $this->errcode == 0;
	}
54530
public function getUserInfo($openid, $lang = 'zh_CN')
    {
        $url = "https://api.weixin.qq.com/cgi-bin/user/info?access_token=ACCESS_TOKEN&openid={$openid}&lang=zh_CN";
        $this->registerApi($url, __FUNCTION__, func_get_args());
        return $this->httpGetForJson($url);
    }
524640
def get_tag_users(self, tag_id, first_user_id=None):
        
        data = {
            'tagid': tag_id,
        }
        if first_user_id:
            data['next_openid'] = first_user_id
        return self._post(
            'user/tag/get',
            data=data
        )
568356
public function getUserGroupId($openId)
    {
        $result = $this->httpRaw(self::WECHAT_USER_GROUP_ID_GET_PREFIX, [
            'openid' => $openId
        ], [
            'access_token' => $this->getAccessToken()
        ]);
        return isset($result['groupid']) ? $result['groupid'] : false;
    }
98663
protected static function cgi_user_get_uri($access_token,$next_openid){
        $param = [
            'access_token' => $access_token,
            'next_openid'  =>$next_openid
        ];
        return self::CGI_USER_GET_URI.http_build_query($param);

    }
761874
public function refreshUser($uid) {
		$user = WechatUser::findOne($uid);
		if(!$user) {
			throw new ErrorException('数据查询失败');
		}

		$data = $this->getData('/cgi-bin/user/info', [
			'access_token' => $this->getAccessToken(),
			'openid' => $user->openid,
			'lang' => \Yii::$app->language,
		]);

		$result = $this->errcode == 0;
		if($result) {
			$user->subscribe = $data['subscribe'];
			if($user->subscribe == 1) {
				$user->subscribed_at = $data['subscribe_time'];
				$user->name = $data['nickname'];
				$user->sex = $data['sex'];
				$user->country = $data['country'];
				$user->city = $data['city'];
				$user->province = $data['province'];
				$user->language = $data['language'];
				$user->headimgurl = $data['headimgurl'];
				$user->remark = $data['remark'];
				$user->groupid = $data['groupid'];
			}
			if(isset($data['unionid'])) {
				$user->unionid = $data['unionid'];
			}
			$user->save();
		}

		return $result;
	}
1319148
public GetUsersResponse getUsers(String nextOpenid) {
        GetUsersResponse response;
        LOG.debug("获取关注者列表.....");
        String url = BASE_API_URL + "cgi-bin/user/get?access_token=#";
        if (StrUtil.isNotBlank(nextOpenid)) {
            url += "&next_openid=" + nextOpenid;
        }
        BaseResponse r = executeGet(url);
        String resultJson = isSuccess(r.getErrcode()) ? r.getErrmsg() : r.toJsonString();
        response = JSONUtil.toBean(resultJson, GetUsersResponse.class);
        return response;
    }
376753
public function getUserId()
    {
        $params = Yii::$app->request->queryParams;
        if (empty($params['access-token'])) return false;
        $uid = $this->userIdentity->findIdentityByAccessToken($params['access-token']);
        if (empty($uid->id)) return false;
        else return $uid->id;
    }
1166169
public static function getUserID()
    {
        $user = Yii::$app->getUser();

        return $user && !$user->getIsGuest() ? $user->getId() : 0;
    }
61038
public function get_auth_user($openid , $access_token , $lang = 'zh_CN'){

        $url = self::API_URI . self::AUTH_USER_URI;
        $param['access_token'] = $access_token;
        $param['openid'] = $openid;
        $param['lang'] = $lang;

        $user_info_url = $this->create_url($url, $param);
        $data = $this->http_get($user_info_url);

        return $this->return_data($data);
    }
938500
public function wechatFans($original, $openId)
    {
        return $this->orWhere([
            'from' => $openId,
            'to' => $original
        ])->orWhere([
            'to' => $openId,
            'from' => $original
        ]);
    }
1026560
public function read($id, $next)
    {
        return empty($this->handler->read($id)) ? $next($id) : $this->handler->read($id);
    }
127546
public function getGroupId($openId)
    {
        $result = $this->httpRaw(self::WECHAT_GET_GROUP_ID_URL . 'access_token=' . $this->getAccessToken(), [
            'openid' => $openId
        ]);
        return isset($result['groupid']) ? $result['groupid'] : false;
    }
954808
public function setUsersTag($tagid, array $openid_list)
    {
        if (!is_array($openid_list)) {
            $this->setError('参数必须为一个数组');

            return false;
        }

        $queryStr = [
            'openid_list' => $openid_list,
            'tagid'       => $tagid,
        ];

        $res = $this->_post('members/batchtagging', $queryStr);

        return $res;
    }
473058
public function openidWxcard($card_id = '', $openids = [])
    {
        $queryStr                      = [];
        $queryStr['touser']            = $openids;
        $queryStr['wxcard']['card_id'] = $card_id;
        $queryStr['msgtype']           = 'wxcard';

        $this->module = 'message';

        $res = $this->_post('mass/send', $queryStr);

        return $res;
    }
15864
public function getUserId()
    {
        if (
            \Yii::$app !== null
            && \Yii::$app->has('user', true)
            && \Yii::$app->getUser() !== null
        ) {
            $user = \Yii::$app->getUser()->getIdentity(false);
            if ($user !== null) {
                return $user->getId();
            }
        }
        return null;
    }
644845
public function getMemberList($nextOpenId = null)
    {
        $nextOpenId === null && $nextOpenId = ['next_openid' => $nextOpenId];
        $result = $this->httpGet(self::WECHAT_MEMBER_GET_URL . 'access_token=' . $this->getAccessToken(), $nextOpenId);
        return !isset($result['errcode']) ? $result : false;
    }