示例#1
0
        public string CretaeWxCode()
        {
            var responseData = new ResponseData();

            try
            {
                //微信 公共平台
                var wapentity = new WApplicationInterfaceBLL(this.CurrentUserInfo).QueryByEntity(new WApplicationInterfaceEntity
                {
                    CustomerId = this.CurrentUserInfo.ClientID,
                    IsDelete   = 0
                }, null).FirstOrDefault();

                //获取当前二维码 最大值
                var MaxWQRCod = new WQRCodeManagerBLL(this.CurrentUserInfo).GetMaxWQRCod() + 1;

                if (wapentity == null || wapentity.ApplicationId == null)
                {
                    responseData.success = false;
                    responseData.msg     = "无设置微信公众平台!";
                    return(responseData.ToJSON());
                }

                string imageUrl = string.Empty;

                #region 生成二维码
                JIT.CPOS.BS.BLL.WX.CommonBLL commonServer = new JIT.CPOS.BS.BLL.WX.CommonBLL();
                imageUrl = commonServer.GetQrcodeUrl(wapentity.AppID.ToString().Trim()
                                                     , wapentity.AppSecret.Trim()
                                                     , "1", MaxWQRCod
                                                     , this.CurrentUserInfo);

                if (string.IsNullOrEmpty(imageUrl))
                {
                    responseData.success = false;
                    responseData.msg     = "二维码生成失败!";
                }
                else
                {
                    string host = ConfigurationManager.AppSettings["DownloadImageUrl"];
                    CPOS.Common.DownloadImage downloadServer = new DownloadImage();
                    imageUrl = downloadServer.DownloadFile(imageUrl, host);
                }
                #endregion
                responseData.success = true;
                responseData.msg     = "二维码生成成功!";
                var rp = new ReposeData()
                {
                    imageUrl  = imageUrl,
                    MaxWQRCod = MaxWQRCod
                };
                responseData.data = rp;
                return(responseData.ToJSON());
            }
            catch (Exception ex)
            {
                throw new APIException(ex.Message);
            }
        }
示例#2
0
        protected override ShortUrlRD ProcessRequest(APIRequest <ShortUrlRP> pRequest)
        {
            ShortUrlRD rd   = new ShortUrlRD();
            var        para = pRequest.Parameters;

            var list = new WApplicationInterfaceBLL(CurrentUserInfo).QueryByEntity(new WApplicationInterfaceEntity {
                CustomerId = CurrentUserInfo.ClientID, IsDelete = 0
            }, null).ToList();

            if (list == null)
            {
                throw new Exception("该商户没有绑定微信公众号,无法生成商品二维码");
            }
            var wapentity = list.FirstOrDefault();            //获取公众号信息

            JIT.CPOS.BS.BLL.WX.CommonBLL commonServer = new JIT.CPOS.BS.BLL.WX.CommonBLL();
            var shorturl = commonServer.GetShorturl(wapentity.AppID.ToString().Trim()
                                                    , wapentity.AppSecret.Trim()
                                                    , para.Url
                                                    , CurrentUserInfo);

            rd.ShortUrl = shorturl;
            return(rd);
        }
