Example #1
0
        public ResponseContext <MyPublishMomentDetailType> MyPublishMomentDetail(Guid momentId, RequestHead head)
        {
            var moment = momentDao.GetMomentByMomentId(momentId);

            if (moment == null)
            {
                return(new ResponseContext <MyPublishMomentDetailType>(ErrCodeEnum.DataIsnotExist));
            }
            bool overCount = ApplyBuilder.IsOverCount(moment);
            var  userInfo  = uerInfoBiz.GetUserInfoByUid(moment.UId);

            return(new ResponseContext <MyPublishMomentDetailType>()
            {
                Data = new MyPublishMomentDetailType()
                {
                    MomentId = momentId,
                    State = moment.State,
                    ShareTitle = MomentContentBuilder.GetShareTitle(moment),
                    Address = moment.Address,
                    Latitude = moment.Latitude,
                    Longitude = moment.Longitude,
                    IsOffLine = moment.IsOffLine,
                    IsOverTime = MomentContentBuilder.IsOverTime(moment.StopTime),
                    ShareFlag = moment.State == MomentStateEnum.正常发布中,
                    VerifyStateDesc = MomentContentBuilder.VerifyStateMap(moment.State),
                    StateDesc = MomentContentBuilder.MomentStateMap(moment.State, moment.StopTime, overCount),
                    TextColor = MomentContentBuilder.TextColorMap(moment.State, moment.StopTime, overCount),
                    UserInfo = UserInfoBuilder.BuildUserInfo(userInfo, head),
                    ContentList = MomentContentBuilder.BuilderContent(moment, false),
                    ApplyList = ApplyBuilder.GetApplyList(momentId, false, head, moment.UId),
                    CheckList = ApplyBuilder.GetCheckDetails(moment, userInfo, head)
                }
            });
        }
Example #2
0
        public ResponseContext <MomentCheckDetailType> MomentCheckDetail(RequestContext <MomentCheckDetailRequest> request)
        {
            var moment = momentDao.GetMomentByMomentId(request.Data.MomentId);

            if (moment == null)
            {
                return(new ResponseContext <MomentCheckDetailType>(ErrCodeEnum.DataIsnotExist));
            }
            bool overCount = ApplyBuilder.IsOverCount(moment);
            var  userInfo  = uerInfoBiz.GetUserInfoByUid(moment.UId);

            return(new ResponseContext <MomentCheckDetailType>()
            {
                Data = new MomentCheckDetailType()
                {
                    MomentId = moment.MomentId,
                    State = moment.State,
                    Address = moment.Address,
                    IsOffLine = moment.IsOffLine,
                    ShareTitle = MomentContentBuilder.GetShareTitle(moment),
                    StateDesc = MomentContentBuilder.MomentStateMap(moment.State, moment.StopTime, overCount),
                    TextColor = MomentContentBuilder.TextColorMap(moment.State, moment.StopTime, overCount),
                    UserInfo = UserInfoBuilder.BuildUserInfo(userInfo, request.Head),
                    ContentList = MomentContentBuilder.BuilderContent(moment, false),
                    ApplyList = ApplyBuilder.GetCheckDetails(moment, userInfo, request.Head)
                }
            });
        }
Example #3
0
        public ResponseContext <ShareDetailResponse> ShareDetail(Guid momentId, RequestHead head)
        {
            var moment = momentDao.GetMomentByMomentId(momentId);

            if (moment == null)
            {
                return(new ResponseContext <ShareDetailResponse>(ErrCodeEnum.DataIsnotExist));
            }
            var userInfo = uerInfoBiz.GetUserInfoByUid(moment.UId);

            if (userInfo == null)
            {
                return(new ResponseContext <ShareDetailResponse>(ErrCodeEnum.DataIsnotExist));
            }
            var    applyInfo = applyInfoDao.GetByMomentIdAndUId(momentId, head.UId);
            bool   isApply   = applyInfo != null;
            bool   selfFlag  = moment.UId == head.UId;
            bool   overCount = ApplyBuilder.IsOverCount(moment);
            string btnText   = MomentContentBuilder.BtnTextMap(moment.State, moment.StopTime, isApply, selfFlag, overCount);
            string stateDesc = MomentContentBuilder.MomentStateMap(moment.State, moment.StopTime, overCount);

            return(new ResponseContext <ShareDetailResponse>()
            {
                Data = new ShareDetailResponse()
                {
                    MomentId = momentId,
                    ApplyId = isApply ? applyInfo.ApplyId : Guid.Empty,
                    ApplyFlag = isApply,
                    BtnText = btnText,
                    StateDesc = stateDesc,
                    ShareTitle = MomentContentBuilder.GetShareTitle(moment),
                    Address = moment.Address,
                    Latitude = moment.Latitude,
                    Longitude = moment.Longitude,
                    IsOffLine = moment.IsOffLine,
                    AskFlag = string.Equals(btnText, "申请参与"),
                    BtnVisable = !string.IsNullOrEmpty(btnText),
                    TextColor = MomentContentBuilder.TextColorMap(moment.State, moment.StopTime, overCount),
                    UserInfo = UserInfoBuilder.BuildUserInfo(userInfo, head),
                    ContentList = MomentContentBuilder.BuilderContent(moment, true),
                    ApplyList = ApplyBuilder.GetApplyList(momentId, true, head, moment.UId)
                }
            });
        }
