private void get_browse_goods(HttpContext context) { int id = DTRequest.GetQueryInt("id"); BLL.browse_goods bll = new BLL.browse_goods(); BLL.article abll = new BLL.article(); Model.article model = abll.GetModel(id); Model.browse_goods bmodel = new Model.browse_goods(); Model.users users = new BasePage().GetUserInfo(); if (users == null) { context.Response.Write("{\"status\":0, \"msg\":\"对不起,请登录!\"}"); return; } if (bll.Exists1(id)) { bll.UpdateField(id, "add_time=getdate()"); context.Response.Write("{\"status\":1, \"msg\":\"修改浏览信息成功!\"}"); return; } bmodel.user_id = users.id; bmodel.goods_id = model.id; bmodel.goods_name = model.title; bmodel.img_url = model.img_url; bmodel.add_time = DateTime.Now; bmodel.time = bmodel.add_time.ToString("yyyy-MM-dd"); if (bll.Add(bmodel) > 0) { context.Response.Write("{\"status\":1, \"msg\":\"添加浏览信息成功!\"}"); return; } else { context.Response.Write("{\"status\":0, \"msg\":\"添加浏览信息失败!\"}"); return; } }
/// <summary> /// 获取浏览的数据时间排序 /// </summary> /// <param name="top"></param> /// <param name="strwhere"></param> /// <param name="other"></param> /// <returns></returns> protected DataTable get_browse_goods_list(int top, string strwhere, string other) { BLL.browse_goods bll = new BLL.browse_goods(); return(bll.GetList(top, strwhere, "CONVERT(DateTime,time) desc").Tables[0]); }
/// <summary> /// 获取浏览的数据时间排序 /// </summary> /// <param name="top"></param> /// <param name="strwhere"></param> /// <param name="other"></param> /// <returns></returns> protected DataTable get_browse_goods_list(int top, string strwhere, string other) { BLL.browse_goods bll = new BLL.browse_goods(); return bll.GetList(top, strwhere, "CONVERT(DateTime,time) desc").Tables[0]; }