示例#3
0
        public void CouponsUpcomingExpiredMessage(string CouponType, string CouponCode, string EffectiveData, string FailData, string OpenID, LoggingSessionInfo loggingSessionInfo)
        {
            var CommonBLL      = new JIT.CPOS.BS.BLL.WX.CommonBLL();
            var WXTMConfigData = new WXTMConfigBLL(loggingSessionInfo).QueryByEntity(new WXTMConfigEntity()
            {
                TemplateIdShort = "OPENTM206623166", CustomerId = loggingSessionInfo.ClientID, IsDelete = 0
            }, null).FirstOrDefault();

            var Data = new JIT.CPOS.BS.Entity.WX.CouponsUpcomingExpired();

            Data.first = new DataInfo()
            {
                value = WXTMConfigData.FirstText, color = WXTMConfigData.FirstColour
            };
            Data.keyword1 = new DataInfo()
            {
                value = CouponType, color = WXTMConfigData.Colour1
            };                                                                                    //券类型
            Data.keyword2 = new DataInfo()
            {
                value = CouponCode, color = WXTMConfigData.Colour1
            };                                                                                    //券码
            Data.keyword3 = new DataInfo()
            {
                value = EffectiveData, color = WXTMConfigData.Colour1
            };                                                                                       //生效日期
            Data.keyword4 = new DataInfo()
            {
                value = FailData, color = WXTMConfigData.Colour1
            };                                                                                  //失效日期
            Data.remark = new DataInfo()
            {
                value = WXTMConfigData.RemarkText, color = WXTMConfigData.RemarkColour
            };

            //  return SendMatchWXTemplateMessage(WXTMConfigData.TemplateID, null, null, null, null, null, null, Data, null, "1", OpenID, null, loggingSessionInfo);

            //下面往redis里存入数据
            var response = RedisOpenAPI.Instance.CCCouponToBeExpired().SetCouponToBeExpired(new CC_CouponToBeExpired
            {
                CustomerID = loggingSessionInfo.ClientID,
                ConfigData = new CC_ConfigData
                {
                    LogSession = loggingSessionInfo.JsonSerialize(),
                    OpenID     = OpenID,
                    TemplateID = WXTMConfigData.TemplateID,
                    //   VipID = VipID
                },
                CouponToBeExpiredData = new CC_CouponToBeExpiredData
                {
                    first = new CC_DataInfo {
                        value = Data.first.value, color = Data.first.color
                    },
                    keyword1 = new CC_DataInfo {
                        value = Data.keyword1.value, color = Data.keyword1.color
                    },
                    keyword2 = new CC_DataInfo {
                        value = Data.keyword2.value, color = Data.keyword2.color
                    },
                    keyword3 = new CC_DataInfo {
                        value = Data.keyword3.value, color = Data.keyword3.color
                    },
                    keyword4 = new CC_DataInfo {
                        value = Data.keyword4.value, color = Data.keyword4.color
                    },
                    remark = new CC_DataInfo {
                        value = Data.remark.value, color = Data.remark.color
                    }
                }
            });

            //如果往缓存redis里写入不成功,还是按照原来的老方法直接发送**
            if (response.Code != ResponseCode.Success)
            {
                CommonBLL.SendMatchWXTemplateMessage(WXTMConfigData.TemplateID, null, null, null, null, null, null, Data, null, "1", OpenID, null, loggingSessionInfo);

                new RedisXML().RedisReadDBCount("CouponsUpcomingExpired", "优惠券即将过期通知", 2);
            }
            else
            {
                new RedisXML().RedisReadDBCount("CouponsUpcomingExpired", "优惠券即将过期通知", 1);
            }

            //return  CommonBLL.SendMatchWXTemplateMessage(WXTMConfigData.TemplateID, CommonData, null, null, null, null, "8", OpenID, VipID, loggingSessionInfo);
        }
