예제 #1
0
        /// <summary>
        /// 获取用户信息
        /// </summary>
        /// <param name="wechatUserRequest">wechatUserRequest</param>
        /// <param name="config">config</param>
        /// <returns>关注的openid</returns>
        public static WechatUser GetWechatUser(WechatUserRequest wechatUserRequest, Config config)
        {
            string     url        = TenpayUtil.GetUserUrl(wechatUserRequest, config, false);
            var        strSendRes = HttpHelp.GetUrl(url);
            WechatUser wechatUser = JsonConvert.DeserializeObject <WechatUser>(strSendRes);

            if (wechatUser.Errcode == "40001")
            {
                string url1        = TenpayUtil.GetUserUrl(wechatUserRequest, config, true);
                var    strSendRes1 = HttpHelp.GetUrl(url1);
                wechatUser = JsonConvert.DeserializeObject <WechatUser>(strSendRes1);
            }
            return(wechatUser);
        }