Esempio n. 1
0
        public void PayFinish(object re)
        {
            PaySuccess r = re as PaySuccess;

            MessageBox.Show($"支付结果:{r.IsSuccess}|支付金额:{r.Amount}|第三方订单号:{r.ThirdNo}|支付方式:{r.PaySubWay}");
            this.result = $"支付结果:{r.IsSuccess}|支付金额:{r.Amount}|";
            MessageBox.Show(result);
        }
Esempio n. 2
0
        public void Handle()
        {
            PaySuccess result = new PaySuccess
            {
                IsSuccess = true,
                Amount    = "0.01",
                ErrorMsg  = "",
                PaySubWay = "AliPay",
                ThirdNo   = "Ali201944657987"
            };

            System.Threading.Thread.Sleep(5000);
            //固定写法
            TradeCallBack(result);
            TradeFinish();
        }
        /// <summary>
        /// 出 订单支付完成 队列
        /// </summary>
        public void ProcessPaySuccessMsg()
        {
            //
            var numCount  = 100;
            var commonBLL = new CommonBLL();

            //
            var customerIDs = CustomerBLL.Instance.GetCustomerList();

            foreach (var customer in customerIDs)
            {
                //
                var count = RedisOpenAPI.Instance.CCOrderPaySuccess().GetPaySuccessLength(new CC_PaySuccess
                {
                    CustomerID = customer.Key
                });
                if (count.Code != ResponseCode.Success)
                {
                    continue;
                }
                if (count.Result <= 0)
                {
                    continue;
                }

                //
                if (count.Result < numCount)
                {
                    numCount = Convert.ToInt32(count.Result);
                }

                //
                for (var i = 0; i < numCount; i++)
                {
                    //
                    var response = RedisOpenAPI.Instance.CCOrderPaySuccess().GetPaySuccess(new CC_PaySuccess
                    {
                        CustomerID = customer.Key
                    });
                    if (response.Code == ResponseCode.Success)
                    {
                        var templateID         = response.Result.ConfigData.TemplateID;
                        var openID             = response.Result.ConfigData.OpenID;
                        var vipID              = response.Result.ConfigData.VipID;
                        var loggingSessionInfo = CustomerBLL.Instance.GetBSLoggingSession(customer.Key, "1");//response.Result.ConfigData.LogSession.JsonDeserialize<LoggingSessionInfo>();
                        var paySuccessData     = new PaySuccess
                        {
                            first = new DataInfo {
                                value = response.Result.PaySuccessData.first.value, color = response.Result.PaySuccessData.first.color
                            },
                            orderAddress = new DataInfo {
                                value = response.Result.PaySuccessData.orderAddress.value, color = response.Result.PaySuccessData.orderAddress.color
                            },
                            orderName = new DataInfo {
                                value = response.Result.PaySuccessData.orderName.value, color = response.Result.PaySuccessData.orderName.color
                            },
                            orderProductName = new DataInfo {
                                value = response.Result.PaySuccessData.orderProductName.value, color = response.Result.PaySuccessData.orderProductName.color
                            },
                            orderProductPrice = new DataInfo {
                                value = response.Result.PaySuccessData.orderProductPrice.value, color = response.Result.PaySuccessData.orderProductPrice.color
                            },
                            remark = new DataInfo {
                                value = response.Result.PaySuccessData.remark.value, color = response.Result.PaySuccessData.remark.color
                            }
                        };

                        //
                        //return commonBLL.SendMatchWXTemplateMessage(wxTMConfigData.TemplateID, null, null, null, PaySuccessData, null, "15", OpenID, VipID, loggingSessionInfo);
                        commonBLL.SendMatchWXTemplateMessage(templateID, null, null, null, paySuccessData, null, null, null, null, "15", openID, vipID, loggingSessionInfo);
                    }
                }
            }
        }
        /// <summary>
        /// 入 订单支付完成 队列
        /// </summary>
        public void SentPaymentMessage(T_InoutEntity Inout, string OpenID, string VipID, LoggingSessionInfo loggingSessionInfo)
        {
            //
            var commonBLL = new CommonBLL();

            //
            var wxTMConfigData = new WXTMConfigBLL(loggingSessionInfo).QueryByEntity(new WXTMConfigEntity
            {
                TemplateIdShort = "TM00398",
                CustomerId      = loggingSessionInfo.ClientID,
                IsDelete        = 0
            }, null).FirstOrDefault();

            if (wxTMConfigData == null)
            {
                return;
            }

            //
            string     ItemName       = commonBLL.GetItemName(Inout.order_no, loggingSessionInfo);
            PaySuccess PaySuccessData = new PaySuccess();

            PaySuccessData.first = new DataInfo()
            {
                value = wxTMConfigData.FirstText, color = wxTMConfigData.FirstColour
            };
            PaySuccessData.orderProductPrice = new DataInfo()
            {
                value = Math.Round(Inout.actual_amount ?? 0, 2).ToString(), color = wxTMConfigData.Colour1
            };
            PaySuccessData.orderProductName = new DataInfo()
            {
                value = ItemName, color = wxTMConfigData.Colour2
            };
            PaySuccessData.orderAddress = new DataInfo()
            {
                value = Inout.Field4, color = wxTMConfigData.Colour3
            };
            PaySuccessData.orderName = new DataInfo()
            {
                value = Inout.order_no, color = wxTMConfigData.Colour3
            };
            PaySuccessData.remark = new DataInfo()
            {
                value = wxTMConfigData.RemarkText, color = wxTMConfigData.RemarkColour
            };

            //
            var response = RedisOpenAPI.Instance.CCOrderPaySuccess().SetPaySuccess(new CC_PaySuccess
            {
                CustomerID = loggingSessionInfo.ClientID,
                ConfigData = new CC_ConfigData
                {
                    LogSession = loggingSessionInfo.JsonSerialize(),
                    OpenID     = OpenID,
                    TemplateID = wxTMConfigData.TemplateID,
                    VipID      = VipID
                },
                PaySuccessData = new CC_PaySuccessData
                {
                    first = new CC_DataInfo {
                        value = PaySuccessData.first.value, color = PaySuccessData.first.color
                    },
                    orderAddress = new CC_DataInfo {
                        value = PaySuccessData.orderAddress.value, color = PaySuccessData.orderAddress.color
                    },
                    orderName = new CC_DataInfo {
                        value = PaySuccessData.orderName.value, color = PaySuccessData.orderName.color
                    },
                    orderProductName = new CC_DataInfo {
                        value = PaySuccessData.orderProductName.value, color = PaySuccessData.orderProductName.color
                    },
                    orderProductPrice = new CC_DataInfo {
                        value = PaySuccessData.orderProductPrice.value, color = PaySuccessData.orderProductPrice.color
                    },
                    remark = new CC_DataInfo {
                        value = PaySuccessData.remark.value, color = PaySuccessData.remark.color
                    }
                }
            });

            if (response.Code != ResponseCode.Success)
            {
                commonBLL.SendMatchWXTemplateMessage(wxTMConfigData.TemplateID, null, null, null, PaySuccessData, null, null, null, null, "15", OpenID, VipID, loggingSessionInfo);
                new RedisXML().RedisReadDBCount("OrderPaySuccess", "微信端支付成功通知", 2);
            }
            else
            {
                new RedisXML().RedisReadDBCount("OrderPaySuccess", "微信端支付成功通知", 1);
            }
            //return commonBLL.SendMatchWXTemplateMessage(wxTMConfigData.TemplateID, null, null, null, PaySuccessData, null, "15", OpenID, VipID, loggingSessionInfo);
        }