⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 receivemoney.cs

📁 如果不使用IIS,请先运行 XSP.exe,待提示已侦听 8080端口后
💻 CS
字号:
using System;
using System.Collections.Generic;
using System.Collections;
using System.Web;
using Castle.ActiveRecord.Queries;
using NHibernate.Expression;
using System.Reflection;

namespace DNNLite.DesktopModules.OnlinePay
{
    /// <summary>
    ///ReceiveMoney 收到钱后,更新付款日志,
    ///并且调用回调方法
    /// </summary>
    public class ReceiveMoney
    {
        public static Hashtable cachedcallback = new Hashtable();

        /// <summary>
        /// Receive.aspx页面调用
        /// </summary>
        /// <param name="orderid">交易事务号</param>
        /// <param name="money">金额</param>
        /// <param name="status">状态</param>
        /// <param name="platform">平台</param>
        public static void ProcessMoney(string transcationid, decimal money, string status, string platform)
        {
            /*****处理付款记录****/

            PaymentLog l = PaymentLog.FindFirst(PaymentLog.Desc("PayTime"),
                new EqExpression("Platform", platform),
                new EqExpression("TransactionId", transcationid));

            if (l.SuccessTime.HasValue)
            { 
                //已支付的订单,不必再支付了,可能是用户在刷页面
                return;
            }

            l.Status = status;
            l.SuccessTime = DateTime.Now;
            l.MoneyTrue = money;

            

            string orderid = l.OrderID;

            try
            {
                if (!string.IsNullOrEmpty(l.CallBackMethod))
                {
                    #region 回调

                    object tk = null;

                    if (!cachedcallback.ContainsKey(l.CallBackMethod))
                    {
                        Type t = null;
                        foreach (Assembly ass in AppDomain.CurrentDomain.GetAssemblies())
                        {

                            t = ass.GetType(l.CallBackMethod);
                            if (t != null)
                            {
                                break;
                            }
                        }


                        tk = t.GetConstructor(new Type[] { }).Invoke(new object[] { });

                        cachedcallback.Add(l.CallBackMethod, tk);

                    }
                    else
                    {
                        tk = cachedcallback[l.CallBackMethod];
                    }

                    IReceive itk = (IReceive)tk; 

                    itk.ReceiveMoney(orderid , money);

                    #endregion
                }

            }
            catch (Exception ex)
            {
                throw ex;
            }
            finally
            {
                l.UpdateAndFlush();
            }

        }

    }
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -