Пример #1
0
        /// <summary>
        /// 后台手动置顶将未置顶的消息
        /// </summary>
        /// <returns></returns>
        public ActionResult DoTopMsg()
        {
            result = new PlatReturnMsg();
            int appId  = Utility.IO.Context.GetRequestInt("aid", 0);
            int Id     = Utility.IO.Context.GetRequestInt("Id", 0);
            int ruleId = Utility.IO.Context.GetRequestInt("ruleId", 0);

            if (appId <= 0 || Id <= 0)
            {
                result.Msg = "参数错误";
                return(Json(result));
            }
            PlatMsg model = PlatMsgBLL.SingleModel.GetModel(Id);

            if (model == null)
            {
                result.Msg = "数据不存在";
                return(Json(result));
            }


            if (ruleId <= 0)
            {
                result.Msg = "请选择置顶时间";
                return(Json(result));
            }

            PlatMsgRule platMsgRule = PlatMsgRuleBLL.SingleModel.GetMsgRules(appId, ruleId);

            if (platMsgRule == null)
            {
                result.Msg = "非法操作(置顶时间有误)";
                return(Json(result));
            }
            //if (model.Review == 2|| model.Review == 0)
            //{
            //    model.ReviewTime = DateTime.Now;
            //}
            model.ReviewTime   = DateTime.Now;
            model.TopDay       = platMsgRule.ExptimeDay;
            model.TopCostPrice = platMsgRule.Price;
            model.IsTop        = 1;
            model.IsDoTop      = 1;
            model.UpdateTime   = DateTime.Now;
            if (PlatMsgBLL.SingleModel.Update(model, "TopDay,TopCostPrice,IsTop,IsDoTop,UpdateTime,ReviewTime"))
            {
                result.isok = true;
                result.Msg  = "操作成功";
                return(Json(result));
            }
            else
            {
                result.Msg = "操作失败";
                return(Json(result));
            }
        }
Пример #2
0
        public List <PlatMsgReport> GetListByaid(int aid, out int totalCount, int pageSize = 10, int pageIndex = 1, string orderWhere = "addTime desc")
        {
            string strWhere = $"aid={aid} and state=0";

            totalCount = base.GetCount(strWhere);

            List <PlatMsgReport> listCity_MsgReport = base.GetList(strWhere, pageSize, pageIndex, "*", orderWhere);

            if (listCity_MsgReport != null && listCity_MsgReport.Count > 0)
            {
                string         msgIds      = string.Join(",", listCity_MsgReport.Select(s => s.MsgId).Distinct());
                List <PlatMsg> platMsgList = PlatMsgBLL.SingleModel.GetListByIds(msgIds);

                string msgCardIds = string.Join(",", platMsgList?.Select(s => s.MyCardId).Distinct());
                string cardIds    = string.Join(",", listCity_MsgReport.Select(s => s.ReportcardId).Distinct());
                if (!string.IsNullOrEmpty(msgCardIds))
                {
                    if (!string.IsNullOrEmpty(cardIds))
                    {
                        cardIds = cardIds + "," + msgCardIds;
                    }
                    else
                    {
                        cardIds = msgCardIds;
                    }
                }
                List <PlatMyCard> platMyCardList = PlatMyCardBLL.SingleModel.GetListByIds(cardIds);

                listCity_MsgReport.ForEach(x => {
                    //获取举者用户昵称
                    PlatMyCard platMyCard = platMyCardList?.FirstOrDefault(f => f.Id == x.ReportcardId);
                    if (platMyCard != null)
                    {
                        x.ReportUserName = platMyCard.Name;
                    }

                    //获取被举报帖子的信息
                    PlatMsg platMsg = platMsgList?.FirstOrDefault(f => f.Id == x.MsgId);
                    if (platMsg != null)
                    {
                        x.BeReportMsgPhone = platMsg.Phone;
                        PlatMyCard model   = platMyCardList?.FirstOrDefault(f => f.Id == platMsg.MyCardId);

                        if (model != null)
                        {
                            x.BeReportUserName = model.Name;
                        }
                    }
                });
            }

            return(listCity_MsgReport);
        }
