.net C# 微信小程序生成分享二维码

string access_token2 = WxPayConfig.GetConfig().IsExistAccess_Token();
RestClient client = new RestClient(“https://api.weixin.qq.com/wxa/getwxacodeunlimit?access_token=” + access_token2);
RestRequest request = new RestRequest("", HttpMethod.POST);
request.RequestFormat = RequestDataFormat.Json;

                request.AddBody(new { scene = lid.Value.ToString("N"), });

                var response = client.ExecuteAsync<object>(request);
                byte[] tt = response.Result.RawBytes;
                if (tt.Length > 1000)
                {
                    if (System.IO.Directory.Exists(HttpContext.Current.Server.MapPath(path)) == false)//如果不存在就创建file文件夹
                    {
                        System.IO.Directory.CreateDirectory(HttpContext.Current.Server.MapPath(path));
                    }

                    System.IO.File.WriteAllBytes(HttpContext.Current.Server.MapPath(siteFullPath), tt);//讲byte[]存储为图片
                }
                else
                {

                    LoginRecordDAL.Instance.AddLoginRecord(new loginRecord { msg = "getshare异常数据", userId = Guid.NewGuid() });

                }
发布了55 篇原创文章 · 获赞 2 · 访问量 6万+

猜你喜欢

转载自blog.csdn.net/wqs15192095633/article/details/90299384