public IActionResult CollectQuestion(string questionGuid) { var collectionBiz = new CollectionBiz(); var result = collectionBiz.CollectTarget(questionGuid, UserID, "question", out var state, Common.EnumDefine.PlatformType.CloudDoctor.ToString()); return(result ? Success($"{state}操作成功!") : Failed(ErrorCode.DataBaseError, $"{state}操作失败!")); }
public IActionResult CollectArticle(string articleGuid, CollectionTypeEnum collectionType = CollectionTypeEnum.Article) { var collectionBiz = new CollectionBiz(); var result = collectionBiz.CollectTarget(articleGuid, UserID, collectionType.ToString().ToLower(), out var state); return(result ? Success($"{state}操作成功!") : Failed(ErrorCode.DataBaseError, $"{state}操作失败!")); }
public IActionResult CancelAttentionToDoctorReduceIntergral(CancelAttentionToDoctorReduceIntergralRequest request) { var collectionBiz = new CollectionBiz(); var collectionModel = collectionBiz.GetTheModelByUserId(UserID, request.DoctorGuid); if (collectionModel != null) { return(Success());//return Failed(ErrorCode.DataBaseError, "该收藏没有取消,取消失败!"); } if (new ScoreExBiz().GetTotalScore(UserID, request.UserType).Result > 10) { if (!InsertIntergral(-10, SendIntergralEnum.取消关注医生减扣积分, request.UserType)) { Logger.Error($"取消关注医生减扣积分失败!{JsonConvert.SerializeObject(request)}"); } } //12小时内不能取消 //TimeSpan interval = DateTime.Now - collectionModel.CreationDate; //var isRegisteRightNow = interval.TotalHours < 12; //if (isRegisteRightNow) //{ // return Failed(ErrorCode.UserData, "收藏12小时内不能取消,请联系管理员!"); //} //collectionModel.Enable = false; //var isSuccess = collectionBiz.UpdateModel(collectionModel); //关注1位医生,获10积分 //取消关注,减扣10积分 return(Success());// : Failed(ErrorCode.DataBaseError, "取消关注医生减扣积分失败!"); }
public async Task <IActionResult> CollectArticleOrQuestionSendIntergral(CollectArticleOrQuestionSendIntergralRequest request) { if (string.IsNullOrWhiteSpace(request.UserID)) { request.UserID = UserID; } var isExist = new CollectionBiz().IsCollectTheTarget(request.UserID, request.TargetGuid); if (!isExist) { return(Failed(ErrorCode.DataBaseError, "该文章或问题还未收藏!")); } var scoreBiz = new ScoreExBiz(); // 收藏1个问题可得3积分,每天9积分为上限 var recordModelList = await scoreBiz.GetToDaysIntergralRecordByCondition(request.UserID, SendIntergralEnum.收藏文章或问题送积分.ToString()); if (recordModelList == null || recordModelList.Count < 3) { if (!InsertIntergral(3, SendIntergralEnum.收藏文章或问题送积分, request.UserType)) { Logger.Error($"收藏文章或问题送积分失败!{JsonConvert.SerializeObject(request)}"); } } //else //{ // //var totalIntergral = recordModelList.Select(a => a.Variation).Sum()>9; // return Failed(ErrorCode.DataBaseError, "今日收藏文章或问题送积分次数已满!"); //} return(Success()); }
public IActionResult GetArticleInfoAsync([FromBody] GetArticleInfoRequestDto request) { var articleBiz = new ArticleBiz(); var contentBiz = new RichtextBiz(); AccessoryBiz accessoryBiz = new AccessoryBiz(); CollectionBiz collection = new CollectionBiz(); var articleModel = articleBiz.GetModel(request.ArticleGuid); if (articleModel == null) { return(Failed(ErrorCode.DataBaseError, "数据错误")); } var richtextModel = contentBiz.GetModel(articleModel.ContentGuid); var accessory = accessoryBiz.GetAccessoryModelByGuid(articleModel.PictureGuid); var likeCount = new LikeBiz().GetLikeNumByTargetGuid(articleModel.ArticleGuid); var pageViewCount = new ArticleViewBiz().CountNumByTargetIDAsync(articleModel.ArticleGuid).Result; int collectionCount = collection.GetListCountByTarget(articleModel.ArticleGuid); return(Success(new GetArticleInfoResponseDto { ArticleTypeDic = articleModel.ArticleTypeDic, Abstract = articleModel.Abstract, Content = richtextModel?.Content, PictureGuid = articleModel.PictureGuid, Title = articleModel.Title, Visible = articleModel.Visible, PictureUrl = $"{accessory?.BasePath}{accessory?.RelativePath}", ArticleGuid = articleModel.ArticleGuid, ActcleReleaseStatus = articleModel.ActcleReleaseStatus.ToString(), CreationDate = articleModel.CreationDate, LikeCount = likeCount, VisitCount = pageViewCount, Collection = collectionCount })); }
public IActionResult CollectProduct(string productGuid) { var collectionBiz = new CollectionBiz(); var productModel = new ProductBiz().GetModelByGuid(productGuid); var result = collectionBiz.CollectTarget(productGuid, UserID, "product", out var state, productModel?.PlatformType); return(result ? Success($"{state}操作成功!") : Failed(ErrorCode.DataBaseError, $"{state}操作失败!")); }
public IActionResult WhetherCollectTarget(string targetGuid) { var collectionBiz = new CollectionBiz(); var model = collectionBiz.GetOneModelByUserId(UserID, targetGuid); if (model != null && model.Enable) { return(Success(true)); } return(Success(false)); }
public IActionResult CollectDoctor(string doctorGuid) { var collectionBiz = new CollectionBiz(); TargetCollectResponseDto result = collectionBiz.CollectTargetResult(doctorGuid, UserID, "doctor"); if (result.result) { new ConsumerActionBiz().CollectDoctorToGetScore(UserID, doctorGuid, result.collectionState, result.first); } return(result.result ? Success($"{result.collectionState.GetDescription()}操作成功!") : Failed(ErrorCode.DataBaseError, $"{result.collectionState.GetDescription()}操作失败!")); }
public IActionResult AttentionToDoctorSendIntergral(AttentionToDoctorSendIntergralRequest request) { var collectionModel = new CollectionBiz().GetTheModelByUserId(UserID, request.DoctorGuid); if (collectionModel == null) { return(Success());//Failed(ErrorCode.DataBaseError, "该医生还未被关注,guid查不到信息!"); } //12小时内 //TimeSpan interval = DateTime.Now - collectionModel.CreationDate; //var isRegisteRightNow = interval.TotalHours < 12; //if (!isRegisteRightNow) //{ // return Failed(ErrorCode.UserData, "收藏时间过久,送积分失败,请联系管理员!"); //} //关注1位医生,获10积分 if (!InsertIntergral(10, SendIntergralEnum.关注医生送积分, request.UserType)) { Logger.Error($"关注医生送积分失败!{JsonConvert.SerializeObject(request)}"); } return(Success()); }