示例#1
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);
        }
        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);
        }