Ejemplo n.º 1
0
        /// <summary>
        /// 异步回调后-->验证支付单状态-->如果正常,更新订单状态
        /// 多张订单在外层循环,这里只处理单订单
        /// </summary>
        /// <param name="mod">订单模型</param>
        /// <param name="paylogMod">订单支付日志模型</param>
        public static void FinalStep(M_Payment pinfo, M_OrderList mod, M_Order_PayLog paylogMod)
        {
            B_Order_PayLog paylogBll = new B_Order_PayLog();
            B_User         buser     = new B_User();

            //订单已处理,避免重复(如已处理过,则继续处理下一张订单)
            if (mod.OrderStatus >= 99)
            {
                ZLLog.L(Model.ZLEnum.Log.safe, new M_Log()
                {
                    Action  = "支付回调异常,订单状态已为99",
                    Message = "订单号:" + mod.OrderNo + ",支付单:" + pinfo.PayNo
                });
                return;
            }
            //已经收到钱了,所以先执行(如多订单,则该值需要看支付单)
            orderBll.UpOrderinfo("Paymentstatus=1,Receivablesamount=" + pinfo.MoneyTrue, mod.id);
            if (mod.Ordertype == (int)M_OrderList.OrderEnum.Domain)//域名订单
            {
                orderBll.UpOrderinfo("OrderStatus=1,PaymentNo='" + pinfo.PayNo + "'", mod.id);
                //Response.Redirect("~/Plugins/Domain/DomReg2.aspx?OrderNo=" + mod.OrderNo);
            }
            else if (mod.Ordertype == (int)M_OrderList.OrderEnum.IDC)//IDC服务
            {
                B_Order_IDC idcBll = new B_Order_IDC();
                orderBll.FinishOrder(mod.id, pinfo);
                idcBll.UpdateEndTimeByNo(mod.OrderNo);
            }
            else if ((mod.Ordertype == (int)M_OrderList.OrderEnum.IDCRen))//IDC服务续费
            {
                B_Order_IDC idcBll = new B_Order_IDC();
                orderBll.FinishOrder(mod.id, pinfo);
                idcBll.RennewTime(mod);
            }
            else if (mod.Ordertype == (int)M_OrderList.OrderEnum.Purse)//余额充值,不支持银币
            {
                buser.ChangeVirtualMoney(mod.Userid, new M_UserExpHis()
                {
                    score     = mod.Ordersamount,
                    ScoreType = (int)M_UserExpHis.SType.Purse,
                    detail    = "余额充值,订单号:" + mod.OrderNo
                });
                orderBll.FinishOrder(mod.id, pinfo);                    //成功的订单
            }
            else if (mod.Ordertype == (int)M_OrderList.OrderEnum.Cloud) //虚拟商品订单
            {
                orderBll.FinishOrder(mod.id, pinfo);
            }
            else//其他旅游订单等,只更新状态
            {
                orderBll.FinishOrder(mod.id, pinfo);//成功的订单
            }
            //-------支付成功处理,快照并写入日志
            SaveSnapShot(mod);
            paylogMod.Remind   += "订单" + mod.OrderNo + "购买生效";
            paylogMod.OrderID   = mod.id;
            paylogMod.PayMoney  = mod.Ordersamount;
            paylogMod.PayMethod = (int)M_Order_PayLog.PayMethodEnum.Other;//外部指定
            paylogMod.PayPlatID = pinfo.PayPlatID;
            paylogBll.insert(paylogMod);
            //------商品是否赠送积分
            {
                DataTable prodt = DBCenter.JoinQuery("A.ProID,B.PointVal", "ZL_CartPro", "ZL_Commodities", "A.ProID=B.ID", "A.OrderListID=" + mod.id);
                foreach (DataRow dr in prodt.Rows)
                {
                    double point = DataConvert.CDouble(dr["PointVal"]);
                    if (point > 0)
                    {
                        buser.AddMoney(mod.Userid, point, M_UserExpHis.SType.Point, "购买商品[" + dr["ProID"] + "],赠送积分");
                    }
                }
            }
        }