Пример #1
0
        public async Task <JsonResult> QRCode(string AccessToken)
        {
            using (var client = new WxApiClient())
            {
                var sw = new Stopwatch();
                sw.Start();
                var request = new WxApiGetWXACodeUnlimitRequest
                {
                    Scene       = "121992",
                    AccessToken = AccessToken,
                    Page        = "pages/index/index",
                    Auto_color  = false,
                    Line_color  = new Line_Color {
                        R = "0", B = "0", G = "0"
                    },
                    //Width = t.Width
                };
                var result = await client.ExecuteAsync(request);

                logger.Info($"返回的Msg:{result.Errmsg}");
                if (result != null && result.Buffer != null)
                {
                    //var image = Convert.ToBase64String(result.Buffer);
                    var time = sw.ElapsedMilliseconds;
                    sw.Stop();

                    return(Json(new { Success = true, Data = result.Buffer }));
                }

                var time1 = sw.ElapsedMilliseconds;
                sw.Stop();

                return(Json(new { Success = false, Msg = "失败" }));
            }
        }
Пример #2
0
        public async Task <JsonResult> GetWXACodeUnlimit(string access_token)
        {
            using (var client = new WxApi.WxApiClient())
            {
                var request = new WxApiGetWXACodeUnlimitRequest()
                {
                    AccessToken = "40_hcbBQzdwy7OH9gCz2RU3rI8uWt2R4i6aeswD-VHj_5aZJD04a88gJ-r3IMaVzf8n9hMUudL_5U_VoKBroSV4EAtMErT789YBr_0yCrRGEVt7EtnMMbz4NTGS5tl7T0r9aPl77cHv5hn8LheBJCUdAIAVOG",
                    Scene       = "121212",
                    Auto_color  = false,
                    Line_color  = new Line_Color {
                        B = "0", G = "0", R = "0"
                    },
                    Page = "pages/index/index",
                };
                var response = await client.ExecuteAsync(request);

                return(Json(new { Code = 1, Msg = "成功", Data = response }));
            }
        }