コード例 #1
0
ファイル: CRMComm.cs プロジェクト: xiaovane/travel_youxing
        /// <summary>
        /// (基础方法)获得所有关注用户的openid字符串(递归算法)
        /// </summary>
        private void GetNextUserOpenId(int accountId, string nexOpenid, IList <string> openidList)
        {
            string err          = string.Empty;
            string access_token = GetAccessToken(accountId, out err);

            Senparc.Weixin.MP.AdvancedAPIs.OpenIdResultJson openidJson = Senparc.Weixin.MP.AdvancedAPIs.User.Get(access_token, nexOpenid);
            if (openidJson == null || openidJson.count <= 0)
            {
                return;
            }
            else
            {
                for (int i = 0; i < openidJson.data.openid.Count; i++)
                {
                    openidList.Add(openidJson.data.openid[i]);
                }
                GetNextUserOpenId(accountId, openidJson.next_openid, openidList);
            }
        }
コード例 #2
0
ファイル: CRMComm.cs プロジェクト: xiaovane/travel_youxing
        /// <summary>
        /// 获得所有关注用户的openid字符串(别的方法调用此方法)
        /// </summary>
        private IList <string> BaseUserOpenId(int uid, out string error)
        {
            IList <string> ret = new List <string>();

            string access_token = GetAccessToken(uid, out error);

            if (error != "")
            {
                return(null);
            }
            Senparc.Weixin.MP.AdvancedAPIs.OpenIdResultJson openidJson = Senparc.Weixin.MP.AdvancedAPIs.User.Get(access_token, string.Empty);
            if (openidJson.count == openidJson.total)
            {
                ret = openidJson.data.openid;
            }
            else
            {
                GetNextUserOpenId(uid, openidJson.next_openid, ret);
            }
            return(ret);
        }