Example #4
0
        public ResponseContext <SpaceMomentListResponse> SpaceMomentList(RequestContext <SpaceMomentListRequest> request)
        {
            var response = new ResponseContext <SpaceMomentListResponse>()
            {
                Data = new SpaceMomentListResponse()
                {
                    MomentList = new List <SpaceMomentDetailType>()
                }
            };
            var userInfo   = uerInfoBiz.GetUserInfoByUid(request.Data.UId);
            var momentList = momentDao.GetMomentListByUid(request.Data.UId);

            if (momentList.IsNullOrEmpty())
            {
                return(response);
            }

            foreach (var moment in momentList.Where(a => a.State == MomentStateEnum.正常发布中))
            {
                bool overCount = ApplyBuilder.IsOverCount(moment);
                var  applyList = applyInfoDao.GetListByMomentId(moment.MomentId);
                var  dto       = new SpaceMomentDetailType()
                {
                    MomentId        = moment.MomentId,
                    ShareTitle      = MomentContentBuilder.GetShareTitle(moment),
                    Address         = moment.Address,
                    Latitude        = moment.Latitude,
                    Longitude       = moment.Longitude,
                    IsOffLine       = moment.IsOffLine,
                    ApplyCountColor = "black",
                    ApplyCountDesc  = ApplyBuilder.GetApplyCountDescV1(applyList),
                    StateDesc       = MomentContentBuilder.MomentStateMap(moment.State, moment.StopTime, overCount),
                    TextColor       = MomentContentBuilder.TextColorMap(moment.State, moment.StopTime, overCount),
                    UserInfo        = UserInfoBuilder.BuildUserInfo(userInfo, request.Head),
                    ContentList     = MomentContentBuilder.BuilderContent(moment, false)
                };

                response.Data.MomentList.Add(dto);
            }

            return(response);
        }
Example #5
0
        public ResponseContext <MyPublishListResponse> MyPublishList(RequestContext <MyPublishListRequest> request)
        {
            var response = new ResponseContext <MyPublishListResponse>()
            {
                Data = new MyPublishListResponse()
                {
                    MomentList = new List <MyPublishMomentDetailType>()
                }
            };
            var userInfo   = uerInfoBiz.GetUserInfoByUid(request.Head.UId);
            var momentList = momentDao.GetMomentListByUid(request.Head.UId);

            if (momentList.IsNullOrEmpty())
            {
                return(response);
            }
            //有用户申请的动态
            var applyMomentList = new List <MyPublishMomentDetailType>();
            //正常动态
            var commomMomentList = new List <MyPublishMomentDetailType>();

            foreach (var moment in momentList)
            {
                bool overCount = ApplyBuilder.IsOverCount(moment);
                var  applyList = applyInfoDao.GetListByMomentId(moment.MomentId);
                var  dto       = new MyPublishMomentDetailType()
                {
                    MomentId        = moment.MomentId,
                    State           = moment.State,
                    ShareTitle      = MomentContentBuilder.GetShareTitle(moment),
                    Address         = moment.Address,
                    Latitude        = moment.Latitude,
                    Longitude       = moment.Longitude,
                    IsOffLine       = moment.IsOffLine,
                    ApplyCountDesc  = ApplyBuilder.GetApplyCountDesc(applyList),
                    ApplyCountColor = "black",
                    UnReadCount     = ApplyBuilder.GetUnReadCount(applyList),
                    IsOverTime      = MomentContentBuilder.IsOverTime(moment.StopTime),
                    ShareFlag       = moment.State == MomentStateEnum.正常发布中,
                    StateDesc       = MomentContentBuilder.MomentStateMap(moment.State, moment.StopTime, overCount),
                    TextColor       = MomentContentBuilder.TextColorMap(moment.State, moment.StopTime, overCount),
                    UserInfo        = UserInfoBuilder.BuildUserInfo(userInfo, request.Head),
                    ContentList     = MomentContentBuilder.BuilderContent(moment, false)
                };
                if (applyList.NotEmpty() && applyList.Count(a => a.ApplyState == ApplyStateEnum.申请中) > 0)
                {
                    applyMomentList.Add(dto);
                }
                else
                {
                    commomMomentList.Add(dto);
                }
            }
            //有用户申请的保证置顶
            if (applyMomentList.NotEmpty())
            {
                response.Data.MomentList.AddRange(applyMomentList);
            }
            if (commomMomentList.NotEmpty())
            {
                response.Data.MomentList.AddRange(commomMomentList);
            }
            return(response);
        }