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) } }); }
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); }
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); }
public Response Ask(RequestContext <AskActivityRequest> request) { MomentEntity moment = momentDao.GetMomentByMomentId(request.Data.MomentId); if (moment == null) { return(new Response(ErrCodeEnum.DataIsnotExist, "活动不存在")); } var appLyList = applyInfoDao.GetListByMomentId(request.Data.MomentId); if (appLyList.NotEmpty()) { var myApply = appLyList.FirstOrDefault(a => a.UId == request.Head.UId); if (myApply != null) { return(new Response(ErrCodeEnum.Failure, "你已申请过,不能重复申请")); } var usableList = appLyList.Where(a => a.ApplyState == ApplyStateEnum.申请通过).ToList(); if (usableList.NotEmpty() && usableList.Count >= moment.NeedCount) { return(new Response(ErrCodeEnum.Failure, "人数已满,无法申请")); } } if (moment.IsDelete || moment.State != MomentStateEnum.正常发布中 || MomentContentBuilder.IsOverTime(moment.StopTime)) { return(new Response(ErrCodeEnum.IsOverTime, "活动已失效")); } var dto = new ApplyInfoEntity() { ApplyId = Guid.NewGuid(), MomentId = moment.MomentId, MomentUId = moment.UId, ApplyState = ApplyStateEnum.申请中, Source = request.Data.Source, UId = request.Head.UId, CreateTime = DateTime.Now, UpdateTime = DateTime.Now }; applyInfoDao.Insert(dto); string remark = "申请加入该活动"; if (!string.IsNullOrEmpty(request.Data.Remark)) { remark = request.Data.Remark; } InsertDetail(moment.MomentId, dto.ApplyId, request.Head.UId, remark); var momentUser = uerInfoBiz.GetUserInfoByUid(moment.UId); if (momentUser != null) { //发送通知 AppFactory.Factory(momentUser.Platform).Send_Moment_Join_MsgAsync(moment, request.Head.UId, momentUser.OpenId); } return(new Response(ErrCodeEnum.Success, "申请提交成功")); }