예제 #1
0
        protected void Application_Start()
        {
            AreaRegistration.RegisterAllAreas();
            GlobalConfiguration.Configure(WebApiConfig.Register);
            FilterConfig.RegisterGlobalFilters(GlobalFilters.Filters);
            RouteConfig.RegisterRoutes(RouteTable.Routes);
            BundleConfig.RegisterBundles(BundleTable.Bundles);

            #region  初始化配置
            var sysConfPath = Server.MapPath("/App_Data/SysConfKey.xml");
            var SMSConfPath = Server.MapPath("/App_Data/SMSConfig.xml");
            ThreadPool.QueueUserWorkItem(o =>
            {
                #region 系统配置
                var keys   = YunXiu.Commom.CommomClass.GetXmlNodeValue(sysConfPath, "/keys/key");
                var isLoad = YunXiu.Commom.CommomClass.LoadConfigDictionary(keys);
                if (!isLoad)
                {
                    //如果配置没有加载成功通知运维
                }
                #endregion

                #region 短信供应商配置
                GlobalDictionary.SMSConfDic = CommomClass.GetXmlNodeVal(SMSConfPath, "/SMS/SMSProvider[IsUse=1]");
                #endregion
            });
            #endregion

            #region 初始化库存
            ThreadPool.QueueUserWorkItem(o =>
            {
                // ProductStock_Cache cache = new ProductStock_Cache();
                ProductStock_BLL productStockBLL = new ProductStock_BLL();
                //  cache.SaveProductStock(productStockBLL.GetProductStock());
            });
            #endregion

            #region 读取MQ的订单(MSMQ)
            MSMQ m = new MSMQ
            {
                MSMQIP   = "192.168.9.32",
                MSMQName = "orderQueue"
            };

            ThreadPool.QueueUserWorkItem(o =>
            {
                while (true)
                {
                    Thread.Sleep(100);
                    m.BeginReceive("", "");
                    m.receiveComplete += MQMQReceiveComplete;
                }
            });
            #endregion
        }
예제 #2
0
        public HttpResponseMessage UpdatePayOrder()
        {
            HttpResponseMessage response = null;
            var result = false;

            try
            {
                PayOrder payOrder = new PayOrder();
                using (var ms = new MemoryStream())
                {
                    HttpContext.Current.Request.GetBufferlessInputStream().CopyTo(ms);
                    if (ms.Length != 0)
                    {
                        var cText = WebCommom.HttpRequestBodyConvertToStr(ms);//密文
                        var pText = AES.AESDecrypt(cText, AESKey);
                        payOrder = JsonConvert.DeserializeObject <PayOrder>(pText);
                    }
                }
                result = payOrderBll.Value.UdpatePayOrder(payOrder);
                #region   如果支付成功则通知店家发货(此处可改为异步处理)
                if (payOrder.TradeStatus == "")
                {
                    for (int i = 0; i < payOrder.Orders.Count; i++)
                    {
                        var storeStaff = storeStaffBll.Value.GetReceiveDeliveryStaff(payOrder.Orders[i].BuyProduct.Store.StoreID);
                        var phoneList  = new List <string>();
                        for (int j = 0; j < storeStaff.Count; j++)
                        {
                            phoneList.Add(storeStaff[j].Phone);
                        }
                        SMS sms = new SMS {
                        };
                        //  sms.ReceiveNo = phoneList;
                        //   sms.MSGContent = "";
                        CommomClass.HttpPost(GlobalDictionary.GetSysConfVal("AccountApiAddr"), JsonConvert.SerializeObject(sms));//通知店铺员工发货
                    }
                }
                #endregion
            }
            catch (Exception ex)
            {
            }
            response = WebCommom.GetResponse(result);
            return(response);
        }
예제 #3
0
        protected void Application_Start()
        {
            AreaRegistration.RegisterAllAreas();
            GlobalConfiguration.Configure(WebApiConfig.Register);
            FilterConfig.RegisterGlobalFilters(GlobalFilters.Filters);
            RouteConfig.RegisterRoutes(RouteTable.Routes);
            BundleConfig.RegisterBundles(BundleTable.Bundles);

            #region  初始化配置
            var sysConfPath = Server.MapPath("/App_Data/SysConf.xml");
            var SMSConfPath = Server.MapPath("/App_Data/SMSConfig.xml");
            ThreadPool.QueueUserWorkItem(o =>
            {
                #region 系统配置
                GlobalDictionary.SysConfDictionary = CommomClass.GetXmlNodeVal(sysConfPath, "/Sys");
                #endregion

                #region 短信供应商配置
                GlobalDictionary.SMSConfDic = CommomClass.GetXmlNodeVal(SMSConfPath, "/SMS/SMSProvider[IsUse=1]");
                #endregion
            });
            #endregion
        }