public IActionResult BuyBooks([FromServices] IArticleTopicService articleTopicService, [FromServices] IMemberScoreService memberScoreService, string id) { if (CoreContextProvider.CurrentMember == null) { return(Error("购买失败,请先登录!")); } var article = _ArticleService.GetForm(id); if (article == null) { return(Error("该文库不存在,购买失败!")); } if (article.BookStatus != (int)BookStatus.审核通过) { return(Error("该文库未审核成功,购买失败!")); } //如果选择专题,无分类,则无法下载 if (!article.SpecialTopicId.IsEmpty() && article.CategoryId.IsEmpty()) { //var topicServie = CoreContextProvider.GetService<IArticleTopicService>(); var topicName = articleTopicService.GetCate(article.SpecialTopicId)?.Text; if (!topicName.IsEmpty()) { return(Error($"该文库已绑定资源专题,无法单独购买,请到专题【{topicName}】购买!")); } } var buyResult = memberScoreService.MarketBuy(CoreContextProvider.CurrentMember.UserId, ScoreType.buybook, article.Id, article.RequireAmount, article.CreatorUserId); return(JsonResult(buyResult)); }
public IActionResult Down([FromServices] IArticleTopicService articleTopicService, string aid) { AddPageCrumbs("资源下载"); var articlePage = new ArticleDetailView(); var articleDetail = _ArticleService.GetForm(aid); if (articleDetail == null) { return(ErrorPage("该文库资源不存在")); } if (!articleDetail.AllowDownload) { return(ErrorPage("该文库资源设置为不允许下载")); } if (!articleDetail.SpecialTopicId.IsEmpty() && articleDetail.CategoryId.IsEmpty()) { //var topicServie = CoreContextProvider.GetService<IArticleTopicService>(); var topicName = articleTopicService.GetCate(articleDetail.SpecialTopicId)?.Text; if (!topicName.IsEmpty()) { return(ErrorPage($"该文库已绑定资源专题,无法单独下载,请到专题【{topicName}】购买并下载!")); } } articlePage = AutoMapper.Mapper.Map <ArticleDetailView>(articleDetail); articlePage.Member = "admin"; if (articleDetail.Member != null) { articlePage.Member = (articleDetail.Member.NickName ?? articleDetail.Member.RealName) ?? articleDetail.Member.UserName; } return(View(articlePage)); }
public IActionResult Index([FromServices] IArticleTopicService topicService, [FromServices] IArticleCategoryService articleCategoryService) { AddPageCrumbs("资源分类"); var cateList = articleCategoryService.GetCateList(null, null, true); //var topicService = SkyCore.GlobalProvider.CoreContextProvider.GetService<IArticleTopicService>(); ViewBag.TopicCates = topicService.GetTopicCateList(null, null); ViewBag.HotTopics = topicService.GetTopicInfoList(new ArticleTopicSearchView { HotTopic = true, TopicStatus = TopicStatus.Audited, IgnoreCate = true }, 1, 3); return(View(cateList)); }
//首页 public IActionResult Index([FromServices] IArticleTopicService articleTopicService, [FromServices] IHelpService helpService, [FromServices] INewsService newsService , [FromServices] ILinkService linkService, [FromServices] IArticleCategoryService articleCategoryService) { ViewBag.TodayArticles = _ArticleService.GetTopArticles(ArticleTopEnum.HotArticle, 10); ViewBag.NewArticles = _ArticleService.GetTopArticles(ArticleTopEnum.NewArticle, 10); ViewBag.HotTopics = articleTopicService.GetHotTopics(8); ViewBag.BestCates = articleCategoryService.GetCateList(new ArticleCateSearchView { IsRemmand = true }, 1, 6); var tradeScores = _IMemberScoreService.GetList(true, 5); ViewBag.TradeScores = tradeScores; //PPT ViewBag.HotPPT = _ArticleService.GetTopArticles(ArticleTopEnum.HotPPT, 18, null); ViewBag.NewPPT = _ArticleService.GetTopArticles(ArticleTopEnum.NewPPT, 18, null); //轮播图 ViewBag.HomeCarousels = helpService.GetHelps(new HelpSearchView() { HelpCode = HelpCode.HomeCarousel }, 1, 10).ToList(); //公告 ViewBag.Announcements = newsService .GetTopNewss(NewsTopEnum.Announcement, 5).ToList(); //资源总数量 var totalData = _ArticleService.GetTotalBooks(); ViewBag.TotalBooks = totalData; //友情链接 ViewBag.FriendLinks = linkService.GetList(); return(View()); }
public TopicsController(IArticleTopicService articleCateService, IArticleService articleService) { _ArticleTopicService = articleCateService; _ArticleService = articleService; }
public ArticleTopicController(IArticleTopicService ArticleTopicService, IMemberService memberService) { _ArticleTopicService = ArticleTopicService; _IMemberService = memberService; }
public ActionResult GetArticleTopics([FromServices] IArticleTopicService articleTopicService, string currentId, string parentId) { //var articleTopicService = CoreContextProvider.GetService<IArticleTopicService>(); return(Content(articleTopicService.GetTopicCateList(currentId, parentId).ToJson())); }