示例#4
0
        public WxCode CretaeWxCode()
        {
            var responseData = new WxCode();

            responseData.success = false;
            responseData.msg     = "二维码生成失败!";
            var loggingSessionInfo = new SessionManager().CurrentUserLoginInfo;

            try
            {
                //微信 公共平台
                var wapentity = new WApplicationInterfaceBLL(loggingSessionInfo).QueryByEntity(new WApplicationInterfaceEntity
                {
                    CustomerId = loggingSessionInfo.ClientID,
                    IsDelete   = 0
                }, null).FirstOrDefault();

                //获取当前二维码 最大值
                var MaxWQRCod = new WQRCodeManagerBLL(loggingSessionInfo).GetMaxWQRCod() + 1;

                if (wapentity == null)
                {
                    responseData.success = false;
                    responseData.msg     = "无设置微信公众平台!";
                    return(responseData);
                }

                string imageUrl = string.Empty;

                #region 生成二维码
                JIT.CPOS.BS.BLL.WX.CommonBLL commonServer = new JIT.CPOS.BS.BLL.WX.CommonBLL();
                try
                {
                    imageUrl = commonServer.GetQrcodeUrl(wapentity.AppID.ToString().Trim()
                                                         , wapentity.AppSecret.Trim()
                                                         , "1", MaxWQRCod
                                                         , loggingSessionInfo);
                }
                catch (Exception e)
                {
                    responseData.success = false;
                    responseData.msg     = e.Message;// "二维码生成失败!";
                    return(responseData);
                }

                if (!string.IsNullOrEmpty(imageUrl))
                {
                    string host = ConfigurationManager.AppSettings["DownloadImageUrl"];
                    CPOS.Common.DownloadImage downloadServer = new DownloadImage();
                    imageUrl = downloadServer.DownloadFile(imageUrl, host);
                }
                #endregion
                responseData.success   = true;
                responseData.msg       = "";
                responseData.ImageUrl  = imageUrl;
                responseData.MaxWQRCod = MaxWQRCod;


                return(responseData);
            }
            catch (Exception ex)
            {
                //throw new APIException(ex.Message);
                return(responseData);
            }
        }
        public void CouponsArrivalMessage(string CouponCode, string CouponName, string ValidityData, string Scope, string OpenID, LoggingSessionInfo loggingSessionInfo, string CouponCount = "1")
        {
            var CommonBLL      = new JIT.CPOS.BS.BLL.WX.CommonBLL();
            var WXTMConfigData = new WXTMConfigBLL(loggingSessionInfo).QueryByEntity(new WXTMConfigEntity()
            {
                TemplateIdShort = "OPENTM207444083", CustomerId = loggingSessionInfo.ClientID, IsDelete = 0
            }, null).FirstOrDefault();


            var CouponsArrivalData = new CouponsArrival();

            CouponsArrivalData.first = new DataInfo()
            {
                value = WXTMConfigData.FirstText, color = WXTMConfigData.FirstColour
            };
            CouponsArrivalData.keyword1 = new DataInfo()
            {
                value = CouponCode, color = WXTMConfigData.Colour1
            };                                                                                                  //券码
            CouponsArrivalData.keyword2 = new DataInfo()
            {
                value = CouponName, color = WXTMConfigData.Colour1
            };                                                                                                  //券名称
            CouponsArrivalData.keyword3 = new DataInfo()
            {
                value = CouponCount, color = WXTMConfigData.Colour1
            };                                                                                                   //可用数量
            CouponsArrivalData.keyword4 = new DataInfo()
            {
                value = ValidityData, color = WXTMConfigData.Colour1
            };                                                                                                    //有效期
            CouponsArrivalData.keyword5 = new DataInfo()
            {
                value = Scope, color = WXTMConfigData.Colour1
            };                                                                                             //
            CouponsArrivalData.Remark = new DataInfo()
            {
                value = WXTMConfigData.RemarkText, color = WXTMConfigData.RemarkColour
            };

            //下面往redis里存入数据
            var response = RedisOpenAPI.Instance.CCCouponNotice().SetCouponNotice(new CC_CouponNotice
            {
                CustomerID = loggingSessionInfo.ClientID,
                ConfigData = new CC_ConfigData
                {
                    LogSession = loggingSessionInfo.JsonSerialize(),
                    OpenID     = OpenID,
                    TemplateID = WXTMConfigData.TemplateID,
                    //   VipID = VipID
                },
                CouponNoticeData = new CC_CouponNoticeData
                {
                    first = new CC_DataInfo {
                        value = CouponsArrivalData.first.value, color = CouponsArrivalData.first.color
                    },
                    keyword1 = new CC_DataInfo {
                        value = CouponsArrivalData.keyword1.value, color = CouponsArrivalData.keyword1.color
                    },
                    keyword2 = new CC_DataInfo {
                        value = CouponsArrivalData.keyword2.value, color = CouponsArrivalData.keyword2.color
                    },
                    keyword3 = new CC_DataInfo {
                        value = CouponsArrivalData.keyword3.value, color = CouponsArrivalData.keyword3.color
                    },
                    keyword4 = new CC_DataInfo {
                        value = CouponsArrivalData.keyword4.value, color = CouponsArrivalData.keyword4.color
                    },
                    keyword5 = new CC_DataInfo {
                        value = CouponsArrivalData.keyword5.value, color = CouponsArrivalData.keyword4.color
                    },
                    remark = new CC_DataInfo {
                        value = CouponsArrivalData.Remark.value, color = CouponsArrivalData.Remark.color
                    }
                }
            });

            //如果往缓存redis里写入不成功,还是按照原来的老方法直接发送**
            if (response.Code != ResponseCode.Success)
            {
                CommonBLL.CouponsArrivalMessage(CouponCode, CouponName, ValidityData, Scope, OpenID, loggingSessionInfo, CouponCount);//传入优惠券数量

                new RedisXML().RedisReadDBCount("CouponsUpcomingExpired", "优惠券发送成功通知", 2);
            }
            else
            {
                new RedisXML().RedisReadDBCount("CouponsUpcomingExpired", "优惠券发送成功通知", 1);
            }
        }
