/// <summary> /// 获取发帖用户信息列表 后台 /// </summary> /// <param name="aid"></param> /// <param name="totalCount"></param> /// <param name="pageSize"></param> /// <param name="pageIndex"></param> /// <param name="userName"></param> /// <param name="userPhone"></param> /// <param name="startDate"></param> /// <param name="endDate"></param> /// <param name="orderWhere"></param> /// <returns></returns> public List <PlatPostUser> getListByaid(int aid, ref int totalCount, int pageSize = 10, int pageIndex = 1, string userName = "", string userPhone = "", string startDate = "", string endDate = "", string orderWhere = "addTime desc") { List <PlatPostUser> listPlatPostUser = new List <PlatPostUser>(); List <PlatMyCard> listPlatMyCard = PlatMyCardBLL.SingleModel.GetDataList(aid, ref totalCount, userName, string.Empty, userPhone, startDate, endDate, pageSize, pageIndex); if (listPlatMyCard != null && listPlatMyCard.Count > 0) { //查询到用户 foreach (PlatMyCard item in listPlatMyCard) { PlatPostUser platPostUser = new PlatPostUser(); platPostUser.PlatMyCardId = item.Id; platPostUser.NickName = item.Name; platPostUser.Phone = item.Phone; platPostUser.AddTimeStr = item.AddTimeStr; PlatPostUserMsgCountViewMolde model = GetCountViewModel(item.Id); if (model != null) { platPostUser.PostMsgCount = model.PostMsgCount; platPostUser.TopMsgCount = model.TopMsgCount; platPostUser.PostMsgPrice = model.PostMsgPrice; } listPlatPostUser.Add(platPostUser); } } return(listPlatPostUser); }
public PlatMyCard GetMyCardData(int cardid, int aid) { PlatMyCard model = base.GetModel(cardid); if (model == null) { return(new PlatMyCard()); } PlatPostUserMsgCountViewMolde msgmodel = PlatPostUserBLL.SingleModel.GetCountViewModel(model.Id); if (msgmodel != null) { model.MsgCount = msgmodel.PostMsgCount; } model.ContentCount = PlatMsgCommentBLL.SingleModel.GetUserContentCount(model.UserId); model.MsgDzCount = PlatUserFavoriteMsgBLL.SingleModel.GetMyMsgCount(model.UserId, (int)PointsActionType.点赞, (int)PointsDataType.帖子); PlatMsgviewFavoriteShare smodel = PlatMsgviewFavoriteShareBLL.SingleModel.GetModelByMsgId(aid, model.Id, (int)PointsDataType.片); if (smodel != null) { model.FollowCount = smodel.FollowCount; model.FavoriteCount = smodel.FavoriteCount; model.DzCount = smodel.DzCount; model.ViewCount = smodel.ViewCount; model.SiXinCount = smodel.SiXinCount; model.NewData = GetRedisCach(model.Id); } //行业 PlatIndustry industrymodel = PlatIndustryBLL.SingleModel.GetModel(model.IndustryId); model.IndustryName = industrymodel?.Name; //店铺 PlatStore store = PlatStoreBLL.SingleModel.GetModelBycardid(model.AId, model.Id); if (store != null) { smodel = PlatMsgviewFavoriteShareBLL.SingleModel.GetModelByMsgId(aid, store.Id, (int)PointsDataType.店铺); if (smodel != null) { model.StoreFavoriteCount = smodel.FavoriteCount; model.StoreViewCount = store.StorePV + store.StoreVirtualPV; model.StoreVistorCount = PlatUserFavoriteMsgBLL.SingleModel.GetUserMsgCount(model.AId, store.Id, (int)PointsActionType.过, (int)PointsDataType.店铺); } } return(model); }
public List <PlatMyCard> GetMyCardDataList(string appid, int aid, ref int count, string name = "", string phone = "", int pageSize = 10, int pageIndex = 1, string loginid = "", int storestate = 0) { List <PlatMyCard> list = new List <PlatMyCard>(); List <MySqlParameter> parms = new List <MySqlParameter>(); string sql = $"select mc.*,s.name storename from platmycard mc left join platstore s on mc.id=s.mycardid left join PlatStoreRelation sr on s.id = sr.StoreId"; string sqlcount = "select count(*) from platmycard mc left join platstore s on mc.id=s.mycardid left join PlatStoreRelation sr on s.id = sr.StoreId"; string sqlwhere = $" where mc.aid={aid} and mc.appid='{appid}'"; string sqlpage = $" limit {(pageIndex - 1) * pageSize},{pageSize}"; if (!string.IsNullOrEmpty(name)) { sqlwhere += $" and mc.name like @name"; parms.Add(new MySqlParameter("@name", $"%{name}%")); } if (!string.IsNullOrEmpty(phone)) { sqlwhere += $" and mc.phone like @phone "; parms.Add(new MySqlParameter("@phone", $"%{phone}%")); } if (!string.IsNullOrEmpty(loginid)) { sqlwhere += $" and mc.loginid like @loginid "; parms.Add(new MySqlParameter("@loginid", $"%{loginid}%")); } if (storestate >= 0) { sqlwhere += $" and sr.State ={storestate}"; } count = base.GetCountBySql(sqlcount + sqlwhere, parms.ToArray()); using (MySqlDataReader dr = SqlMySql.ExecuteDataReaderMaster(connName, CommandType.Text, sql + sqlwhere + sqlpage, parms.ToArray())) { while (dr.Read()) { PlatMyCard model = base.GetModel(dr); model.StoreName = dr["storename"].ToString(); PlatPostUserMsgCountViewMolde msgmodel = PlatPostUserBLL.SingleModel.GetCountViewModel(model.Id); if (msgmodel != null) { model.MsgCount = msgmodel.PostMsgCount; } list.Add(model); } } return(list); }
/// <summary> /// 获取用户发布信息的统计 总发帖数量-总置顶天数-总置顶天数所花费的总金额 /// </summary> /// <param name="userId"></param> /// <returns></returns> public PlatPostUserMsgCountViewMolde GetCountViewModel(int PlatMyCardId) { PlatPostUserMsgCountViewMolde model = new PlatPostUserMsgCountViewMolde(); if (PlatMyCardId > 0) { string sql = $"SELECT COUNT(Id) as PostMsgCount,SUM(topcostprice) as PostMsgPrice,(SELECT COUNT(Id) from PlatMsg where MyCardId={PlatMyCardId} and topday>0 and state<>0 and payState=1 and isTop=1) as TopMsgCount from PlatMsg where MyCardId={PlatMyCardId} and state<>0 and payState=1"; using (var dr = SqlMySql.ExecuteDataReader(Utility.dbEnum.MINIAPP.ToString(), CommandType.Text, sql)) { while (dr.Read()) { model.PostMsgCount = Convert.ToInt32(dr["PostMsgCount"]); model.PostMsgPrice = (dr["PostMsgPrice"] == DBNull.Value ? 0 : Convert.ToDouble(dr["PostMsgPrice"]) * 0.01).ToString("0.00"); model.TopMsgCount = Convert.ToInt32(dr["TopMsgCount"]); } } } return(model); }