Beispiel #1
0
        public void getPanicbuyingItemList()
        {
            APIRequest request = new APIRequest();

            request.common            = new CommonReqPara();
            request.common.customerId = customerid;

            GetPanicbuyingItemListReqPara para = new GetPanicbuyingItemListReqPara();

            para.eventTypeId = "2";
            para.page        = "1";
            para.pageSize    = "10";
            request.special  = para;

            string json = string.Format("action=getPanicbuyingItemList&ReqContent={0}", request.ToJSON());

            //string json = "action=getPanicbuyingItemList&ReqContent=%7B%22common%22%3A%7B%22openId%22%3A%22ofUHqjgSme_qaNQN0oohrM7kX_Ck%22%2C%22customerId%22%3A%226c1ce52aa43441a3a13c87b41fcafd54%22%2C%22userId%22%3A%22add73ef71c2c480c89b5a6941cb0dfc9%22%2C%22locale%22%3Anull%7D%2C%22special%22%3A%7B%22action%22%3A%22getPanicbuyingItemList%22%2C%22eventTypeId%22%3A2%2C%22eventId%22%3A%22188660f3-6aa9-4686-a3d0-1c1d2a9772ee%22%2C%22page%22%3A1%2C%22pageSize%22%3A99%7D%7D";

            json = HttpUtility.UrlDecode("action=setOrderInfo&ReqContent=%7B%22common%22%3A%7B%22isAld%22%3A%220%22%2C%22baiduPushUserId%22%3Anull%2C%22baiduPushChannelId%22%3Anull%2C%22channelId%22%3A%224%22%2C%22locale%22%3A1%2C%22version%22%3Anull%2C%22plat%22%3A%22android%22%2C%22customerId%22%3A%2286a575e616044da3ac2c3ab492e44445%22%2C%22sessionId%22%3Anull%2C%22baiduPushAppId%22%3Anull%2C%22deviceToken%22%3Anull%2C%22userId%22%3A%227d882214265a4c41b1ab607adfef3c9f%22%2C%22businessZoneId%22%3Anull%2C%22osInfo%22%3Anull%2C%22openId%22%3A%227d882214265a4c41b1ab607adfef3c9f%22%7D%2C%22special%22%3A%7B%22tableNumber%22%3A%22%22%2C%22status%22%3A%22100%22%2C%22remark%22%3A%22%22%2C%22isGroupBy%22%3A0%2C%22joinNo%22%3A1%2C%22qty%22%3A1%2C%22username%22%3A%22%22%2C%22couponsPrompt%22%3A%22%22%2C%22deliveryId%22%3A%222%22%2C%22deliveryTime%22%3A%2213%3A44%3A04%22%2C%22eventId%22%3A%22061e0a01-3ec6-4471-bdf7-9ba9e6db4638%22%2C%22email%22%3A%22%22%2C%22reqBy%22%3A1%2C%22totalAmount%22%3A229.0%2C%22orderDetailList%22%3A%5B%7B%22beginDate%22%3A%222014-04-01+00%3A00%3A00%22%2C%22dayCount%22%3A0%2C%22discountRate%22%3A0.0%2C%22displayIndex%22%3A0%2C%22endDate%22%3A%222015-04-03+00%3A00%3A00%22%2C%22gg%22%3Anull%2C%22imageUrl%22%3A%22http%3A%2F%2Fwww.o2omarketing.cn%3A8400%2FFramework%2FUpload%2FImage%2F20140321%2F7ACDEEB3A26E479397D82F2FB38C89E4.png%22%2C%22itemCategoryName%22%3Anull%2C%22itemId%22%3A%221664035A8087491BB2B74D776334BF38%22%2C%22itemName%22%3A%22%E8%BF%9E%E9%94%81%E5%AF%86%E7%A0%81%E4%B9%A6%22%2C%22price%22%3A229.0%2C%22qty%22%3A1%2C%22salesPrice%22%3A194.65%2C%22selDate%22%3Anull%2C%22skuId%22%3A%227716d8389245544842456bc7f2b88d9e%22%2C%22selected%22%3Atrue%7D%5D%2C%22actualAmount%22%3A194.65%2C%22storeId%22%3Anull%2C%22deliveryAddress%22%3A%22%22%2C%22isPanicbuying%22%3A1%2C%22mobile%22%3A%22%22%");

            var rsp = SendHttpRequest(url, json);

            Console.WriteLine(rsp);
        }
        /// <summary>
        /// 新版获取活动列表
        /// </summary>
        /// <param name="para"></param>
        /// <returns></returns>
        public object GetPanicbuyingEventList(GetPanicbuyingItemListReqPara para)
        {
            //获取进行中的活动
            List <vwItemPEventDetailEntity> onEventItemlist = this._currentDAO.GetOnPanicbuyingEventList(para);
            //获取即将推出的活动
            List <vwItemPEventDetailEntity> soonEventItemlist = this._currentDAO.GetSoonPanicbuyingEventList(para);
            //实例化返回集合
            List <vwPanicbuyingEventEntity> eventList = new List <vwPanicbuyingEventEntity> {
            };

            #region 抢购中
            if (onEventItemlist.Count > 0)
            {
                //根据活动和开始时间筛选
                var onEventList = onEventItemlist.GroupBy(t => new { t.EventId, t.EndTime, t.RemainingSec })
                                  .Select(t => new { EventID = t.Key.EventId, EndTime = t.Key.EndTime, DeadlineSecond = t.Key.RemainingSec });
                foreach (var eventModel in onEventList)
                {
                    var detailOnList = onEventItemlist.Where(t => t.EventId == eventModel.EventID).Select(t => new vwPanicbuyingItemInfo()
                    {
                        ItemId         = t.ItemID,
                        EventId        = t.EventId,
                        ItemName       = t.ItemName,
                        ImageUrl       = t.ImageUrl,
                        ImageUrlThumb  = string.IsNullOrEmpty(t.ImageUrl) ? "" : GetImageUrl(t.ImageUrl, "_120"),
                        ImageUrlMiddle = string.IsNullOrEmpty(t.ImageUrl) ? "" : GetImageUrl(t.ImageUrl, "_240"),
                        ImageUrlBig    = string.IsNullOrEmpty(t.ImageUrl) ? "" : GetImageUrl(t.ImageUrl, "_480"),
                        Price          = t.Price.Value,
                        SalesPrice     = t.SalesPrice.Value,
                        //DiscountRate = t.DiscountRate.ToString(),
                        DiscountRate     = t.DiscountRate.Value.ToString(),
                        DisplayIndex     = t.DisplayIndex,
                        ItemCategoryName = t.ItemCategoryName,
                        SalesPersonCount = Convert.ToInt64(t.RemainingSec) > 0 ? t.SalesPersonCount : 0,
                        SkuId            = t.SkuId,
                        CreateDate       = (t.CreateTime == null ? "2017-01-01" : t.CreateTime.Substring(0, 10)),
                        SalesCount       = t.SalesQty,
                        DeadlineTime     = t.deadlineTime,
                        DeadlineSecond   = Convert.ToInt64(t.RemainingSec),
                        AddedTime        = t.AddTime.Value.To19FormatString(),
                        BeginTime        = t.BeginTime.Value.To19FormatString(),
                        EndTime          = t.EndTime.Value.To19FormatString(),
                        Qty = t.Qty,
                        //OverQty = t.Qty - t.SalesQty,
                        OverQty    = t.RemainingQty,
                        StopReason = t.StopReason,
                        Status     = t.Status
                    });
                    vwPanicbuyingEventEntity onEntity = new vwPanicbuyingEventEntity();
                    onEntity.DeadlineSecond      = Convert.ToInt64(eventModel.DeadlineSecond);
                    onEntity.EventStatusDesc     = "抢购中";
                    onEntity.PanicbuyingItemList = detailOnList.ToArray();

                    eventList.Add(onEntity);
                }
            }
            #endregion
            #region 即将开始
            if (soonEventItemlist.Count > 0)
            {
                //根据活动和开始时间筛选
                var soonEventList = soonEventItemlist.GroupBy(t => new { t.EventId, t.BeginTime, t.RemainingSec })
                                    .Select(t => new { EventID = t.Key.EventId, BeginTime = t.Key.BeginTime, RemainingSec = t.Key.RemainingSec });
                vwPanicbuyingEventEntity soonEntity = null;
                foreach (var eventModel in soonEventList)
                {
                    var detailSoonList = soonEventItemlist.Where(t => t.EventId == eventModel.EventID).Select(t => new vwPanicbuyingItemInfo()
                    {
                        ItemId         = t.ItemID,
                        EventId        = t.EventId,
                        ItemName       = t.ItemName,
                        ImageUrl       = t.ImageUrl,
                        ImageUrlThumb  = string.IsNullOrEmpty(t.ImageUrl) ? "" : GetImageUrl(t.ImageUrl, "_120"),
                        ImageUrlMiddle = string.IsNullOrEmpty(t.ImageUrl) ? "" : GetImageUrl(t.ImageUrl, "_240"),
                        ImageUrlBig    = string.IsNullOrEmpty(t.ImageUrl) ? "" : GetImageUrl(t.ImageUrl, "_480"),
                        Price          = t.Price.Value,
                        SalesPrice     = t.SalesPrice.Value,
                        DiscountRate   = t.DiscountRate.Value.ToString(),
                        //DiscountRate = t.DiscountRate.ToString(),
                        DisplayIndex     = t.DisplayIndex,
                        ItemCategoryName = t.ItemCategoryName,
                        SalesPersonCount = t.SalesPersonCount,
                        SkuId            = t.SkuId,
                        CreateDate       = t.CreateTime.Substring(0, 10),
                        SalesCount       = t.SalesQty,
                        DeadlineTime     = t.deadlineTime,
                        DeadlineSecond   = Convert.ToInt64(t.RemainingSec),
                        AddedTime        = t.AddTime.Value.To19FormatString(),
                        BeginTime        = t.BeginTime.Value.To19FormatString(),
                        EndTime          = t.EndTime.Value.To19FormatString(),
                        Qty = t.Qty,
                        //OverQty = t.Qty - t.SalesQty,
                        OverQty    = t.RemainingQty,
                        StopReason = t.StopReason,
                        Status     = t.Status
                    });
                    soonEntity = new vwPanicbuyingEventEntity();
                    soonEntity.DeadlineSecond      = Convert.ToInt64(eventModel.RemainingSec);
                    soonEntity.EventStatusDesc     = "即将开始";
                    soonEntity.PanicbuyingItemList = detailSoonList.ToArray();
                    eventList.Add(soonEntity);
                }
            }
            #endregion

            return(eventList.ToArray());
        }
 private DataSet GetListData(GetPanicbuyingItemListReqPara para)
 {
     return(this._currentDAO.GetListData(para));
 }