public ActionResult CreateWeChatQrCodeByCustomAppId(Deploy.CustomDTO.CateringDTO.WeChatQRCodeDTO cdto)
 {
     if (cdto == null)
     {
         return(Json(new Deploy.CustomDTO.ResultDTO {
             isSuccess = false, Message = "参数为空"
         }));
     }
     cdto.appId = CustomConfig.WeChatSpreader.AppId;
     return(CreateWeChatQrCodeByAppId(cdto));
 }
        Deploy.CustomDTO.ResultDTO <string> GetWeChatTicket(Deploy.CustomDTO.CateringDTO.WeChatQRCodeDTO cdto)
        {
            ISV.Facade.WeChatQRCodeFacade            facade = new ISV.Facade.WeChatQRCodeFacade();
            Deploy.CustomDTO.WeChat.ForeverQrcodeDTO param  = new Deploy.CustomDTO.WeChat.ForeverQrcodeDTO
            {
                UseDeveloperId     = true,
                AppId              = cdto.WeChatAppId,
                JhAppId            = cdto.appId,
                AppSecret          = cdto.weChatSecret,
                SceneStr           = string.Format("qrtype={0}", cdto.id),
                IsAppWeChatSetting = cdto.IsAppWeChatSetting
            };

            Deploy.CustomDTO.ResultDTO <string> ret = facade.CreateForeverQrcode(param);
            return(ret);
        }
        public ActionResult CreateWeChatQrCodeByAppId(Deploy.CustomDTO.CateringDTO.WeChatQRCodeDTO cdto)
        {
            if (cdto == null)
            {
                return(Json(new Deploy.CustomDTO.ResultDTO {
                    isSuccess = false, Message = "参数为空"
                }));
            }
            cdto.IsAppWeChatSetting = true;
            var searchResult = WCPSV.Instance.GetDeveloperInfo(cdto.appId);

            if (searchResult == null)
            {
                return(Json(new Deploy.CustomDTO.ResultDTO {
                    isSuccess = false, Message = "应用未配置公众号信息"
                }));
            }
            cdto.WeChatAppId  = searchResult.WAppId;
            cdto.weChatSecret = searchResult.WSecret;
            return(CreateWeChatQrCode(cdto));
        }
        public ActionResult CreateWeChatQrCode(Deploy.CustomDTO.CateringDTO.WeChatQRCodeDTO cdto)
        {
            if (cdto == null)
            {
                return(Json(new Deploy.CustomDTO.ResultDTO {
                    isSuccess = false, Message = "参数为空"
                }));
            }
            cdto.id = Guid.NewGuid();
            Deploy.CustomDTO.ResultDTO <string> ticket = GetWeChatTicket(cdto);
            cdto.WeChatTicket = ticket.isSuccess ? ticket.Data : "";
            Deploy.CustomDTO.ResultDTO ret = new Deploy.CustomDTO.ResultDTO {
                isSuccess = ticket.isSuccess, Message = "生成票据失败!", ResultCode = 0
            };

            if (ticket.isSuccess)
            {
                IBP.Facade.WeChatQRCodeFacade facade = new IBP.Facade.WeChatQRCodeFacade();
                ret = facade.CreateWeChatQRCode(cdto);
            }
            var result = new { ret = ret, ticket = cdto.WeChatTicket };

            return(Json(result));
        }