Пример #3
0
        /// <summary>
        /// 获取一条帖子的详情
        /// </summary>
        /// <returns></returns>
        public ActionResult GetMsgDetail()
        {
            returnObj = new Return_Msg_APP();
            string appId  = Utility.IO.Context.GetRequest("appId", string.Empty);
            int    msgId  = Utility.IO.Context.GetRequestInt("msgId", 0);  //帖子信息Id
            int    userId = Utility.IO.Context.GetRequestInt("userId", 0); // 类似用户Id

            if (string.IsNullOrEmpty(appId) || msgId <= 0)
            {
                returnObj.code = "200";
                returnObj.Msg  = "参数错误";
                return(Json(returnObj, JsonRequestBehavior.AllowGet));
            }

            XcxAppAccountRelation r = _xcxAppAccountRelationBLL.GetModelByAppid(appId);

            if (r == null)
            {
                returnObj.code = "200";
                returnObj.Msg  = "小程序未授权";
                return(Json(returnObj, JsonRequestBehavior.AllowGet));
            }


            PlatMsg model = PlatMsgBLL.SingleModel.GetMsg(r.Id, msgId);

            if (model == null)
            {
                returnObj.code = "200";
                returnObj.Msg  = "找不到数据";
                return(Json(returnObj, JsonRequestBehavior.AllowGet));
            }



            PlatUserFavoriteMsg _userFavoriteMsg = PlatUserFavoriteMsgBLL.SingleModel.GetUserFavoriteMsg(r.Id, msgId, userId, (int)PointsActionType.收藏);

            model.IsFavorited = (_userFavoriteMsg != null && _userFavoriteMsg.State != -1);

            PlatUserFavoriteMsg _userFavoriteMsgDz = PlatUserFavoriteMsgBLL.SingleModel.GetUserFavoriteMsg(r.Id, msgId, userId, (int)PointsActionType.点赞);

            model.IsDzed = (_userFavoriteMsgDz != null && _userFavoriteMsgDz.State != -1);

            PlatMsgReport _platMsgReport = PlatMsgReportBLL.SingleModel.GetMsgReport(userId, msgId);

            model.IsReported = (_platMsgReport != null);

            returnObj.isok    = true;
            returnObj.Msg     = "获取成功";
            returnObj.dataObj = new { msg = model };
            return(Json(returnObj, JsonRequestBehavior.AllowGet));
        }
Пример #4
0
        /// <summary>
        /// 后台取消置顶的消息
        /// </summary>
        /// <returns></returns>
        public ActionResult DoNotTopMsg()
        {
            result = new PlatReturnMsg();
            int appId = Utility.IO.Context.GetRequestInt("aid", 0);
            int Id    = Utility.IO.Context.GetRequestInt("Id", 0);

            if (appId <= 0 || Id <= 0)
            {
                result.Msg = "参数错误";
                return(Json(result));
            }
            PlatMsg model = PlatMsgBLL.SingleModel.GetModel(Id);

            if (model == null)
            {
                result.Msg = "数据不存在";
                return(Json(result));
            }


            model.TopDay = 0;

            //  model.IsTop = 0;
            model.IsDoNotTop = 1;
            model.UpdateTime = DateTime.Now;
            if (PlatMsgBLL.SingleModel.Update(model, "TopDay,IsTop,IsDoNotTop,UpdateTime"))
            {
                result.isok = true;
                result.Msg  = "操作成功";
                return(Json(result));
            }
            else
            {
                result.Msg = "操作失败";
                return(Json(result));
            }
        }
Пример #5
0
        public ActionResult GetMsgDetail()
        {
            result = new PlatReturnMsg();
            int appId = Utility.IO.Context.GetRequestInt("aid", 0);
            int Id    = Utility.IO.Context.GetRequestInt("Id", 0);

            if (appId <= 0 || Id <= 0)
            {
                result.Msg = "参数错误";
                return(Json(result, JsonRequestBehavior.AllowGet));
            }
            PlatMsg model = PlatMsgBLL.SingleModel.GetModel(Id);

            if (model == null)
            {
                result.Msg = "数据不存在";
                return(Json(result, JsonRequestBehavior.AllowGet));
            }

            result.Msg     = "获取成功";
            result.isok    = true;
            result.dataObj = model;
            return(Json(result, JsonRequestBehavior.AllowGet));
        }
