Beispiel #1
0
        public async Task <IActionResult> CreateMemberQrcode([FromQuery] string cardId, [FromServices] IUtilRepository util)
        {
            var token = await util.GetTokenAsync(Business.WeChatAppId, Business.WeChatSecret);

            var result = await WxHelper.GetCardQrcodeAsync(token, new { action_name = "QR_CARD", action_info = new { card = new { card_id = cardId, outer_str = "m1" } } });

            var json   = JObject.Parse(result);
            var qrcode = UtilHelper.CreateCodeEwm(json["url"].ToString());

            return(File(qrcode, "image/jpeg"));
        }
Beispiel #2
0
        /// <summary>
        /// 消息管理
        /// </summary>
        /// <returns></returns>
        public async Task <IActionResult> Message()
        {
            if (string.IsNullOrEmpty(Business.WxQrListenPath))
            {
                if (string.IsNullOrEmpty(Business.WeChatAppId))
                {
                    throw new Exception("未设置公众号AppId");
                }
                var util  = HttpContext.RequestServices.GetService <IUtilRepository>();
                var token = await util.GetTokenAsync(Business.WeChatAppId, Business.WeChatSecret);

                var ticket = await WxHelper.GetTicketAsync(Business.ID, token);

                var qrCode = UtilHelper.CreateCodeEwm(ticket.url);
                var source = Convert.ToBase64String(qrCode);
                Business.WxQrListenPath = await Service.UploadAsync(AppData.ApiUri + "/Upload/Qrcode", Business.ID, source);

                Service.SaveWxQrcode(Business);
                SaveSession();
            }
            ViewBag.list = Service.GetWxListenUser(Business.ID);
            return(View(Business));
        }
Beispiel #3
0
        public IActionResult Qrcode([FromQuery] string code)
        {
            var file = UtilHelper.CreateCodeEwm(code, 231, 231);

            return(File(file, "image/jpeg"));
        }
Beispiel #4
0
        /// <summary>
        /// 获取支付二维码
        /// </summary>
        /// <param name="code"></param>
        /// <returns></returns>
        public IActionResult GetPayEwm([FromQuery] string code)
        {
            var img = UtilHelper.CreateCodeEwm(code, 231, 231);

            return(File(img, "image/jpeg"));
        }