示例#1
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)
                }
            });
        }
示例#2
0
        public ResponseContext <UserInfoType> GetUserInfo(RequestHead head, long uId)
        {
            long userId;

            if (uId <= 0)
            {
                userId = head.UId;
            }
            else
            {
                userId = uId;
            }
            var response = new ResponseContext <UserInfoType>();
            var userInfo = GetUserInfoByUid(userId);

            if (userInfo == null)
            {
                response.ResultCode    = ErrCodeEnum.UserNoExist;
                response.ResultMessage = ErrCodeEnum.UserNoExist.ToDescription();
                return(response);
            }
            if (uId <= 0)
            {
                response.Data          = UserInfoBuilder.BuildUserInfoV1(userInfo, head);
                response.Data.NickName = userInfo.NickName;
            }
            else
            {
                response.Data = UserInfoBuilder.BuildUserInfo(userInfo, head, 10);
            }
            return(response);
        }
示例#3
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)
                }
            });
        }
示例#4
0
        public ResponseContext <AskMomentDetailResponse> AskMomentDetail(Guid applyId, RequestHead head)
        {
            var response  = new ResponseContext <AskMomentDetailResponse>();
            var applyInfo = applyInfoDao.GetByApplyId(applyId);

            if (applyInfo == null)
            {
                return(response);
            }
            var myUserInfo = uerInfoBiz.GetUserInfoByUid(applyInfo.MomentUId);
            var userInfo   = uerInfoBiz.GetUserInfoByUid(applyInfo.UId);
            var moment     = MomentBuilder.GetMoment(applyInfo.MomentId);

            if (myUserInfo == null || userInfo == null || moment == null)
            {
                return(response);
            }
            response.Data = new AskMomentDetailResponse()
            {
                ApplyState     = applyInfo.ApplyState,
                ApplyStateDesc = ApplyStateMap(applyInfo.ApplyState),
                IsOverTime     = MomentContentBuilder.IsOverTime(moment.StopTime),
                MomentId       = moment.MomentId,
                ShareTitle     = MomentContentBuilder.GetShareTitle(moment),
                Address        = moment.Address,
                Latitude       = moment.Latitude,
                Longitude      = moment.Longitude,
                IsOffLine      = moment.IsOffLine,
                TextColor      = ApplyBuilder.TextColorMap(applyInfo.ApplyState),
                UserInfo       = UserInfoBuilder.BuildUserInfo(userInfo, head),
                BtnVisable     = applyInfo.ApplyState == ApplyStateEnum.申请中,
                ApplyList      = ApplyBuilder.GetApplyDetails(applyInfo.ApplyId, head, true)
            };
            return(response);
        }
示例#5
0
        public ResponseContext <ApplyMomentListResponse> ApplyMomentList(RequestHead head)
        {
            var response = new ResponseContext <ApplyMomentListResponse>
            {
                Data = new ApplyMomentListResponse()
                {
                    MomentList = new List <ApplyMomentDetailType>()
                }
            };
            var applyList = applyInfoDao.GetListByUId(head.UId);

            if (applyList.IsNullOrEmpty())
            {
                return(response);
            }
            foreach (var apply in applyList)
            {
                var momentUserInfo = uerInfoBiz.GetUserInfoByUid(apply.MomentUId);
                var moment         = MomentBuilder.GetMoment(apply.MomentId);
                if (moment == null || momentUserInfo == null)
                {
                    continue;
                }

                var result = new ApplyMomentDetailType()
                {
                    ApplyId        = apply.ApplyId,
                    ApplyStateDesc = ApplyStateMap(apply.ApplyState),
                    TextColor      = ApplyBuilder.TextColorMap(apply.ApplyState),
                    ShareTitle     = MomentContentBuilder.GetShareTitle(moment),
                    MomentId       = moment.MomentId,
                    Address        = moment.Address,
                    Latitude       = moment.Latitude,
                    Longitude      = moment.Longitude,
                    IsOffLine      = moment.IsOffLine,
                    UserInfo       = UserInfoBuilder.BuildUserInfo(momentUserInfo, head),
                    ContentList    = MomentContentBuilder.BuilderContent2Contact(moment, momentUserInfo, apply.ApplyState == ApplyStateEnum.申请通过)
                };
                var applyDetaiList = applyDetailDao.GetListByApplyId(apply.ApplyId);
                if (applyDetaiList.NotEmpty())
                {
                    //最后一个对话信息
                    var applyDetail = applyDetaiList.OrderByDescending(a => a.CreateTime).First();
                    result.ApplyRemark = applyDetail.Content;
                }
                response.Data.MomentList.Add(result);
            }
            return(response);
        }
