Exemple #1
0
        /// <summary>
        /// 根据商品ID获取商品
        /// </summary>
        /// <param name="pID">商品ID</param>
        /// <returns></returns>
        public HttpResponseMessage GetProductByID()
        {
            HttpResponseMessage response = null;
            var product = new Product();

            try
            {
                var str = "";
                using (var ms = new MemoryStream())
                {
                    HttpContext.Current.Request.GetBufferlessInputStream().CopyTo(ms);
                    if (ms.Length != 0)
                    {
                        str = WebCommom.HttpRequestBodyConvertToStr(ms);//获取Request Body
                    }
                }
                if (!string.IsNullOrWhiteSpace(str))
                {
                    var id = Convert.ToInt32(str);
                    product = bll.Value.GetProductByID(id);
                }
            }
            catch (Exception ex)
            {
            }
            response = WebCommom.GetJsonResponse(product);
            return(response);
        }
Exemple #2
0
        /// <summary>
        /// 删除横幅
        /// </summary>
        /// <returns></returns>
        public HttpResponseMessage DeleteProduct()
        {
            HttpResponseMessage response = null;
            var result = false;

            try
            {
                var pID = 0;
                var str = "";
                using (var ms = new MemoryStream())
                {
                    HttpContext.Current.Request.GetBufferlessInputStream().CopyTo(ms);
                    str = WebCommom.HttpRequestBodyConvertToStr(ms);//获取Request Body
                }

                if (!string.IsNullOrWhiteSpace(str))
                {
                    pID    = Convert.ToInt32(str);
                    result = bll.Value.DeleteProduct(pID);
                }
                if (result)
                {
                    lucene.Value.IndexPath = indexPath;
                    lucene.Value.DeleteDocument(Utilities.GetPropertyName <Product>(f => f.Name), pID.ToString());
                }
            }
            catch (Exception ex)
            {
            }
            response = WebCommom.GetResponse(result);
            return(response);
        }
Exemple #3
0
        /// <summary>
        /// 获取热销商品
        /// </summary>
        /// <returns></returns>
        public HttpResponseMessage GetHotProduct()
        {
            HttpResponseMessage response = null;

            try
            {
                var count = 0;
                var list  = new List <Product>();
                var str   = "";
                using (var ms = new MemoryStream())
                {
                    HttpContext.Current.Request.GetBufferlessInputStream().CopyTo(ms);
                    if (ms.Length != 0)
                    {
                        str = WebCommom.HttpRequestBodyConvertToStr(ms);//获取Request Body
                    }
                }
                if (!string.IsNullOrWhiteSpace(str))
                {
                    count = Convert.ToInt32(str);
                    list  = bll.Value.GetHotProduct(count);
                }
                else
                {
                    list = bll.Value.GetHotProduct();
                }

                response = WebCommom.GetJsonResponse(list);
            }
            catch (Exception ex)
            {
            }
            return(response);
        }
Exemple #4
0
        public HttpResponseMessage GetMessageByReceiveUid()
        {
            HttpResponseMessage result = null;

            try
            {
                string str = "";
                using (var ms = new MemoryStream())
                {
                    HttpContext.Current.Request.GetBufferlessInputStream().CopyTo(ms);
                    if (ms.Length != 0)
                    {
                        str = WebCommom.HttpRequestBodyConvertToStr(ms);//获取Request Body
                    }
                }
                var ResponseArray = JsonConvert.DeserializeObject <string>(str);

                var Uid = Convert.ToInt32(ResponseArray);

                MessageTb_BLL bll = new MessageTb_BLL();


                return(WebCommom.GetJsonResponse(bll.GetMessageByReceiveUid(Uid)));
            }
            catch (Exception)
            {
            }
            return(result);
        }
Exemple #5
0
        public HttpResponseMessage ReplyMessage()
        {
            HttpResponseMessage result = null;

            try
            {
                string str = "";
                using (var ms = new MemoryStream())
                {
                    HttpContext.Current.Request.GetBufferlessInputStream().CopyTo(ms);
                    if (ms.Length != 0)
                    {
                        str = WebCommom.HttpRequestBodyConvertToStr(ms);//获取Request Body
                    }
                }

                var Item = JsonConvert.DeserializeObject <MessageTb>(str);

                MessageTb_BLL bll = new MessageTb_BLL();
                return(WebCommom.GetJsonResponse(bll.ReplyMessage(Item)));
            }
            catch (Exception)
            {
            }
            return(result);
        }
