public ActionResult AjaxUserInfo(int?UserID, string NickName) { YSWL.MALL.BLL.Members.Users UserBll = new BLL.Members.Users(); YSWL.MALL.BLL.Members.UsersExp UserExBll = new BLL.Members.UsersExp(); YSWL.MALL.Model.Members.UsersExpModel UserExModel = new Model.Members.UsersExpModel(); int ID; if (!string.IsNullOrEmpty(NickName)) { if ((ID = UserBll.GetUserIdByNickName(NickName)) > 0) { UserID = ID; } else { return(View("_AjaxUserInfo", UserExModel)); } } if (UserID.HasValue) { UserExModel = UserExBll.GetUsersModel(UserID.Value); YSWL.MALL.BLL.Ms.Regions RegionBll = new BLL.Ms.Regions(); string strAddress = RegionBll.GetRegionNameByRID(Common.Globals.SafeInt(UserExModel.Address, 0)); if (strAddress.Contains("北京北京")) { strAddress = strAddress.Replace("北京北京", "北京"); } else if (strAddress.Contains("上海上海")) { strAddress = strAddress.Replace("上海上海", "上海"); } else if (strAddress.Contains("重庆重庆")) { strAddress = strAddress.Replace("重庆重庆", "重庆"); } else if (strAddress.Contains("天津天津")) { strAddress = strAddress.Replace("天津天津", "天津"); } UserExModel.Address = string.IsNullOrEmpty(UserExModel.Address) ? "暂未设置" : strAddress; } YSWL.MALL.BLL.SNS.UserShip shipBll = new YSWL.MALL.BLL.SNS.UserShip(); if (currentUser != null) { if (currentUser.UserID == UserID.Value) { ViewBag.IsSelf = true; } else { if (shipBll.Exists(currentUser.UserID, UserID.Value)) { ViewBag.IsFellow = true; } } } return(View("_AjaxUserInfo", UserExModel)); }
/// <summary> /// 用户的粉丝 /// </summary> /// <returns></returns> public ActionResult Fans(int?uid, int?page) { if (!LoadUserInfo(uid == null ? 0 : uid.Value)) { if (MvcApplication.MainAreaRoute == AreaRoute.SNS) { //SNS 主域 return(Redirect(ViewBag.BasePath + "Account/Login")); } return(Redirect("/SNS/Account/Login")); } YSWL.MALL.BLL.SNS.UserShip bllUserShip = new YSWL.MALL.BLL.SNS.UserShip(); //重置页面索引 page = page.HasValue && page.Value > 1 ? page.Value : 1; //页大小 int pagesize = 10; //计算分页起始索引 int startIndex = page.Value > 1 ? (page.Value - 1) * pagesize + 1 : 1; //计算分页结束索引 int endIndex = page.Value * pagesize; //总记录数 int toalcount = UserModel.FansCount.HasValue ? UserModel.FansCount.Value : 0; PagedList <YSWL.MALL.Model.SNS.UserShip> FansList = null; int Cuid = (this.IsCurrentUser == false && currentUser != null) ? currentUser.UserID : 0; List <YSWL.MALL.Model.SNS.UserShip> list = bllUserShip.GetUsersAllFansByPage(this.UserID, startIndex, endIndex, Cuid); if (list != null && list.Count > 0) { FansList = new PagedList <YSWL.MALL.Model.SNS.UserShip>(list, page ?? 1, pagesize, toalcount); } if (Request.IsAjaxRequest()) { return(PartialView(CurrentThemeViewPath + "/UserProfile/FansList.cshtml", FansList)); } ViewBag.IsCurrentUser = this.IsCurrentUser; ViewBag.UserId = this.UserID; #region SEO 优化设置 IPageSetting pageSetting = PageSetting.GetPageSetting("Base", ApplicationKeyType.SNS); ViewBag.Keywords = pageSetting.Keywords; ViewBag.Description = pageSetting.Description; if (ViewBag.IsCurrentUser == true) { ViewBag.Title = "我的粉丝 - " + pageSetting.Title; } else { ViewBag.Title = this.NickName + "的粉丝 - " + pageSetting.Title; } #endregion return(View(CurrentThemeViewPath + "/UserProfile/Fans.cshtml", FansList)); }
/// <summary> /// 用户中心右边信息的分布试图 /// </summary> /// <returns></returns> public PartialViewResult ProfileLeft(int?uid) { YSWL.MALL.BLL.SNS.UserShip shipBll = new YSWL.MALL.BLL.SNS.UserShip(); YSWL.MALL.BLL.Members.UsersExp userBll = new BLL.Members.UsersExp(); YSWL.MALL.Model.Members.UsersExpModel userModel = new Model.Members.UsersExpModel(); YSWL.MALL.BLL.SNS.Groups groupBll = new YSWL.MALL.BLL.SNS.Groups(); int UserId = uid.HasValue ? uid.Value : (currentUser != null ? currentUser.UserID : 0); List <YSWL.MALL.Model.SNS.UserShip> ListShip = shipBll.GetToListByFansPage(UserId, "", 0, 9); List <YSWL.MALL.Model.SNS.Groups> ListGroupJoin = groupBll.GetUserJoinGroup(UserId, 9); List <YSWL.MALL.Model.SNS.Groups> ListGroupCreate = groupBll.GetModelList("CreatedUserId=" + UserId + ""); userModel = userBll.GetUsersExpModel(UserId); ViewBag.FansCount = userModel != null ? userModel.FansCount : 0; ViewBag.IsCurrentUser = uid.HasValue ? false : (currentUser != null ? true : false); ViewBag.UserId = UserId; YSWL.MALL.ViewModel.SNS.ProfileLeft model = new MALL.ViewModel.SNS.ProfileLeft(); model.joingroupList = ListGroupJoin; model.shipList = ListShip; model.creategroupList = ListGroupCreate; return(PartialView("_ProfileLeft", model)); }