Exemple #1
0
        /// <summary>
        /// 同步处理,递归算法
        /// </summary>
        /// <param name="totCount"></param>
        /// <param name="wid"></param>
        /// <param name="accessToken"></param>
        /// <param name="nexOpenid"></param>
        /// <param name="updateTime"></param>
        public string  SysPersonFun(int totCount, int wid, string accessToken, string nexOpenid, DateTime updateTime)
        {
            string ret = "";

            OpenIdResultJson gJson = Senparc.Weixin.MP.AdvancedAPIs.User.Get(accessToken, nexOpenid);

            List <string> openidStr = gJson.data.openid;//此次拉取的openid字符串

            totCount += InsertUserInfo(wid, accessToken, openidStr, updateTime);


            if (gJson.next_openid != "" && gJson.count == 1000)
            {
                SysPersonFun(totCount, wid, accessToken, gJson.next_openid, updateTime);
            }
            else
            {
                int sjTtCount = gJson.total;
                if (sjTtCount == totCount)
                {
                    //将此次同步的日期更新到设置表里
                    BLL.wx_crm_setting setBll = new BLL.wx_crm_setting();
                    setBll.UpdatePersonSysDate(wid, totCount, updateTime);
                    ret = "粉丝同步成功!";
                }
                else
                {
                    ret = "粉丝同步失败!";
                }
            }

            return(ret);
        }