Exemple #6
0
        /// <summary>
        /// 删除品牌
        /// </summary>
        /// <returns></returns>
        public HttpResponseMessage DeleteBrand()
        {
            HttpResponseMessage response = null;

            try
            {
                var result = false;
                var str    = "";
                using (var ms = new MemoryStream())
                {
                    HttpContext.Current.Request.GetBufferlessInputStream().CopyTo(ms);
                    if (ms.Length != 0)
                    {
                        str = WebCommom.HttpRequestBodyConvertToStr(ms);//获取Request Body
                    }
                }

                if (!string.IsNullOrWhiteSpace(str))
                {
                    var bID = Convert.ToInt32(str);
                    result = bll.Value.DeleteBrand(bID);
                }

                response = WebCommom.GetResponse(result);
            }
            catch (Exception ex)
            {
            }
            return(response);
        }
        public HttpResponseMessage GetUserProductConsultList()
        {
            HttpResponseMessage result = null;

            try
            {
                string str = "";
                using (var ms = new MemoryStream())
                {
                    HttpContext.Current.Request.GetBufferlessInputStream().CopyTo(ms);
                    if (ms.Length != 0)
                    {
                        str = WebCommom.HttpRequestBodyConvertToStr(ms);//获取Request Body
                    }
                }
                var Item               = JsonConvert.DeserializeObject <string[]>(str);
                int uid                = Convert.ToInt32(Item[0]);
                int pageSize           = Convert.ToInt32(Item[1]);
                int pageNumber         = Convert.ToInt32(Item[2]);
                ProductConsult_BLL bll = new ProductConsult_BLL();

                var Res = bll.GetProductConsultListByUid(uid, 0, pageSize, pageNumber);

                return(WebCommom.GetJsonResponse(Res));
            }
            catch (Exception)
            {
            }
            return(result);
        }
Exemple #8
0
        public HttpResponseMessage CreatePayOrder()
        {
            HttpResponseMessage response = null;
            PayOrder            payOrder = new PayOrder();

            try
            {
                List <Order> orders = null;
                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);
                        orders = JsonConvert.DeserializeObject <List <Order> >(pText);
                    }
                }
                if (orders != null)
                {
                    payOrder.Orders = orders;
                    payOrder.ID     = payOrderBll.Value.CreatePayOrder(payOrder);
                }
            }
            catch (Exception ex)
            {
            }
            var responseCText = AES.AESEncrypt(JsonConvert.SerializeObject(payOrder), AESKey);//返回密文

            response = WebCommom.GetResponse(responseCText);
            return(response);
        }
Exemple #9
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);
        }
Exemple #10
0
        /// <summary>
        /// 根据类目获取产品
        /// </summary>
        /// <returns></returns>
        public HttpResponseMessage GetProductByCategory()
        {
            HttpResponseMessage response = null;

            try
            {
                var            count = 0;
                List <Product> list  = new List <Product>();
                var            str   = "";
                using (var ms = new MemoryStream())
                {
                    HttpContext.Current.Request.GetBufferlessInputStream().CopyTo(ms);
                    if (ms.Length != 0)
                    {
                        str = WebCommom.HttpRequestBodyConvertToStr(ms);//获取Request Body
                    }
                }
                if (!string.IsNullOrWhiteSpace(str))
                {
                    var arr    = str.Split(',');
                    var cateID = Convert.ToInt32(arr[0]);
                    if (arr.Length > 1)//Index 0是cateID,1是count
                    {
                        count = Convert.ToInt32(arr[1]);
                    }
                    var cateIDList = cateBll.Value.GetCategoryChildren(cateID);//获取cate子ID
                    if (count != 0)
                    {
                        list = bll.Value.GetProductByCate(cateIDList, count);
                    }
                    else
                    {
                        list = bll.Value.GetProductByCate(cateIDList);
                    }
                }
                response = WebCommom.GetJsonResponse(list);
            }
            catch (Exception ex)
            {
            }
            return(response);
        }
Exemple #11
0
        public HttpResponseMessage CreateOrder()
        {
            List <Order>        resultList = new List <Order>();//创建成功的订单
            HttpResponseMessage response   = null;

            try
            {
                List <Order> list = null;
                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);             //明文
                        list = JsonConvert.DeserializeObject <List <Order> >(pText);
                    }
                }
                if (list != null)
                {
                    //  ProductStock_Cache p = new ProductStock_Cache();
                    //   var updateResult = p.UdpateStock(0, GetUpdateProdcut(list));//修改结果
                    //   resultList = GetSuccessOrder(updateResult, list);//获取修改成功的订单
                    #region 将订单加入到MQ,订单加入MQ之后则代表创建成功
                    //if (resultList.Count > 0)
                    //{
                    //    YunXiu.Commom.MQ.MSMQ mq = new YunXiu.Commom.MQ.MSMQ();
                    //    mq.MSMQIP = "192.168.9.32";
                    //    mq.MSMQName = "OrderQueue";
                    //    mq.MSG = JsonConvert.SerializeObject(resultList);
                    //    mq.SendToMSMQ();
                    //}
                    #endregion
                }
            }
            catch (Exception ex)
            {
            }
            var responseCText = AES.AESEncrypt(JsonConvert.SerializeObject(resultList), AESKey);//结果密文
            response = WebCommom.GetResponse(responseCText);
            return(response);
        }