/// <summary> /// 登录后的首页的数据模型获取 /// </summary> /// <param name="userID">用户编号</param> /// <param name="pagesize">每页条数</param> /// <param name="pageno">当前页数</param> /// <returns></returns> public Models.PageModels.Content.IndexContentModel getIndexContentModel(string userID, string interestID, string city, string sex, int pagesize, int pageno) { //获取用户兴趣集合 IList<BiZ.InterestCenter.Interest> interestList = GetUserInterests(userID, interestID); if ((interestID == null || interestID == "") && interestList.Count > 0) { interestID = interestList[0].ID; } //获取内容集合 IList<BiZ.Content.PublicContent> ContentList = BiZ.Content.ContentProvider.findForSomeThing(userID, interestID, city, sex, BiZ.Comm.DeletedFlag.No, pageno, pagesize); //获取顶部推送内容集合 List<BiZ.TopImagePush.ImagePush> imagePushList = BiZ.TopImagePush.ImagePushProvider.findAll(BiZ.Comm.DeletedFlag.No, 0, 0); //随机从顶部推送内容集合中取一个内容对象 BiZ.TopImagePush.ImagePush imagePush = null; if (imagePushList.Count > 0) { Random pushrann = new Random(); imagePush = imagePushList[pushrann.Next(imagePushList.Count - 1)]; } //获取开启的城市 string[] activityCityStr = Common.Comm.GetActivityCitys().Split(','); List<string> ActivityCitys = new List<string>(); foreach (string citystr in activityCityStr) { if (citystr == "") continue; ActivityCitys.Add(citystr); } Models.PageModels.Content.IndexContentModel model = new Models.PageModels.Content.IndexContentModel(); model.UserID = userID; model.MemberID = userID; model.AlreadyLogon = userID != null && userID != "" ? true : false; model.Member = userID != null && userID != "" ? Models.DisplayObjProvider.getMemberFullDisplayObj(userID) : null; model.ContentList = ContentList; model.interestList = interestList; model.imagePush = imagePush; model.contentCount = BiZ.Content.ContentProvider.findForSomeThingCount(userID, interestID, city, sex, BiZ.Comm.DeletedFlag.No); model.ActivityCityList = ActivityCitys; model.namesModel = Common.Content.ContentNamesDefs.GetDefs(); ViewData["interestID"] = interestID; ViewData["city"] = city; ViewData["sex"] = sex; //判断当前登录的用户是否填写城市信息,如果没有则保存当前用户所选择的城市为他的所在城市信息 if ((userID != null && userID != "") && (city != null && city != "") && (model.Member.City == null || model.Member.City == "")) { string Province = BiZ.Sys.ZoneFactory.GetCityByName(city).Province; BiZ.Member.Member mym = BiZ.MemberManager.MemberManager.GetMember(userID); mym.MemberInfomation.City = Province + "|" + city; BiZ.MemberManager.MemberManager.SaveMember(mym); } return model; }
/// <summary> /// 登录前的首页的数据模型获取 /// </summary> /// <param name="userID">用户编号</param> /// <param name="pagesize">每页条数</param> /// <param name="pageno">当前页数</param> /// <returns></returns> public Models.PageModels.Content.IndexContentModel getLoginIndexContentModel(string userID, string contenttype, int pagesize, int pageno) { IList<BiZ.Like.AdminLikeData> syslikelist = BiZ.Like.LikeDataFactory.GetLike<BiZ.Like.AdminLikeData>(null, null, BiZ.Like.LikeType.Content, BiZ.Like.AdminLikeData.GetCollectionName()); var groupobjs = (from obj in syslikelist group obj by new { obj.ToId } into g select new { id = g.Key.ToId }); string[] ids = null; if (syslikelist != null && groupobjs.Count() > 0) { ids = new string[groupobjs.Count()]; int i = 0; foreach (var obj in groupobjs) { ids[i] = obj.id; i++; } } //获取内容集合 IList<BiZ.Content.PublicContent> ContentList = BiZ.Content.ContentProvider.findContentForSysLike(ids, contenttype, BiZ.Comm.DeletedFlag.No, pageno, pagesize); //获取图片内容集合 IList<BiZ.Content.PublicContent> imageContentList = BiZ.Content.ContentProvider.findContentForSysLike(ids, BiZ.Content.ContentType.Image.GetHashCode().ToString(), BiZ.Comm.DeletedFlag.No, 0, 0); //获取顶部推送内容集合 List<BiZ.TopImagePush.ImagePush> imagePushList = BiZ.TopImagePush.ImagePushProvider.findAll(BiZ.Comm.DeletedFlag.No, 0, 0); //随机从顶部推送内容集合中取一个内容对象 BiZ.TopImagePush.ImagePush imagePush = null; if (imagePushList.Count > 0) { Random pushrann = new Random(); imagePush = imagePushList[pushrann.Next(imagePushList.Count - 1)]; } Models.PageModels.Content.IndexContentModel model = new Models.PageModels.Content.IndexContentModel(); model.UserID = userID; model.MemberID = userID; model.AlreadyLogon = userID != null && userID != "" ? true : false; model.Member = userID != null && userID != "" ? Models.DisplayObjProvider.getMemberFullDisplayObj(userID) : null; model.ContentList = ContentList; model.imageContentList = imageContentList; model.imagePush = imagePush; model.contentCount = BiZ.Content.ContentProvider.findContentForSysLikeCount(ids, contenttype, BiZ.Comm.DeletedFlag.No); return model; }
public ActionResult getContentToType(string contenttype, int pagesize, int pageno) { IList<BiZ.Content.PublicContent> contentlist = BiZ.Content.ContentProvider.findCreatedTimeForType("", contenttype, BiZ.Comm.DeletedFlag.No, pageno, pagesize); Models.PageModels.Content.IndexContentModel model = new Models.PageModels.Content.IndexContentModel(); model.ContentList = contentlist; model.contentCount = BiZ.Content.ContentProvider.findForTypeCount("", contenttype, BiZ.Comm.DeletedFlag.No); return Json(new JavaScriptSerializer().Serialize(model)); }