public ActionResult GetMemberInfo(Users u) { if (string.IsNullOrWhiteSpace(u.NickName) || string.IsNullOrWhiteSpace(u.AvatarUrl)) { return(Json(new { code = 1, msg = "参数错误" }, JsonRequestBehavior.AllowGet)); } Users user = UsersService.GetInfo(u.NickName, u.AvatarUrl); if (user == null) { u.LastAccessTime = DateTime.Now; u.AccessCount = 1; u.ID = UsersService.Insert(u); user = u; } else { user.AccessCount = user.AccessCount + 1; UsersService.Update(user); } UsersLLogService.Insert(user.ID); return(Json(new { code = 0, data = new { id = user.ID } }, JsonRequestBehavior.AllowGet)); }
public ActionResult Index() { var newUserCount = UsersService.GetTodayUser(); var loginUserCount = UsersLLogService.GetTodayLogin(); var browseCount = UsersBLogService.GetTodayBrowse(); List <Product> pList = ProductService.GetTopByClick(); List <Category> categoryList = CategoryService.GetList(); var selectItemList = new List <SelectListItem>() { new SelectListItem() { Value = "0", Text = "全部", Selected = true } }; var selectList = new SelectList(categoryList, "ID", "Name"); selectItemList.AddRange(selectList); ViewBag.NewCount = newUserCount; ViewBag.LoginCount = loginUserCount; ViewBag.BrowseCount = browseCount; ViewBag.ProductList = pList; ViewBag.CategoryList = selectItemList; return(View()); }