示例#6
0
 public ResponseContext <MomentListResponse> MomentList(RequestContext <MomentListRequest> request)
 {
     try
     {
         var response = new ResponseContext <MomentListResponse>
         {
             Data = new MomentListResponse()
             {
                 MomentList = new List <MomentDetailType>()
             }
         };
         List <MomentEntity> moments = momentDao.GetMomentListByParam(request.Data.OffLine, request.Data.PageIndex, request.Data.Gender, request.Data.SchoolState, GetAgeLimitList(request.Data.Age), request.Head.Latitude, request.Head.Longitude);
         if (moments.IsNullOrEmpty())
         {
             return(response);
         }
         foreach (var moment in moments)
         {
             var userInfo = uerInfoBiz.GetUserInfoByUid(moment.UId);
             if (userInfo == null)
             {
                 continue;
             }
             var dto = new MomentDetailType()
             {
                 MomentId    = moment.MomentId,
                 ShareTitle  = MomentContentBuilder.GetShareTitle(moment),
                 Address     = moment.Address,
                 Latitude    = moment.Latitude,
                 Longitude   = moment.Longitude,
                 IsOffLine   = moment.IsOffLine,
                 UserInfo    = UserInfoBuilder.BuildUserInfo(userInfo, request.Head),
                 ContentList = MomentContentBuilder.BuilderContent(moment, true)
             };
             response.Data.MomentList.Add(dto);
         }
         return(response);
     }
     catch (Exception ex)
     {
         log.ErrorAsync("MomentListBiz.MomentList", ex);
         return(null);
     }
 }
示例#7
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)
                }
            });
        }
示例#8
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);
        }
示例#9
0
        public ResponseContext <MomentCheckDetailResponse> MomentCheckList(RequestContext <MomentCheckList> request)
        {
            var response = new ResponseContext <MomentCheckDetailResponse>()
            {
                Data = new MomentCheckDetailResponse()
                {
                    MomentList = new List <MomentCheckDetailType>()
                }
            };
            var momentList = momentDao.GetMomentListByState(request.Data.State);

            if (momentList.IsNullOrEmpty())
            {
                return(response);
            }
            foreach (var moment in momentList)
            {
                var userInfo = uerInfoBiz.GetUserInfoByUid(moment.UId);
                if (userInfo == null)
                {
                    continue;
                }
                var applyList = applyDetailDao.GetListByMomentId(moment.MomentId);
                var dto       = new MomentCheckDetailType()
                {
                    MomentId       = moment.MomentId,
                    State          = moment.State,
                    ShareTitle     = MomentContentBuilder.GetShareTitle(moment),
                    Address        = moment.Address,
                    IsOffLine      = moment.IsOffLine,
                    Latitude       = moment.Latitude,
                    Longitude      = moment.Longitude,
                    ApplyCountDesc = ApplyBuilder.GetServiceCountDesc(applyList, moment.UId),
                    StateDesc      = moment.State == MomentStateEnum.审核中?"待审核":"已审核通过",
                    TextColor      = MomentContentBuilder.TextColorMap(moment.State, moment.StopTime, false),
                    UserInfo       = UserInfoBuilder.BuildUserInfo(userInfo, request.Head),
                    ContentList    = MomentContentBuilder.BuilderContent(moment, false)
                };
                response.Data.MomentList.Add(dto);
            }
            return(response);
        }
示例#10
0
        public ResponseContext <ApplyMomentDetailResponse> ApplyMomentDetail(Guid applyId, RequestHead head)
        {
            var response  = new ResponseContext <ApplyMomentDetailResponse>();
            var applyInfo = applyInfoDao.GetByApplyId(applyId);

            if (applyInfo == null)
            {
                return(response);
            }
            var userInfo = uerInfoBiz.GetUserInfoByUid(applyInfo.MomentUId);
            var moment   = MomentBuilder.GetMoment(applyInfo.MomentId);

            if (userInfo == null || moment == null)
            {
                return(response);
            }
            string btnText = ApplyBuilder.BtnTextMap(applyInfo.ApplyState);

            response.Data = new ApplyMomentDetailResponse()
            {
                ApplyState     = applyInfo.ApplyState,
                ApplyStateDesc = ApplyStateMap(applyInfo.ApplyState),
                MomentId       = moment.MomentId,
                ShareTitle     = MomentContentBuilder.GetShareTitle(moment),
                BtnText        = btnText,
                Address        = moment.Address,
                Latitude       = moment.Latitude,
                Longitude      = moment.Longitude,
                IsOffLine      = moment.IsOffLine,
                NextAction     = ApplyBuilder.BtnActionMap(applyInfo.ApplyState),
                BtnVisable     = !string.IsNullOrEmpty(btnText),
                TextColor      = ApplyBuilder.TextColorMap(applyInfo.ApplyState),
                UserInfo       = UserInfoBuilder.BuildUserInfo(userInfo, head),
                ContentList    = MomentContentBuilder.BuilderContent2Contact(moment, userInfo, applyInfo.ApplyState == ApplyStateEnum.申请通过),
                ApplyList      = ApplyBuilder.GetApplyDetails(applyInfo.ApplyId, head, false)
            };
            return(response);
        }
示例#11
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);
        }