Пример #6
0
        public void AddData(int aid, int myuserid, int othercardid, int actiontype, int datatype, int dataid = 0, string dataimgurl = "", string datacomment = "")
        {
            if (myuserid <= 0 || othercardid <= 0 || aid <= 0)
            {
                return;
            }

            XcxAppAccountRelation xcxrelation = XcxAppAccountRelationBLL.SingleModel.GetModel(aid);

            if (xcxrelation == null)
            {
                return;
            }


            PlatMyCard mycard = PlatMyCardBLL.SingleModel.GetModelByUserId(myuserid, aid);

            if (mycard == null)
            {
                return;
            }

            long   otheruserid = 0;
            string othername   = "";
            string otherimgurl = "";
            string datacontent = "";

            switch (datatype)
            {
            case (int)PointsDataType.片:
                PlatMyCard othercard = PlatMyCardBLL.SingleModel.GetModel(othercardid);
                if (othercard == null)
                {
                    return;
                }
                otheruserid = othercard.UserId;
                othername   = othercard.Name;
                otherimgurl = othercard.ImgUrl;
                break;

            case (int)PointsDataType.帖子:
                PlatMsg platmsg = PlatMsgBLL.SingleModel.GetModel(othercardid);
                if (platmsg == null)
                {
                    return;
                }
                PlatMyCard msgothercard = PlatMyCardBLL.SingleModel.GetModel(platmsg.MyCardId);
                if (msgothercard == null)
                {
                    return;
                }
                datacontent = platmsg.MsgDetail;
                otheruserid = msgothercard.UserId;
                othername   = msgothercard.Name;
                otherimgurl = msgothercard.ImgUrl;
                dataid      = platmsg.Id;
                dataimgurl  = platmsg.ImgList != null && platmsg.ImgList.Count > 0 ? platmsg.ImgList[0] : "";
                break;
            }


            PlatActivityTrajectory model = new PlatActivityTrajectory();

            model.MyUserId    = mycard.UserId;
            model.MyName      = mycard.Name;
            model.MyImgUrl    = mycard.ImgUrl;
            model.OtherUserId = otheruserid;
            model.OtherImgUrl = otherimgurl;
            model.OtherName   = othername;
            model.ActionType  = actiontype;
            model.Datatype    = datatype;
            model.DataId      = dataid;
            model.DataImgUrl  = dataimgurl;
            model.DataContent = datacontent;
            model.AId         = aid;
            model.AppId       = xcxrelation.AppId;
            model.AddTime     = DateTime.Now;
            model.DataComment = datacomment;
            RemoveCache(myuserid);
            base.Add(model);
        }
