/// <summary> /// 订单支付成功时调用 /// </summary> /// <param name="order"></param> public static void OnOrderPaySuccess(CommodityOrder order) { LogHelper.Info("进入OrderEventHelper.OnOrderPaySuccess-" + order.Code + ",OrderId:" + order.Id + ",OrderState:" + order.State); // 拼图支付成功时不触发 if (order.State != 1) { return; } // 发送消息 var requestPar = "{\"project\":\"btp\",\"topic\":\"btporder-0x0001\",\"data\":\""; var data = "{\"orderId\": \"" + order.Id + "\",\"userId\": \"" + order.UserId + "\",\"appId\": \"" + order.AppId + "\"}"; requestPar += System.Web.HttpUtility.UrlEncode(data, Encoding.GetEncoding("gbk")) + "\"}"; var requestUrl = msgUrl + "?" + System.Web.HttpUtility.UrlEncode(requestPar, Encoding.GetEncoding("gbk")); HttpWebRequest request = (HttpWebRequest)WebRequest.Create(requestUrl); request.Method = "GET"; request.ContentType = "text/html;charset=UTF-8"; try { using (HttpWebResponse response = (HttpWebResponse)request.GetResponse()) { if (response.StatusCode == HttpStatusCode.OK) { LogHelper.Info("OrderEventHelper.OnOrderPaySuccess 发送消息成功, RequestUrl: " + requestUrl); } else { LogHelper.Error("OrderEventHelper.OnOrderPaySuccess 发送消息失败, RequestUrl: " + requestUrl + " \r\nResponseCode: " + response.StatusCode); } } } catch (Exception ex) { LogHelper.Error("OrderEventHelper.OnOrderPaySuccess 发送消息异常, RequestUrl: " + requestUrl, ex); } switch (ThirdECommerceHelper.GetAppThirdECommerceType(order.AppId)) { case Deploy.Enum.ThirdECommerceTypeEnum.JingDongDaKeHu: // 更新京东订单 JdOrderHelper.UpdateJdorder(order.Id); break; case Deploy.Enum.ThirdECommerceTypeEnum.SuNingYiGou: // 确认苏宁预占 SuningSV.suning_govbus_confirmorder_add(order.Id, false); break; case Deploy.Enum.ThirdECommerceTypeEnum.FangZheng: // 方正电商订单 FangZhengSV.FangZheng_Order_Confirm(order.Id, false); break; } }
public bool ChangeOrderStatusForJobExt() { try { //更改订单状态 var DataList = SuningSV.suning_govbus_message_get("11"); DataList.ForEach(Item => { var EntityList = SNOrderItem.ObjectSet() .Where(w => w.CustomOrderId == Item.orderNo) .ToList(); if (EntityList != null) { EntityList.ForEach(ItemModel => { ItemModel.Status = Convert.ToInt32(Item.status); ItemModel.EntityState = EntityState.Modified; SNOrderItem.ObjectSet().Attach(ItemModel); //根据ID从消息池删除数据 if (ContextFactory.CurrentThreadContext.SaveChanges() >= 0) { SuningSV.suning_govbus_message_delete(Item.id); } }); } }); //检查确认预占失败的订单 SNOrderItem.ObjectSet().Where(w => w.Status < 3).ToList() .ForEach(Item => { SuningSV.suning_govbus_confirmorder_add(Item.OrderId, false); }); return(true); } catch (Exception ex) { LogHelper.Error(string.Format("Job-SuningChangeOrderStatus:{0}", ex.Message)); return(false); } }