diff --git a/CMS/JXCMS.CMS.Movie/Admin/Controllers/ArticleController.cs b/CMS/JXCMS.CMS.Movie/Admin/Controllers/ArticleController.cs deleted file mode 100755 index d188ca9..0000000 --- a/CMS/JXCMS.CMS.Movie/Admin/Controllers/ArticleController.cs +++ /dev/null @@ -1,18 +0,0 @@ -using JXCMS.CMS.Attribute; -using Microsoft.AspNetCore.Mvc; - -namespace JXCMS.CMS.Admin.Controllers -{ - [Area("Admin")] - [AdminAuthentication] - public class ArticleController : Controller - { - // GET - public IActionResult Index() - { - ViewBag.title = "所有文章"; - - return View(); - } - } -} \ No newline at end of file diff --git a/CMS/JXCMS.CMS.Movie/Admin/Controllers/ClassifyController.cs b/CMS/JXCMS.CMS.Movie/Admin/Controllers/ClassifyController.cs new file mode 100644 index 0000000..21aec2b --- /dev/null +++ b/CMS/JXCMS.CMS.Movie/Admin/Controllers/ClassifyController.cs @@ -0,0 +1,73 @@ +using System.Linq; +using FreeSql; +using JXCMS.CMS.Attribute; +using JXCMS.CMS.Entity; +using JXCMS.CMS.Movie.Entity; +using JXCMS.CMS.Movie.Spider; +using JXCMS.CMS.Movie.Utils; +using Microsoft.AspNetCore.Mvc; + +namespace JXCMS.CMS.Movie.Admin.Controllers +{ + [Area("Admin")] + [AdminAuthentication] + public class ClassifyController : Controller + { + public IActionResult Index(int pageNumber = 1, int pageSize = 20) + { + var list = ClassifyEntity.Select.Include(x => x.Parent).Count(out long count).Page(pageNumber, pageSize).ToList( + x => new ClassifyEntity{Id = x.Id, Name = x.Name, Alias = x.Alias, ParentId = x.ParentId, Parent = x.Parent, UpdateTime = x.UpdateTime, + Count = MovieEntity.Select.Where(y => y.ClassifyId == x.Id).Count()}); + ViewBag.count = count; + ViewBag.pageNumber = pageNumber; + ViewBag.totlePage = count % pageSize == 0 ? count / pageSize : count / pageSize + 1; + return View(list); + } + + public IActionResult ClassifyDialog(int id) + { + + ClassifyEntity classifyEntity = null; + if (id == 0) + { + classifyEntity = new ClassifyEntity(); + ViewBag.title = "添加新分类"; + ViewBag.classifyEntities = ClassifyEntity.Select.ToList(); + } + else + { + classifyEntity = ClassifyEntity.Find(id); + ViewBag.title = "修改分类" + classifyEntity.Name; + ViewBag.classifyEntities = Classify.FindAllNotChildren(ClassifyEntity.Select.ToList(), id); + } + return View(classifyEntity); + } + + public IActionResult DeleteClassify(int id) + { + if (MovieEntity.Select.Any(x => x.ClassifyId == id)) + { + return Redirect(Url.Action("Index")); + } + + if (ClassifyEntity.Select.Any(x => x.ParentId == id)) + { + ClassifyEntity.Where(x => x.ParentId == id).ToUpdate().Set(x => x.ParentId, 0).ExecuteAffrows(); + } + + ClassifyEntity.Find(id).Delete(); + return Redirect(Url.Action("Index")); + } + + public IActionResult ModifyClassify(ClassifyEntity classifyEntity) + { + if (classifyEntity.Id != 0 && + Classify.FindAllChildren(ClassifyEntity.Select.ToList(), classifyEntity.Id).Any(x => x.Id == classifyEntity.ParentId)) + { + return Redirect(Url.Action("Index")); + } + classifyEntity.Save(); + return Redirect(Url.Action("Index")); + } + } +} \ No newline at end of file diff --git a/CMS/JXCMS.CMS.Movie/Admin/Controllers/CollectionController.cs b/CMS/JXCMS.CMS.Movie/Admin/Controllers/CollectionController.cs index 4a63e4f..867208a 100644 --- a/CMS/JXCMS.CMS.Movie/Admin/Controllers/CollectionController.cs +++ b/CMS/JXCMS.CMS.Movie/Admin/Controllers/CollectionController.cs @@ -1,8 +1,12 @@ +using System; using System.Collections.ObjectModel; using System.Linq; +using FreeSql; using JXCMS.CMS.Attribute; using JXCMS.CMS.Movie.Entity; using JXCMS.CMS.Movie.Jobs; +using JXCMS.CMS.Movie.Spider; +using JXCMS.CMS.Movie.Utils; using JXCMS.Core.TimingTask; using Microsoft.AspNetCore.Mvc; using Quartz; @@ -16,7 +20,11 @@ namespace JXCMS.CMS.Movie.Admin.Controllers public IActionResult Index(int pageNumber = 1, int pageSize = 20) { ViewBag.title = "采集地址"; - var website = WebSiteEntity.Select.Count(out long count).Page(pageNumber, pageSize).ToList(); + var website = WebSiteEntity.Select.Count(out long count).Page(pageNumber, pageSize).ToList().Select(x => + { + x.NextRunTime = x.IsEnable ? QuartzTask.GetCronSchedule(x.Cron, 1, DateTimeOffset.Now) : "已禁用"; + return x; + }).ToList(); ViewBag.website = website; ViewBag.count = count; ViewBag.pageNumber = pageNumber; @@ -27,6 +35,10 @@ namespace JXCMS.CMS.Movie.Admin.Controllers [HttpPost] public IActionResult AddWebSite(WebSiteEntity webSiteEntity) { + if (!CronExpression.IsValidExpression(webSiteEntity.Cron)) + { + return Redirect(Url.Action("Index")); + } webSiteEntity.Save(); if (webSiteEntity.IsEnable) { @@ -87,7 +99,26 @@ namespace JXCMS.CMS.Movie.Admin.Controllers } return View(webSiteEntity); } - - + + public IActionResult BindingClassifyDialog(int id) + { + var classifyEntities = Classify.Structured(ClassifyEntity.Select.ToList()); + var webSiteClassifyEntities = WebSiteClassifyEntity.Where(x => x.WebSiteId == id).ToList(); + var webSiteEntity = WebSiteEntity.Find(id); + classifyEntities.Insert(0, new ClassifyEntity(){Id = 0, Name = "未绑定"}); + ViewBag.classifyEntities = classifyEntities; + ClassifySpider.GetAllClassifyFromUrl(id, webSiteEntity.ApiUrl, webSiteClassifyEntities); + ViewBag.title = "修改" + webSiteEntity.WebSiteName + "的类型绑定"; + return View(webSiteClassifyEntities); + } + + public IActionResult UpdateBindingClassify(WebSiteClassifyEntity[] webSiteClassifyEntities) + { + foreach (var webSiteClassifyEntity in webSiteClassifyEntities) + { + webSiteClassifyEntity.Save(); + } + return Redirect(Url.Action("Index")); + } } } \ No newline at end of file diff --git a/CMS/JXCMS.CMS.Movie/Admin/Controllers/HomeController.cs b/CMS/JXCMS.CMS.Movie/Admin/Controllers/HomeController.cs index 0232324..d397fb1 100755 --- a/CMS/JXCMS.CMS.Movie/Admin/Controllers/HomeController.cs +++ b/CMS/JXCMS.CMS.Movie/Admin/Controllers/HomeController.cs @@ -1,17 +1,15 @@ using System.Security.Claims; using System.Threading.Tasks; using JXCMS.CMS.Attribute; -using JXCMS.CMS.Entity; using JXCMS.CMS.Movie.Entity; using JXCMS.CMS.Utils; using JXCMS.Core.Auth; using JXCMS.Core.Encrypt; -using Microsoft.AspNetCore.Authentication; using Microsoft.AspNetCore.Authentication.Cookies; using Microsoft.AspNetCore.Authorization; using Microsoft.AspNetCore.Mvc; -namespace JXCMS.CMS.Admin.Controllers +namespace JXCMS.CMS.Movie.Admin.Controllers { [Area("Admin")] [AdminAuthentication] diff --git a/CMS/JXCMS.CMS.Movie/Admin/Controllers/InstallController.cs b/CMS/JXCMS.CMS.Movie/Admin/Controllers/InstallController.cs index 433cfbe..7c2dc1a 100755 --- a/CMS/JXCMS.CMS.Movie/Admin/Controllers/InstallController.cs +++ b/CMS/JXCMS.CMS.Movie/Admin/Controllers/InstallController.cs @@ -73,6 +73,180 @@ namespace JXCMS.CMS.Admin.Controllers Type = "Settings" }); BaseEntity.Orm.Insert(settings).ExecuteInserted(); + var classify = new ClassifyEntity() + { + Name = "电影", + Alias = "dianying", + ParentId = 0 + }; + classify.Save(); + List classifyEntities = new List(); + classifyEntities.Add(new ClassifyEntity() + { + Name = "动作片", + Alias = "dongzuo", + ParentId = classify.Id + }); + classifyEntities.Add(new ClassifyEntity() + { + Name = "喜剧片", + Alias = "xiju", + ParentId = classify.Id + }); + classifyEntities.Add(new ClassifyEntity() + { + Name = "爱情片", + Alias = "aiqing", + ParentId = classify.Id + }); + classifyEntities.Add(new ClassifyEntity() + { + Name = "科幻片", + Alias = "kehuan", + ParentId = classify.Id + }); + classifyEntities.Add(new ClassifyEntity() + { + Name = "恐怖片", + Alias = "kongbu", + ParentId = classify.Id + }); + classifyEntities.Add(new ClassifyEntity() + { + Name = "剧情片", + Alias = "juqing", + ParentId = classify.Id + }); + classifyEntities.Add(new ClassifyEntity() + { + Name = "战争片", + Alias = "zhanzheng", + ParentId = classify.Id + }); + classifyEntities.Add(new ClassifyEntity() + { + Name = "纪录片", + Alias = "jilupian", + ParentId = classify.Id + }); + classifyEntities.Add(new ClassifyEntity() + { + Name = "微电影", + Alias = "weidianying", + ParentId = classify.Id + }); + classifyEntities.Add(new ClassifyEntity() + { + Name = "伦理片", + Alias = "lunli", + ParentId = classify.Id + }); + BaseEntity.Orm.Insert(classifyEntities).ExecuteAffrows(); + classify = new ClassifyEntity() + { + Name = "电视剧", + Alias = "tv", + ParentId = 0 + }; + classify.Save(); + classifyEntities.Clear(); + classifyEntities.Add(new ClassifyEntity() + { + Name = "国产剧", + Alias = "guochanju", + ParentId = classify.Id + }); + classifyEntities.Add(new ClassifyEntity() + { + Name = "香港剧", + Alias = "xianggangju", + ParentId = classify.Id + }); + classifyEntities.Add(new ClassifyEntity() + { + Name = "韩国剧", + Alias = "hanguoju", + ParentId = classify.Id + }); + classifyEntities.Add(new ClassifyEntity() + { + Name = "欧美剧", + Alias = "oumeiju", + ParentId = classify.Id + }); + classifyEntities.Add(new ClassifyEntity() + { + Name = "台湾剧", + Alias = "taiwanju", + ParentId = classify.Id + }); + classifyEntities.Add(new ClassifyEntity() + { + Name = "日本剧", + Alias = "ribenju", + ParentId = classify.Id + }); + classifyEntities.Add(new ClassifyEntity() + { + Name = "海外剧", + Alias = "haiwaiju", + ParentId = classify.Id + }); + BaseEntity.Orm.Insert(classifyEntities).ExecuteAffrows(); + classify = new ClassifyEntity() + { + Name = "综艺片", + Alias = "zongyi", + ParentId = 0 + }; + classify.Save(); + classifyEntities.Clear(); + classifyEntities.Add(new ClassifyEntity() + { + Name = "内地综艺", + Alias = "neidizongyi", + ParentId = classify.Id + }); + classifyEntities.Add(new ClassifyEntity() + { + Name = "日韩综艺", + Alias = "rihanzongyi", + ParentId = classify.Id + }); + classifyEntities.Add(new ClassifyEntity() + { + Name = "欧美综艺", + Alias = "oumeizongyi", + ParentId = classify.Id + }); + BaseEntity.Orm.Insert(classifyEntities).ExecuteAffrows(); + classify = new ClassifyEntity() + { + Name = "动漫片", + Alias = "dongman", + ParentId = 0 + }; + classify.Save(); + classifyEntities.Clear(); + classifyEntities.Add(new ClassifyEntity() + { + Name = "国产动漫", + Alias = "guochandongman", + ParentId = classify.Id + }); + classifyEntities.Add(new ClassifyEntity() + { + Name = "日韩动漫", + Alias = "rihandongman", + ParentId = classify.Id + }); + classifyEntities.Add(new ClassifyEntity() + { + Name = "欧美动漫", + Alias = "oumeidongman", + ParentId = classify.Id + }); + BaseEntity.Orm.Insert(classifyEntities).ExecuteAffrows(); System.IO.File.Create("install.lock"); return View(); } diff --git a/CMS/JXCMS.CMS.Movie/Admin/Controllers/MovieController.cs b/CMS/JXCMS.CMS.Movie/Admin/Controllers/MovieController.cs new file mode 100644 index 0000000..27f6507 --- /dev/null +++ b/CMS/JXCMS.CMS.Movie/Admin/Controllers/MovieController.cs @@ -0,0 +1,21 @@ +using JXCMS.CMS.Attribute; +using JXCMS.CMS.Movie.Entity; +using Microsoft.AspNetCore.Mvc; + +namespace JXCMS.CMS.Movie.Admin.Controllers +{ + [Area("Admin")] + [AdminAuthentication] + public class MovieController : Controller + { + public IActionResult Index(int pageNumber = 1, int pageSize = 20) + { + var model = MovieEntity.Select.Count(out long count).Page(pageNumber, pageSize) + .Include(x => x.DirectorEntity).Include(x => x.ClassifyEntity).ToList(); + ViewBag.count = count; + ViewBag.pageNumber = pageNumber; + ViewBag.totlePage = count % pageSize == 0 ? count / pageSize : count / pageSize + 1; + return View(model); + } + } +} \ No newline at end of file diff --git a/CMS/JXCMS.CMS.Movie/Admin/Views/Article/Index.cshtml b/CMS/JXCMS.CMS.Movie/Admin/Views/Article/Index.cshtml deleted file mode 100755 index 9e02d50..0000000 --- a/CMS/JXCMS.CMS.Movie/Admin/Views/Article/Index.cshtml +++ /dev/null @@ -1,265 +0,0 @@ -
- -
-
-
-
- - -
-
- -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - 编号标题书籍作者阅读量状态操作
- - 1第01章 天涯思君不可忘《倚天屠龙记》金庸36正常 -
- - -
-
- - 2第01章 古道腾驹惊白发,危峦快剑识青翎《书剑恩仇录》金庸44正常 -
- - -
-
- - 3一个戴水獭皮帽子的朋友《湘行散记》沈从文39正常 -
- - -
-
- - 4你是要灼灼容颜,还是要宜其室家《诗三百:思无邪》安意如36正常 -
- - -
-
- - 5海上的消息《打开心内的窗》林清玄32正常 -
- - -
-
- - 6楔子 一阕词来 南国清秋魂梦绕 十年人散 绣房红烛剑光寒《七剑下天山》梁羽生42正常 -
- - -
-
- - 7祝福《彷徨》鲁迅40正常 -
- - -
-
- - 8一个女长年的故事《莫泊桑短篇小说集》莫泊桑36正常 -
- - -
-
- - 9第一回 赈民饥包公奉旨 图谋害庞相施计《五虎征西》李雨堂35正常 -
- - -
-
- - 10第一回 于按察山东赴任 邹其仁赴路登程《于公案》佚名37正常 -
- - -
-
-
- - -
-
-
- -
- -
diff --git a/CMS/JXCMS.CMS.Movie/Admin/Views/Classify/ClassifyDialog.cshtml b/CMS/JXCMS.CMS.Movie/Admin/Views/Classify/ClassifyDialog.cshtml new file mode 100644 index 0000000..b821865 --- /dev/null +++ b/CMS/JXCMS.CMS.Movie/Admin/Views/Classify/ClassifyDialog.cshtml @@ -0,0 +1,42 @@ +@using JXCMS.CMS.Movie.Entity +@model JXCMS.CMS.Movie.Entity.ClassifyEntity + +@{ + Layout = "_DialogLayout"; +} + +
+ +
+ + +
+
+ + +
+
+ + +
+
+ +@section dialogScript +{ + +} diff --git a/CMS/JXCMS.CMS.Movie/Admin/Views/Classify/Index.cshtml b/CMS/JXCMS.CMS.Movie/Admin/Views/Classify/Index.cshtml new file mode 100644 index 0000000..6a7f189 --- /dev/null +++ b/CMS/JXCMS.CMS.Movie/Admin/Views/Classify/Index.cshtml @@ -0,0 +1,160 @@ +@using JXCMS.CMS.Movie.Entity +@using JXCMS.Core.Extensions +@model List + +@{ + ViewBag.Title = "分类目录"; + Layout = "_Layout"; +} + +
+ +
+
+
+
+
+ 新增 +
+
+
+ +
+ + + + + + + + + + + + @if (Model.Count == 0) + { + + + + } + @foreach (var classifyEntity in Model) + { + + + + + + + + } + +
名称别名上级分类视频数量操作
无数据
@classifyEntity.Name@(classifyEntity.Alias.IsNullOrEmpty() ? "-" : classifyEntity.Alias)@(classifyEntity.Parent == null ? "无" : classifyEntity.Parent.Name)@classifyEntity.Count + +
+
+
    + @if (ViewBag.pageNumber != 1) + { +
  • + << +
  • + } + @for (int i = ViewBag.pageNumber - 3; i < ViewBag.pageNumber + 3; i++) + { + if (i < 1 || i > ViewBag.totlePage) + { + continue; + } + if (i == ViewBag.pageNumber) + { +
  • + @i +
  • + } + else + { +
  • + @i +
  • + } + } + @if (ViewBag.pageNumber < ViewBag.totlePage) + { +
  • + >> +
  • + } +
+ +
+
+
+ +
+
+ +
+
+ +@section style +{ + +} + +@section script +{ + + + + +} \ No newline at end of file diff --git a/CMS/JXCMS.CMS.Movie/Admin/Views/Collection/BindingClassifyDialog.cshtml b/CMS/JXCMS.CMS.Movie/Admin/Views/Collection/BindingClassifyDialog.cshtml new file mode 100644 index 0000000..c032e94 --- /dev/null +++ b/CMS/JXCMS.CMS.Movie/Admin/Views/Collection/BindingClassifyDialog.cshtml @@ -0,0 +1,35 @@ +@{ + Layout = "_DialogLayout"; +} +@using JXCMS.CMS.Movie.Entity +@model List +@{ + var classifyEntities = (List) ViewBag.classifyEntities; +} +
+ @for (int i = 0; i < Model.Count; i++) + { + @Html.HiddenFor(x => x[i].Id) + @Html.HiddenFor(x => x[i].WebSiteId) + @Html.HiddenFor(x => x[i].TypeName) + @Html.HiddenFor(x => x[i].TypeId) +
+ @Model[i].TypeName + + + + @Html.DropDownListFor(x => x[i].ClassifyId, new SelectList(classifyEntities, "Id", "Name", Model[i].ClassifyId), + new {@class = "form-control"}) +
+ } +
+ +@section dialogScript +{ + + +} \ No newline at end of file diff --git a/CMS/JXCMS.CMS.Movie/Admin/Views/Collection/Index.cshtml b/CMS/JXCMS.CMS.Movie/Admin/Views/Collection/Index.cshtml index f7a512c..d68ac95 100644 --- a/CMS/JXCMS.CMS.Movie/Admin/Views/Collection/Index.cshtml +++ b/CMS/JXCMS.CMS.Movie/Admin/Views/Collection/Index.cshtml @@ -47,10 +47,17 @@ 网站url 采集cron 状态 + 下次执行时间 操作 + @if (ViewBag.website.Count == 0) + { + + 无数据 + + } @foreach (WebSiteEntity webSiteEntity in ViewBag.website) { @@ -65,12 +72,13 @@ @(webSiteEntity.IsEnable ? "正常" : "已禁用") + @webSiteEntity.NextRunTime
- + diff --git a/CMS/JXCMS.CMS.Movie/Admin/Views/Home/Index.cshtml b/CMS/JXCMS.CMS.Movie/Admin/Views/Home/Index.cshtml index 59d7df3..a5db666 100755 --- a/CMS/JXCMS.CMS.Movie/Admin/Views/Home/Index.cshtml +++ b/CMS/JXCMS.CMS.Movie/Admin/Views/Home/Index.cshtml @@ -34,11 +34,10 @@