示例#6
0
        /// <summary>
        /// 获取门店二维码
        /// </summary>
        /// <returns></returns>
        public string SetUnitWXCode()
        {
            #region 参数处理
            string WeiXinId     = Request("WeiXinId");
            string UnitId       = Request("UnitId");
            string WXCode       = Request("WXCode");
            var    responseData = new ResponseData();
            if (WeiXinId == null || WeiXinId.Trim().Length == 0)
            {
                responseData.success = false;
                responseData.msg     = "公众号不能为空";
                return(responseData.ToJSON());
            }

            //if (UnitId == null || UnitId.Trim().Length == 0)
            //{
            //    responseData.success = false;
            //    responseData.msg = "门店标识不能为空";
            //    return responseData.ToJSON();
            //}
            //if (WXCode == null || WXCode.Equals(""))
            //{
            //    VwUnitPropertyBLL unitServer = new VwUnitPropertyBLL(CurrentUserInfo);
            //    WXCode = unitServer.GetUnitWXCode(UnitId).ToString();
            //}
            #endregion

            #region 获取微信公众号信息
            WApplicationInterfaceBLL server = new WApplicationInterfaceBLL(CurrentUserInfo);
            var wxObj = server.QueryByEntity(new WApplicationInterfaceEntity
            {
                CustomerId = CurrentUserInfo.CurrentUser.customer_id
                ,
                IsDelete = 0
                ,
                ApplicationId = WeiXinId
            }, null);
            if (wxObj == null || wxObj.Length == 0)
            {
                responseData.success = false;
                responseData.msg     = "不存在对应的微信帐号";
                return(responseData.ToJSON().ToString());
            }
            else
            {
                JIT.CPOS.BS.BLL.WX.CommonBLL commonServer = new JIT.CPOS.BS.BLL.WX.CommonBLL();
                string imageUrl = commonServer.GetQrcodeUrl(wxObj[0].AppID.ToString().Trim()
                                                            , wxObj[0].AppSecret.Trim()
                                                            , "1"
                                                            , Convert.ToInt32(WXCode), CurrentUserInfo);
                if (imageUrl != null && !imageUrl.Equals(""))
                {
                    string host = ConfigurationManager.AppSettings["DownloadImageUrl"];

                    try
                    {
                        CPOS.Common.DownloadImage downloadServer = new DownloadImage();
                        imageUrl             = downloadServer.DownloadFile(imageUrl, host);
                        responseData.success = true;
                        responseData.msg     = imageUrl;
                        responseData.status  = WXCode;
                    }
                    catch (Exception ex)
                    {
                        responseData.success = false;
                        responseData.data    = imageUrl;
                        responseData.msg     = ex.ToString();
                        return(responseData.ToJSON().ToString());
                    }
                    return(responseData.ToJSON().ToString());
                }
                else
                {
                    responseData.success = false;
                    responseData.msg     = "图片不存在";
                    return(responseData.ToJSON().ToString());
                }
            }
            #endregion
        }