Пример #7
0
        /// <summary>
        /// 新增评论
        /// </summary>
        /// <returns></returns>
        public ActionResult AddComment()
        {
            returnObj      = new Return_Msg_APP();
            returnObj.code = "200";
            string appId         = Context.GetRequest("appId", string.Empty);
            int    userId        = Context.GetRequestInt("userId", 0);
            int    Id            = Context.GetRequestInt("Id", 0);
            int    dataType      = Context.GetRequestInt("dataType", 0);//默认为0 0:帖子,1:商品,2:评论(PointsDataType)
            string commentDetail = Context.GetRequest("commentDetail", string.Empty);

            if (string.IsNullOrEmpty(appId) || userId <= 0 || Id <= 0)
            {
                returnObj.Msg = "参数错误";
                return(Json(returnObj));
            }

            if (string.IsNullOrEmpty(commentDetail))
            {
                returnObj.Msg = "评论详情不能为空";
                return(Json(returnObj));
            }
            if (commentDetail.Length > 1000)
            {
                returnObj.Msg = "评论详情最大1000字符";
                return(Json(returnObj));
            }

            XcxAppAccountRelation r = _xcxAppAccountRelationBLL.GetModelByAppid(appId);

            if (r == null)
            {
                returnObj.Msg = "小程序未授权";
                return(Json(returnObj));
            }
            PlatMsgComment platMsgComment = new PlatMsgComment();

            platMsgComment.AId           = r.Id;
            platMsgComment.UserId        = userId;
            platMsgComment.CommentDetail = commentDetail;
            platMsgComment.AddTime       = DateTime.Now;
            switch (dataType)
            {
            case (int)PointsDataType.帖子:
                //表示帖子的评论
                PlatMsg platMsg = PlatMsgBLL.SingleModel.GetMsg(r.Id, Id);
                if (platMsg == null || platMsg.State == -1)
                {
                    returnObj.Msg = "帖子不存在!";
                    return(Json(returnObj));
                }
                platMsgComment.ToUserId = platMsg.MyCardId;
                platMsgComment.MsgId    = Id;
                break;
            }

            int commentId = Convert.ToInt32(PlatMsgCommentBLL.SingleModel.Add(platMsgComment));

            if (commentId > 0)
            {
                int commentTotalCount = 0;
                switch (dataType)
                {
                case (int)PointsDataType.帖子:
                    returnObj.dataObj = new { comments = PlatMsgCommentBLL.SingleModel.GetPlatMsgComment(r.Id, out commentTotalCount, 0, string.Empty, 1000, 1, Id, 0) };
                    break;
                }
                ;

                //添加活动轨迹
                PlatActivityTrajectoryBLL.SingleModel.AddData(r.Id, userId, platMsgComment.MsgId, (int)PointsActionType.评论, dataType, commentId, "", platMsgComment.CommentDetail);

                returnObj.isok = true;
                returnObj.Msg  = "评论成功";
                return(Json(returnObj));
            }
            else
            {
                returnObj.Msg = "评论失败";
                return(Json(returnObj));
            }
        }
Пример #8
0
        /// <summary>
        /// 获取对应的配置
        /// </summary>
        /// <param name="aid"></param>
        /// <param name="totalCount"></param>
        /// <param name="configType">配置类别 0 广告图 1推荐商家 2置顶商家</param>
        /// <param name="pageSize"></param>
        /// <param name="pageIndex"></param>
        /// <param name="orderWhere"></param>
        /// <returns></returns>
        public List <PlatConfig> getListByaid(int aid, out int totalCount, int configType = 0, int pageSize = 10, int pageIndex = 1, string orderWhere = "sortNumber desc,addTime desc")
        {
            string strWhere = $"aid={aid} and state<>-1 and configType={configType} ";

            totalCount = base.GetCount(strWhere);
            List <PlatConfig> list = base.GetListByParam(strWhere, null, pageSize, pageIndex, "*", orderWhere);

            list.ForEach(x => {
                switch (configType)
                {
                case 0:
                    //表示广告图跳转到目标为帖子
                    if (x.ADImgType == 1)
                    {
                        PlatMsg platMsg = PlatMsgBLL.SingleModel.GetModel(x.ObjId);
                        if (platMsg != null && platMsg.MsgDetail.Length > 0)
                        {
                            x.ObjName = platMsg.MsgDetail.Substring(0, platMsg.MsgDetail.Length > 20 ? 20 : platMsg.MsgDetail.Length);
                        }
                    }
                    else if (x.ADImgType == 0)
                    {
                        PlatStore platStoreMsg = PlatStoreBLL.SingleModel.GetPlatStore(x.ObjId, x.isStoreID == 0 ? 1 : 0);
                        if (platStoreMsg != null)
                        {
                            x.ObjName = platStoreMsg.Name;
                        }
                    }
                    else if (x.ADImgType == 2)
                    {
                        //跳转小程序appid
                        x.ObjName = x.Name;
                    }
                    else
                    {
                        x.ObjName = "不跳转";
                    }
                    break;

                case 4:
                    break;

                default:
                    //置顶商家跟推荐商家没有上传轮播图 使用店铺轮播图第一张
                    PlatStore platStore = PlatStoreBLL.SingleModel.GetPlatStore(x.ObjId, x.isStoreID == 0 ? 1 : 0);
                    if (platStore != null)
                    {
                        x.storeId = platStore.Id;
                        x.ObjName = platStore.Name;

                        string[] imgs = platStore.Banners.Split(',');
                        if (imgs != null && imgs.Length > 0)
                        {
                            x.ADImg = imgs.FirstOrDefault();
                        }
                    }
                    break;
                }
            });

            return(list);
        }
