//需处理,这里只负责View部分,页务与逻辑操作全部放入Notify
        private void FinalStep(M_OrderList mod)
        {
            //对第一张订单处理,后期改为对支付单处理

            if (mod.Ordertype == (int)M_OrderList.OrderEnum.Domain)//域名订单
            {
                Response.Redirect("~/Plugins/Domain/DomReg2.aspx?OrderNo=" + mod.OrderNo);
            }
            else if (mod.Ordertype == (int)M_OrderList.OrderEnum.Purse)//余额充值,不支持银币
            {
                Response.Redirect("~/Plugins/Domain/ChargePurse.aspx?OrderNo=" + mod.OrderNo);
            }
            else if ((mod.Ordertype == (int)M_OrderList.OrderEnum.IDCRen))//IDC服务续费
            {
                B_Product proBll = new B_Product();
                //更新旧订单的期限
                if (string.IsNullOrEmpty(mod.Ordermessage))
                {
                    function.WriteErrMsg("出错,无需续费订单信息,请联系管理员!!!");
                }
                M_CartPro newCartMod = cartBll.SelModByOrderID(mod.id);
                M_Product proMod     = proBll.GetproductByid(newCartMod.ProID);
                //更新延长旧服务的到期时间,旧服务是存在CartPro的EndTime当中
                M_CartPro oldCartMod = cartBll.SelReturnModel(Convert.ToInt32(mod.Ordermessage));
                if (oldCartMod.EndTime < DateTime.Now)
                {
                    oldCartMod.EndTime = DateTime.Now;                                   //如已过期,则将时间更新至今日
                }
                //oldCartMod.EndTime = proBll.GetEndTime(proMod, newCartMod.Pronum, oldCartMod.EndTime);
                cartBll.UpdateByID(oldCartMod);
                paylogMod.Remind = "为" + mod.Ordermessage + "订单续费(购物车)";
                remindHtml.Text  = "<span>付款成功--></span><a style='color:red;' href='/Plugins/Domain/ViewHave.aspx' title='已购服务'>点击查看已购服务</a><br />";
            }
            else if (mod.Ordertype == (int)M_OrderList.OrderEnum.Cloud)//云购订单
            {
                //根据份数生成幸运码,写入表中,并减去库存 ZL_Order_LuckCode
                remindHtml.Text = "<span style='color:red;'>付款成功,你的云购幸运码是<br/>" + orderBll.CreateLuckCode(mod) + "</span>";
            }
        }
Exemplo n.º 2
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_OrderList    orderBll  = new B_OrderList();
        B_CartPro      cartBll   = new B_CartPro();
        B_Order_PayLog paylogBll = new B_Order_PayLog();
        B_User         buser     = new B_User();

        //订单已处理,避免重复(如已处理过,则继续处理下一张订单)
        if (mod.OrderStatus >= 99)
        {
            ZLLog.L(ZoomLa.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", mod.id);
            //Response.Redirect("~/Plugins/Domain/DomReg2.aspx?OrderNo=" + mod.OrderNo);
        }
        else if (mod.Ordertype == (int)M_OrderList.OrderEnum.IDC)//IDC服务
        {
            orderBll.UpOrderinfo("OrderStatus=99", mod.id);
            cartBll.IDC_UpdateEndTimeByOid(mod.id);
        }
        else if (mod.Ordertype == (int)M_OrderList.OrderEnum.Purse)//余额充值,不支持银币
        {
            buser.ChangeVirtualMoney(mod.Userid, new M_UserExpHis()
            {
                score     = (int)mod.Ordersamount,
                ScoreType = (int)M_UserExpHis.SType.Purse,
                detail    = "余额充值,订单号:" + mod.OrderNo
            });
            orderBll.UpOrderinfo("OrderStatus=99", mod.id);            //成功的订单
        }
        else if ((mod.Ordertype == (int)M_OrderList.OrderEnum.IDCRen)) //IDC服务续费
        {
            orderBll.UpOrderinfo("OrderStatus=99", mod.id);
            B_Product proBll = new B_Product();
            //更新旧订单的期限
            if (string.IsNullOrEmpty(mod.Ordermessage))//购物车ID
            {
                //function.WriteErrMsg("出错,无需续费订单信息,请联系管理员!!!");
                throw new Exception("出错,无续费订单信息,请联系管理员");
            }
            M_CartPro newCartMod = cartBll.SelModByOrderID(mod.id);//新购物车只是取其商品ID与数量等
            M_Product proMod     = proBll.GetproductByid(newCartMod.ProID);
            //更新延长旧服务的到期时间,旧服务是存在CartPro的EndTime当中
            M_CartPro oldCartMod = cartBll.SelReturnModel(Convert.ToInt32(mod.Ordermessage));
            if (oldCartMod.EndTime < DateTime.Now)
            {
                oldCartMod.EndTime = DateTime.Now;                                   //如已过期,则将时间更新至今日
            }
            oldCartMod.EndTime = proBll.GetEndTime(proMod, newCartMod.Pronum, oldCartMod.EndTime);
            cartBll.UpdateByID(oldCartMod);
            //paylogMod.Remind = "为" + mod.Ordermessage + "订单续费(购物车)";
        }
        else if (mod.Ordertype == (int)M_OrderList.OrderEnum.Cloud)//云购订单
        {
            //根据份数生成幸运码,写入表中,并减去库存 ZL_Order_LuckCode
        }
        else//其他旅游订单等,只更新状态
        {
            orderBll.UpOrderinfo("OrderStatus=99", mod.id);//成功的订单
        }
        //-------支付成功处理,并写入日志
        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);
    }