示例#7
0
        protected override GetVipDealerSpreadCodeRD ProcessRequest(DTO.Base.APIRequest <GetVipDealerSpreadCodeRP> pRequest)
        {
            var rd                = new GetVipDealerSpreadCodeRD();
            var VipBLL            = new VipBLL(CurrentUserInfo);
            var WQRCodeManagerBLL = new WQRCodeManagerBLL(this.CurrentUserInfo);
            var WQRCodeTypeBLL    = new WQRCodeTypeBLL(this.CurrentUserInfo);

            try
            {
                var UserID = pRequest.UserID;
                //
                string imageUrl   = string.Empty;
                string QRCodeId   = string.Empty;
                string VipName    = string.Empty;
                string HeadImgUrl = string.Empty;
                //分享处理
                if (!string.IsNullOrWhiteSpace(pRequest.Parameters.ShareUserId))
                {
                    UserID = pRequest.Parameters.ShareUserId;
                }
                //微信 公共平台
                var wapentity = new WApplicationInterfaceBLL(this.CurrentUserInfo).QueryByEntity(new WApplicationInterfaceEntity
                {
                    CustomerId = this.CurrentUserInfo.ClientID,
                    IsDelete   = 0
                }, null).FirstOrDefault();

                var VipDealerType = WQRCodeTypeBLL.QueryByEntity(new WQRCodeTypeEntity()
                {
                    TypeCode = "VipDealerCode"
                }, null).FirstOrDefault();
                if (VipDealerType == null)
                {
                    throw new APIException("静态二位经销商类型无此类型!");
                }

                if (!string.IsNullOrWhiteSpace(pRequest.Parameters.QRCodeId))
                {
                    #region 分享出去的二维码
                    var WQRCodeManagerData = WQRCodeManagerBLL.GetByID(pRequest.Parameters.QRCodeId);
                    if (WQRCodeManagerData == null)
                    {
                        throw new APIException("此二维码不存在!");
                    }

                    var VipData = VipBLL.GetByID(WQRCodeManagerData.ObjectId);
                    if (VipData == null)
                    {
                        throw new APIException("此二维码会员不存在!");
                    }

                    //二维码图片地址,ID赋值,会员名称,头像地址赋值
                    imageUrl   = WQRCodeManagerData.ImageUrl;
                    QRCodeId   = WQRCodeManagerData.QRCodeId.ToString();
                    VipName    = VipData.VipName;
                    HeadImgUrl = VipData.HeadImgUrl;
                    #endregion
                }
                else
                {
                    #region 获取去自己静态推广二维码
                    var WQRCodeManagerData = WQRCodeManagerBLL.QueryByEntity(new WQRCodeManagerEntity()
                    {
                        ObjectId = UserID, QRCodeTypeId = VipDealerType.QRCodeTypeId
                    }, null).FirstOrDefault();
                    if (WQRCodeManagerData != null)
                    {
                        //二维码图片地址,ID赋值
                        imageUrl = WQRCodeManagerData.ImageUrl;
                        QRCodeId = WQRCodeManagerData.QRCodeId.ToString();
                    }
                    else
                    {
                        //获取当前二维码 最大值
                        var MaxWQRCod = new WQRCodeManagerBLL(this.CurrentUserInfo).GetMaxWQRCod() + 1;
                        if (wapentity == null)
                        {
                            throw new APIException("无设置微信公众平台!");
                        }

                        #region 生成二维码
                        JIT.CPOS.BS.BLL.WX.CommonBLL commonServer = new JIT.CPOS.BS.BLL.WX.CommonBLL();
                        imageUrl = commonServer.GetQrcodeUrl(wapentity.AppID.ToString().Trim()
                                                             , wapentity.AppSecret.Trim()
                                                             , "1", MaxWQRCod
                                                             , this.CurrentUserInfo);

                        if (string.IsNullOrEmpty(imageUrl))
                        {
                            throw new APIException("二维码生成失败!");
                        }
                        else
                        {
                            string host = ConfigurationManager.AppSettings["original_url"];
                            CPOS.Common.DownloadImage downloadServer = new DownloadImage();
                            //二维码赋值
                            imageUrl = downloadServer.DownloadFile(imageUrl, host);
                            if (!string.IsNullOrEmpty(UserID))
                            {
                                var WQRQrCode = new WQRCodeManagerEntity();
                                WQRQrCode.QRCodeId      = Guid.NewGuid();
                                WQRQrCode.QRCode        = MaxWQRCod.ToString();
                                WQRQrCode.QRCodeTypeId  = VipDealerType.QRCodeTypeId;
                                WQRQrCode.IsUse         = 1;
                                WQRQrCode.CustomerId    = this.CurrentUserInfo.ClientID;
                                WQRQrCode.ImageUrl      = imageUrl;
                                WQRQrCode.ApplicationId = wapentity.ApplicationId;//微信公众号的编号
                                //objectId 为会员ID
                                WQRQrCode.ObjectId = UserID;
                                WQRCodeManagerBLL.Create(WQRQrCode);

                                //二维码ID赋值
                                QRCodeId = WQRQrCode.QRCodeId.ToString();
                            }
                        }
                        #endregion
                    }
                    //会员名称,头像地址
                    var VipData = VipBLL.GetByID(UserID);
                    if (VipData == null)
                    {
                        throw new APIException("会员不存在!");
                    }

                    VipName    = VipData.VipName;
                    HeadImgUrl = VipData.HeadImgUrl;
                    #endregion
                }
                //响应参数赋值
                rd.imageUrl   = imageUrl;
                rd.VipName    = VipName;
                rd.HeadImgUrl = HeadImgUrl;
                rd.QRCodeId   = QRCodeId;
            }
            catch (Exception ex)
            {
                throw new APIException(ex.Message);
            }

            return(rd);
        }