Пример #9
0
        /// <summary>
        /// 获取帖子评论列表
        /// </summary>
        /// <param name="aid"></param>
        /// <param name="totalCount"></param>
        /// <param name="DataType"></param>
        /// <param name="keyMsg"></param>
        /// <param name="pageSize"></param>
        /// <param name="pageIndex"></param>
        /// <param name="Id">帖子Id 可空 如果大于0则表示是获取某条帖子的</param>
        /// <param name="userId">用户Id 获取用户帖子所属评论</param>
        /// <returns></returns>
        public List <PlatMsgComment> GetPlatMsgComment(int aid, out int totalCount, int DataType = 0, string keyMsg = "", int pageSize = 10, int pageIndex = 1, int Id = 0, int userId = 0)
        {
            string strWhere = $"aid={aid} and State=0 and DataType={DataType}  ";
            List <MySqlParameter> parameters = new List <MySqlParameter>();

            if (userId > 0)
            {
                strWhere += $"  and UserId={userId} ";
            }

            if (Id > 0)
            {
                strWhere += $"  and MsgId={Id}";
            }

            if (!string.IsNullOrEmpty(keyMsg))
            {
                strWhere += $" and CommentDetail like @keyMsg ";
                parameters.Add(new MySqlParameter("keyMsg", $"%{keyMsg}%"));
            }
            //  log4net.LogHelper.WriteInfo(this.GetType(),strWhere);
            totalCount = base.GetCount(strWhere, parameters.ToArray());

            List <PlatMsgComment> listPlatMsgComment = base.GetListByParam(strWhere, parameters.ToArray(), pageSize, pageIndex, "*", " AddTime Desc");

            if (listPlatMsgComment != null && listPlatMsgComment.Count > 0)
            {
                listPlatMsgComment.ForEach(x =>
                {
                    PlatMyCard platMyCard = PlatMyCardBLL.SingleModel.GetModelByUserId(x.UserId, aid);
                    if (platMyCard != null)
                    {
                        x.NickName  = platMyCard.Name;
                        x.HeaderImg = platMyCard.ImgUrl;
                    }
                    else
                    {
                        C_UserInfo c_UserInfoFrom = C_UserInfoBLL.SingleModel.GetModel(x.UserId);
                        if (c_UserInfoFrom != null)
                        {
                            x.NickName  = c_UserInfoFrom.NickName;
                            x.HeaderImg = c_UserInfoFrom.HeadImgUrl;
                        }
                    }

                    PlatMyCard platMyCardTo = PlatMyCardBLL.SingleModel.GetModel(x.ToUserId);
                    if (platMyCardTo != null)
                    {
                        x.ToNickName  = platMyCardTo.Name;
                        x.ToHeaderImg = platMyCardTo.ImgUrl;
                    }
                    else
                    {
                        C_UserInfo c_UserInfo = C_UserInfoBLL.SingleModel.GetModel(x.ToUserId);
                        if (c_UserInfo != null)
                        {
                            x.NickName  = c_UserInfo.NickName;
                            x.HeaderImg = c_UserInfo.HeadImgUrl;
                        }
                    }

                    PlatMsg platMsg = PlatMsgBLL.SingleModel.GetModel(x.MsgId);
                    if (platMsg != null)
                    {
                        x.MsgTxt      = platMsg.MsgDetail.Length > 20 ? platMsg.MsgDetail.Substring(0, 20) + "..." : platMsg.MsgDetail;
                        x.MsgFirstImg = platMsg.Imgs == null ? "" : platMsg.ImgList.FirstOrDefault();
                    }


                    x.ShowTimeStr = CommondHelper.GetTimeSpan(DateTime.Now - x.AddTime);
                });
            }

            return(listPlatMsgComment);
        }