Esempio n. 1
0
        private OtherResult UpGetTime(HttpContext con)
        {
            OtherResult res = new OtherResult();

            if (con.Request["id"] == null)
            {
                res.IsSuccess = false;
                res.Message   = "商品ID为必须参数";
            }
            DateTime dtNow = DateTime.Now;
            string   id    = con.Request["id"].ToString();

            BLL.TljInfo   bllTljInfo   = new BLL.TljInfo();
            Model.TljInfo ModelTljInfo = new Model.TljInfo();
            ModelTljInfo = bllTljInfo.GetModel(int.Parse(id));
            if (ModelTljInfo != null)
            {
                ModelTljInfo.ifget   = true;
                ModelTljInfo.gettime = dtNow;
            }
            bllTljInfo.Update(ModelTljInfo);

            object obj = new
            {
                ifget   = "是",
                gettime = dtNow.ToString("yyyy-MM-dd HH:mm:ss")
            };

            res.IsSuccess = true;
            res.Message   = JsonHelper.JsonSerializer <object>(obj);
            return(res);
        }
Esempio n. 2
0
        private ApiResult GetActiveCodeList(HttpContext con)
        {
            BLL.TljInfo bllTljInfo = new BLL.TljInfo();
            ApiResult   res        = new ApiResult();
            DateTime    dtNow      = DateTime.Now;
            DateTime    dtToday    = DateTime.Parse(dtNow.ToShortDateString());

            try
            {
                int total = 0;
                Model.TljInfoCondition cond = new Model.TljInfoCondition {
                    ifget         = false,
                    Ifok          = "已生成",
                    statStartTime = dtToday
                };
                var list = bllTljInfo.GetList(1, int.MaxValue, ref total, cond, t => t.ID)
                           .GroupBy(m => new
                {
                    m.ActiveCode,
                    m.item_id,
                    m.goodsname,
                    m.item_pic
                }).Select(m => new {
                    ActiveCode = m.Key.ActiveCode,
                    goodsname  = m.Key.goodsname,
                    item_id    = m.Key.item_id,
                    item_pic   = m.Key.item_pic,
                    count      = m.Count()
                }).ToList();

                res.message = JsonConvert.SerializeObject(list);
                res.success = true;
            }
            catch (Exception e)
            {
                res.success = false;
                res.message = "操作失败," + e.Message;
            }

            return(res);
        }
Esempio n. 3
0
        private ApiResult GetKouling(HttpContext con)
        {
            BLL.TljInfo bllTljInfo = new BLL.TljInfo();
            ApiResult   res        = new ApiResult();
            DateTime    dtNow      = DateTime.Now;

            try
            {
                string code  = GetRequest(con, "code");
                var    model = bllTljInfo.GetModel(t => t.ifok == "已生成" && t.ifget == false && t.ActiveCode == code);
                if (model != null)
                {
                    object obj = new
                    {
                        ActiveCode = model.ActiveCode,
                        goodsname  = model.goodsname,
                        item_id    = model.item_id,
                        item_pic   = model.item_pic,
                        kouling    = model.kouling
                    };
                    model.ifget   = true;
                    model.gettime = dtNow;
                    bllTljInfo.Update(model);
                    res.message = JsonConvert.SerializeObject(obj);
                    res.success = true;
                }
                else
                {
                    res.message = "口令已经领取完毕";
                    res.success = false;
                }
            }
            catch (Exception e)
            {
                res.success = false;
                res.message = "操作失败," + e.Message;
            }

            return(res);
        }