示例#8
0
        private void DownloadQRCode()
        {
            string weixinDomain  = ConfigurationManager.AppSettings["original_url"];
            string sourcePath    = this.CurrentContext.Server.MapPath("/QRCodeImage/qrcode.jpg");
            string targetPath    = this.CurrentContext.Server.MapPath("/QRCodeImage/");
            string currentDomain = this.CurrentContext.Request.Url.Host;//当前项目域名

            if (currentDomain == "localhost")
            {
                currentDomain += ":2330";
            }
            string itemId   = FormatParamValue(Request("item_id"));   //商品ID
            string itemName = FormatParamValue(Request("item_name")); //商品名
            string imageURL;



            ObjectImagesBLL objectImagesBLL = new ObjectImagesBLL(CurrentUserInfo);

            //查找是否已经生成了二维码
            ObjectImagesEntity[] objectImagesEntityArray = objectImagesBLL.QueryByEntity(new ObjectImagesEntity()
            {
                ObjectId = itemId, Description = "自动生成的产品二维码"
            }, null);

            if (objectImagesEntityArray.Length == 0)
            {
                string applicationId = "";
                //根据CustomerId去取公众号信息

                var list = new WApplicationInterfaceBLL(CurrentUserInfo).QueryByEntity(new WApplicationInterfaceEntity {
                    CustomerId = CurrentUserInfo.ClientID, IsDelete = 0
                }, null).ToList();

                if (list != null && list.Count > 0)
                {
                    applicationId = list.FirstOrDefault().ApplicationId;
                }
                else
                {
                    //Response.Write("<br>");
                    //Response.Write("没有获取微信标识");
                    throw new Exception("该商户没有绑定微信公众号,无法生成商品二维码");
                }
                var wapentity = list.FirstOrDefault();//获取公众号信息

                //http://api.dev.chainclouds.com
                //    http://api.dev.chainclouds.com/WXOAuth/AuthUniversal.aspx?customerId=049b0a8f641f4ca7b17b0b7b6291de1f&applicationId=1D7A01FC1E7D41ECBAC2696D0D363315&goUrl=api.dev.chainclouds.com/HtmlApps/html/public/shop/goods_detail.html?rootPage=true&rootPage=true&goodsId=DBF5326F4C5B4B0F8508AB54B0B0EBD4&ver=1448273310707&scope=snsapi_userinfo

                string itemUrl = weixinDomain + "/WXOAuth/AuthUniversal.aspx?customerId=" + CurrentUserInfo.ClientID
                                 + "&applicationId=" + applicationId
                                 + "&goUrl=" + weixinDomain + "/HtmlApps/html/public/shop/goods_detail.html?goodsId="
                                 + itemId + "&scope=snsapi_userinfo";

                //  string itemUrl = "http://*****:*****@"/HeadImage/qrcodeBack.jpg", imageURL, itemName);
                }

                //把下载下来的图片的地址存到ObjectImages
                objectImagesBLL.Create(new ObjectImagesEntity()
                {
                    ImageId    = Utils.NewGuid(),
                    CustomerId = CurrentUserInfo.ClientID,
                    ImageURL   = imageURL,
                    ObjectId   = itemId,
                    Title      = itemName
                    ,
                    Description = "自动生成的产品二维码"
                });

                Loggers.Debug(new DebugLogInfo()
                {
                    Message = "二维码已生成,imageURL:" + imageURL
                });
            }
            else
            {
                imageURL = objectImagesEntityArray[0].ImageURL;
            }
            string imagePath = "";

            if (imageURL.IndexOf("HeadImage") > -1)
            {
                string dirPath   = System.AppDomain.CurrentDomain.BaseDirectory;
                var    imageName = imageURL.Substring(imageURL.IndexOf("HeadImage")).Replace("/", @"\");
                imagePath = dirPath + imageName;//整个
            }
            else
            {  //兼容老的存放地址
                imagePath = targetPath + imageURL.Substring(imageURL.LastIndexOf("/"));
            }

            Loggers.Debug(new DebugLogInfo()
            {
                Message = "二维码路径,imagePath:" + imageURL
            });

            try
            {
                //要下载的文件名
                FileInfo DownloadFile = new FileInfo(imagePath);

                if (DownloadFile.Exists)
                {
                    CurrentContext.Response.Clear();
                    CurrentContext.Response.AddHeader("Content-Disposition", "attachment;filename=\"" + System.Web.HttpUtility.UrlEncode(itemName, System.Text.Encoding.UTF8) + ".jpg" + "\"");
                    CurrentContext.Response.AddHeader("Content-Length", DownloadFile.Length.ToString());
                    CurrentContext.Response.ContentType = "application/octet-stream";
                    CurrentContext.Response.TransmitFile(DownloadFile.FullName);
                    CurrentContext.Response.Flush();
                }
                else
                {
                    Loggers.Debug(new DebugLogInfo()
                    {
                        Message = "二维码未找到"
                    });
                }
            }
            catch (Exception ex)
            {
                CurrentContext.Response.ContentType = "text/plain";
                CurrentContext.Response.Write(ex.Message);
            }
            finally
            {
                CurrentContext.Response.End();
            }
        }
        public void NotPayMessage(string orderProductPrice, string orderProductName, string orderAddress, string orderName, string OpenID, LoggingSessionInfo loggingSessionInfo)
        {
            var CommonBLL      = new JIT.CPOS.BS.BLL.WX.CommonBLL();
            var WXTMConfigData = new WXTMConfigBLL(loggingSessionInfo).QueryByEntity(new WXTMConfigEntity()
            {
                TemplateIdShort = "TM00701", CustomerId = loggingSessionInfo.ClientID, IsDelete = 0
            }, null).FirstOrDefault();

            var Data = new NotPay();

            Data.first = new DataInfo()
            {
                value = WXTMConfigData.FirstText, color = WXTMConfigData.FirstColour
            };
            Data.orderProductPrice = new DataInfo()
            {
                value = orderProductPrice, color = WXTMConfigData.Colour1
            };                                                                                                   //订单金额
            Data.orderProductName = new DataInfo()
            {
                value = orderProductName, color = WXTMConfigData.Colour1
            };                                                                                                 //商品详情
            Data.orderAddress = new DataInfo()
            {
                value = orderAddress, color = WXTMConfigData.Colour1
            };                                                                                         //收货信息
            Data.orderName = new DataInfo()
            {
                value = orderName, color = WXTMConfigData.Colour1
            };                                                                                   //订单编号
            Data.remark = new DataInfo()
            {
                value = WXTMConfigData.RemarkText, color = WXTMConfigData.RemarkColour
            };                                                                                                        //remark是从模板里取出来的

            //下面往redis里存入数据
            var response = RedisOpenAPI.Instance.CCOrderNotPay().SetOrderNotPay(new CC_OrderNotPay
            {
                CustomerID = loggingSessionInfo.ClientID,
                ConfigData = new CC_ConfigData
                {
                    LogSession = loggingSessionInfo.JsonSerialize(),
                    OpenID     = OpenID,
                    TemplateID = WXTMConfigData.TemplateID,
                    //   VipID = VipID
                },
                OrderNotPayData = new CC_OrderNotPayData
                {
                    first = new CC_DataInfo {
                        value = Data.first.value, color = Data.first.color
                    },
                    orderProductPrice = new CC_DataInfo {
                        value = Data.orderProductPrice.value, color = Data.orderProductPrice.color
                    },
                    orderProductName = new CC_DataInfo {
                        value = Data.orderProductName.value, color = Data.orderProductName.color
                    },
                    orderAddress = new CC_DataInfo {
                        value = Data.orderAddress.value, color = Data.orderAddress.color
                    },
                    orderName = new CC_DataInfo {
                        value = Data.orderName.value, color = Data.orderName.color
                    },
                    remark = new CC_DataInfo {
                        value = Data.remark.value, color = Data.remark.color
                    }
                }
            });

            //如果往缓存redis里写入不成功,还是按照原来的老方法直接发送**
            if (response.Code != ResponseCode.Success)
            {
                CommonBLL.SendMatchWXTemplateMessage(WXTMConfigData.TemplateID, null, null, null, null, null, null, null, Data, "2", OpenID, null, loggingSessionInfo);

                new RedisXML().RedisReadDBCount("OrderNotPay", "订单未付款通知", 2);
            }
            else
            {
                new RedisXML().RedisReadDBCount("OrderNotPay", "订单未付款通知", 1);
            }

            //return  CommonBLL.SendMatchWXTemplateMessage(WXTMConfigData.TemplateID, CommonData, null, null, null, null, "8", OpenID, VipID, loggingSessionInfo);
        }