public ActionResult Manager(Guid appId)
        {
            ViewBag.AppId = appId;
            WeChatQRCodeFacade facade = new WeChatQRCodeFacade();

            ViewBag.QRTypes = facade.GetQrCodeTypeList(new Deploy.CustomDTO.WeChatQRCodeSearchDTO {
                AppId = appId
            }).Data;
            return(View());
        }
        public ActionResult Manager(WeChatQRCodeSearchDTO dto, int page)
        {
            dto.AppId     = (Guid)Session["APPID"];
            dto.PageIndex = page;
            WeChatQRCodeFacade facade = new WeChatQRCodeFacade();
            var result = facade.GetWechatQrCodeList(dto);

            if (result.isSuccess)
            {
                return(Json(new
                {
                    data = result.Data.List,
                    records = result.Data.Count,
                    page = dto.PageIndex
                }));
            }
            return(Json(result));
        }
        /// <summary>
        /// 导出Excel
        /// </summary>
        /// <param name="dto"></param>
        /// <returns></returns>
        public ActionResult ExportExcel(WeChatQRCodeSearchDTO dto)
        {
            dto.AppId     = (Guid)Session["APPID"];
            dto.PageIndex = 1;
            dto.PageSize  = int.MaxValue;
            WeChatQRCodeFacade facade = new WeChatQRCodeFacade();
            var qrCodes = facade.GetWechatQrCodeList(dto);
            var sbHtml  = new StringBuilder();

            sbHtml.Append("<table border='1' cellspacing='0' cellpadding='0'>");
            sbHtml.Append("<tr>");
            var lstTitle = new List <string> {
                "推广渠道", "微信公众号名称", "微信AppID", "微信AppSecret", "二维码链接", "绑定状态", "是否启用", "备注"
            };

            foreach (var item in lstTitle)
            {
                sbHtml.AppendFormat("<td style='font-size: 14px;text-align:center;background-color: #DCE0E2; font-weight:bold;' height='25'>{0}</td>", item);
            }
            sbHtml.Append("</tr>");
            foreach (var model in qrCodes.Data.List)
            {
                sbHtml.Append("<tr>");
                sbHtml.AppendFormat("<td style='font-size: 12px;height:20px;'>{0}</td>", model.QrTypeDesc);
                sbHtml.AppendFormat("<td style='font-size: 12px;height:20px;'>{0}</td>", model.WeChatPublicCode);
                sbHtml.AppendFormat("<td style='font-size: 12px;height:20px;'>{0}</td>", model.AppId);
                sbHtml.AppendFormat("<td style='font-size: 12px;height:20px;'>{0}</td>", model.AppId);
                sbHtml.AppendFormat("<td style='font-size: 12px;height:20px;'><a href='{0}'>{0}</a></td>", "https://mp.weixin.qq.com/cgi-bin/showqrcode?ticket=" + model.WeChatTicket);
                sbHtml.AppendFormat("<td style='font-size: 12px;height:20px;'>{0}</td>", model.IsUse ? "已绑定" : "未绑定");
                sbHtml.AppendFormat("<td style='font-size: 12px;height:20px;'>{0}</td>", model.IsDel == 0 ? "是" : "否");
                sbHtml.AppendFormat("<td style='font-size: 12px;height:20px;'>{0}</td>", model.Description);
                sbHtml.Append("</tr>");
            }
            sbHtml.Append("</table>");
            return(File(System.Text.Encoding.UTF8.GetBytes(sbHtml.ToString()), "application/ms-excel", string.Format("带参数二维码{0}.xls", DateTime.Now.ToString("yyyyMMddHHmmss"))));
        }
        /// <summary>
        /// 启用、停用二维码
        /// </summary>
        /// <param name="dto"></param>
        /// <returns></returns>
        public ActionResult UpdateState(WeChatQRCodeUpdateStateDTO dto)
        {
            WeChatQRCodeFacade facade = new WeChatQRCodeFacade();

            return(Json(facade.UpdateState(dto)));
        }
        /// <summary>
        /// 批量创建公众号二维码
        /// </summary>
        /// <returns></returns>
        public ActionResult CreateQrCode(QrCodeCreateDTO dto)
        {
            WeChatQRCodeFacade facade = new WeChatQRCodeFacade();

            return(Json(facade.CreateWeChatQrCodeBatch(dto)));
        }