/// <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); }
/// <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"] + "],赠送积分"); } } } }