修改采集地址页
This commit is contained in:
parent
5308a31cc8
commit
514b2ddfe2
5
.gitignore
vendored
5
.gitignore
vendored
@ -337,4 +337,7 @@ ASALocalRun/
|
|||||||
.localhistory/
|
.localhistory/
|
||||||
|
|
||||||
# BeatPulse healthcheck temp database
|
# BeatPulse healthcheck temp database
|
||||||
healthchecksdb
|
healthchecksdb
|
||||||
|
/CMS/JXCMS.CMS.Movie/test
|
||||||
|
*mono_crash.mem.*.blob
|
||||||
|
test
|
||||||
|
@ -1,3 +1,4 @@
|
|||||||
|
using System.Linq;
|
||||||
using JXCMS.CMS.Attribute;
|
using JXCMS.CMS.Attribute;
|
||||||
using JXCMS.CMS.Movie.Entity;
|
using JXCMS.CMS.Movie.Entity;
|
||||||
using Microsoft.AspNetCore.Mvc;
|
using Microsoft.AspNetCore.Mvc;
|
||||||
@ -8,11 +9,14 @@ namespace JXCMS.CMS.Admin.Controllers
|
|||||||
[AdminAuthentication]
|
[AdminAuthentication]
|
||||||
public class CollectionController : Controller
|
public class CollectionController : Controller
|
||||||
{
|
{
|
||||||
public IActionResult Index()
|
public IActionResult Index(int pageNumber = 1, int pageSize = 20)
|
||||||
{
|
{
|
||||||
ViewBag.title = "采集地址";
|
ViewBag.title = "采集地址";
|
||||||
var website = WebSiteEntity.Select.ToList();
|
var website = WebSiteEntity.Select.Count(out long count).Page(pageNumber, pageSize).ToList();
|
||||||
ViewBag.website = website;
|
ViewBag.website = website;
|
||||||
|
ViewBag.count = count;
|
||||||
|
ViewBag.pageNumber = pageNumber;
|
||||||
|
ViewBag.totlePage = count % pageSize == 0 ? count / pageSize : count / pageSize + 1;
|
||||||
return View();
|
return View();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -25,6 +29,27 @@ namespace JXCMS.CMS.Admin.Controllers
|
|||||||
|
|
||||||
public IActionResult DeleteWebSite(int id)
|
public IActionResult DeleteWebSite(int id)
|
||||||
{
|
{
|
||||||
|
WebSiteEntity.Find(id).Delete();
|
||||||
|
return Redirect(Url.Action("Index"));
|
||||||
|
}
|
||||||
|
|
||||||
|
public IActionResult DeleteWebSiteBatch(int[] ids)
|
||||||
|
{
|
||||||
|
WebSiteEntity.Where(x => ids.Contains(x.Id)).ToDelete().ExecuteAffrows();
|
||||||
|
return Redirect(Url.Action("Index"));
|
||||||
|
}
|
||||||
|
|
||||||
|
public IActionResult EnableWebSiteBatch(int[] ids)
|
||||||
|
{
|
||||||
|
WebSiteEntity.Where(x => ids.Contains(x.Id)).ToUpdate()
|
||||||
|
.Set(y => y.IsEnable, true).ExecuteAffrows();
|
||||||
|
return Redirect(Url.Action("Index"));
|
||||||
|
}
|
||||||
|
|
||||||
|
public IActionResult DisableWebSiteBatch(int[] ids)
|
||||||
|
{
|
||||||
|
WebSiteEntity.Where(x => ids.Contains(x.Id)).ToUpdate()
|
||||||
|
.Set(y => y.IsEnable, false).ExecuteAffrows();
|
||||||
return Redirect(Url.Action("Index"));
|
return Redirect(Url.Action("Index"));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -43,5 +68,7 @@ namespace JXCMS.CMS.Admin.Controllers
|
|||||||
}
|
}
|
||||||
return View(webSiteEntity);
|
return View(webSiteEntity);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -25,101 +25,96 @@
|
|||||||
</div>
|
</div>
|
||||||
</form>
|
</form>
|
||||||
<div class="toolbar-btn-action">
|
<div class="toolbar-btn-action">
|
||||||
<a href="@Url.Action("WebSiteDialog", "Collection", new {id=0})" class="btn btn-primary m-r-5" id="new" data-toggle="modal" data-target="#exampleModal"><i class="mdi mdi-plus"></i> 新增</a>
|
<a data-src="@Url.Action("WebSiteDialog", "Collection", new {id = 0})" class="btn btn-primary m-r-5" id="new" data-toggle="modal" data-target="#exampleModal"><i class="mdi mdi-plus"></i> 新增</a>
|
||||||
<a class="btn btn-success m-r-5" href="#!"><i class="mdi mdi-check"></i> 启用</a>
|
<a class="btn btn-success m-r-5" onclick="enableWebsiteBatch()"><i class="mdi mdi-check"></i> 启用</a>
|
||||||
<a class="btn btn-warning m-r-5" href="#!"><i class="mdi mdi-block-helper"></i> 禁用</a>
|
<a class="btn btn-warning m-r-5" onclick="disableWebsiteBatch()"><i class="mdi mdi-block-helper"></i> 禁用</a>
|
||||||
<a class="btn btn-danger" href="#!"><i class="mdi mdi-window-close"></i> 删除</a>
|
<a class="btn btn-danger" onclick="delWebsiteBatch()"><i class="mdi mdi-window-close"></i> 删除</a>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="card-body">
|
<div class="card-body">
|
||||||
|
|
||||||
<div class="table-responsive">
|
<div class="table-responsive">
|
||||||
<table class="table table-bordered">
|
<form id="batchForm" action="#" method="post">
|
||||||
<thead>
|
<table class="table table-bordered">
|
||||||
<tr>
|
<thead>
|
||||||
<th>
|
|
||||||
<label class="lyear-checkbox checkbox-primary">
|
|
||||||
<input type="checkbox" id="check-all"><span></span>
|
|
||||||
</label>
|
|
||||||
</th>
|
|
||||||
<th>网站名称</th>
|
|
||||||
<th>网站url</th>
|
|
||||||
<th>采集cron</th>
|
|
||||||
<th>状态</th>
|
|
||||||
<th>操作</th>
|
|
||||||
</tr>
|
|
||||||
</thead>
|
|
||||||
<tbody>
|
|
||||||
@foreach (WebSiteEntity webSiteEntity in ViewBag.website)
|
|
||||||
{
|
|
||||||
<tr>
|
<tr>
|
||||||
<td>
|
<th>
|
||||||
<label class="lyear-checkbox checkbox-primary">
|
<label class="lyear-checkbox checkbox-primary">
|
||||||
<input type="checkbox" name="ids[]" value="1"><span></span>
|
<input type="checkbox" id="check-all"><span></span>
|
||||||
</label>
|
</label>
|
||||||
</td>
|
</th>
|
||||||
<td>@webSiteEntity.WebSiteName</td>
|
<th>网站名称</th>
|
||||||
<td>@webSiteEntity.ApiUrl</td>
|
<th>网站url</th>
|
||||||
<td>@webSiteEntity.Cron</td>
|
<th>采集cron</th>
|
||||||
<td>
|
<th>状态</th>
|
||||||
<span class="text-success">@(webSiteEntity.IsEnable ? "正常": "已禁用")</span>
|
<th>操作</th>
|
||||||
</td>
|
|
||||||
<td>
|
|
||||||
<div class="btn-group">
|
|
||||||
<a class="btn btn-xs btn-default" href="@Url.Action("WebSiteDialog", "Collection", new {id = webSiteEntity.Id})" title="编辑" data-toggle="modal" data-target="#exampleModal">
|
|
||||||
<i class="mdi mdi-pencil"></i>
|
|
||||||
</a>
|
|
||||||
<a class="btn btn-xs btn-default" href="#!" title="删除" onclick="delWebsite(@webSiteEntity.Id)">
|
|
||||||
<i class="mdi mdi-window-close"></i>
|
|
||||||
</a>
|
|
||||||
</div>
|
|
||||||
</td>
|
|
||||||
</tr>
|
</tr>
|
||||||
}
|
</thead>
|
||||||
|
<tbody>
|
||||||
</tbody>
|
@foreach (WebSiteEntity webSiteEntity in ViewBag.website)
|
||||||
</table>
|
{
|
||||||
|
<tr>
|
||||||
|
<td>
|
||||||
|
<label class="lyear-checkbox checkbox-primary">
|
||||||
|
<input type="checkbox" name="ids[]" value="@webSiteEntity.Id"><span></span>
|
||||||
|
</label>
|
||||||
|
</td>
|
||||||
|
<td>@webSiteEntity.WebSiteName</td>
|
||||||
|
<td>@webSiteEntity.ApiUrl</td>
|
||||||
|
<td>@webSiteEntity.Cron</td>
|
||||||
|
<td>
|
||||||
|
<span class="text-success">@(webSiteEntity.IsEnable ? "正常" : "已禁用")</span>
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
<div class="btn-group">
|
||||||
|
<a class="btn btn-xs btn-default" data-src="@Url.Action("WebSiteDialog", "Collection", new {id = webSiteEntity.Id})" title="编辑" data-toggle="modal" data-target="#exampleModal">
|
||||||
|
<i class="mdi mdi-pencil"></i>
|
||||||
|
</a>
|
||||||
|
<a class="btn btn-xs btn-default" href="#!" title="删除" onclick="delWebsite(@webSiteEntity.Id, '@webSiteEntity.WebSiteName')">
|
||||||
|
<i class="mdi mdi-window-close"></i>
|
||||||
|
</a>
|
||||||
|
</div>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
}
|
||||||
|
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
</form>
|
||||||
</div>
|
</div>
|
||||||
<ul class="pagination">
|
<ul class="pagination">
|
||||||
<li class="disabled">
|
@if (ViewBag.pageNumber != 1)
|
||||||
<span>«</span>
|
{
|
||||||
</li>
|
<li>
|
||||||
<li class="active">
|
<a href="@Url.Action("Index", "Collection")"><<</a>
|
||||||
<span>1</span>
|
</li>
|
||||||
</li>
|
}
|
||||||
<li>
|
@for (int i = ViewBag.pageNumber - 3; i < ViewBag.pageNumber + 3; i++)
|
||||||
<a href="#1">2</a>
|
{
|
||||||
</li>
|
if (i < 1 || i > ViewBag.totlePage)
|
||||||
<li>
|
{
|
||||||
<a href="#1">3</a>
|
continue;
|
||||||
</li>
|
}
|
||||||
<li>
|
if (i == ViewBag.pageNumber)
|
||||||
<a href="#1">4</a>
|
{
|
||||||
</li>
|
<li class="active">
|
||||||
<li>
|
<span>@i</span>
|
||||||
<a href="#1">5</a>
|
</li>
|
||||||
</li>
|
}
|
||||||
<li>
|
else
|
||||||
<a href="#1">6</a>
|
{
|
||||||
</li>
|
<li>
|
||||||
<li>
|
<a href="@Url.Action("Index", "Collection", new {pageNumber = i})">@i</a>
|
||||||
<a href="#1">7</a>
|
</li>
|
||||||
</li>
|
}
|
||||||
<li>
|
}
|
||||||
<a href="#1">8</a>
|
@if (ViewBag.pageNumber < ViewBag.totlePage)
|
||||||
</li>
|
{
|
||||||
<li class="disabled">
|
<li>
|
||||||
<span>...</span>
|
<a href="@Url.Action("Index", "Collection", new {pageNumber = ViewBag.totlePage})">>></a>
|
||||||
</li>
|
</li>
|
||||||
<li>
|
}
|
||||||
<a href="#!">14452</a>
|
|
||||||
</li>
|
|
||||||
<li>
|
|
||||||
<a href="#!">14453</a>
|
|
||||||
</li>
|
|
||||||
<li>
|
|
||||||
<a href="#!">»</a>
|
|
||||||
</li>
|
|
||||||
</ul>
|
</ul>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
@ -134,7 +129,11 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
<form id="delForm" action="@Url.Action("DeleteWebSite")" method="post">
|
||||||
|
<input type="hidden" name="id" id="delId"/>
|
||||||
|
</form>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
@section style
|
@section style
|
||||||
{
|
{
|
||||||
<link rel="stylesheet" href="@Url.ContentAdmin("js/jconfirm/jquery-confirm.min.css")">
|
<link rel="stylesheet" href="@Url.ContentAdmin("js/jconfirm/jquery-confirm.min.css")">
|
||||||
@ -143,33 +142,98 @@
|
|||||||
@section script
|
@section script
|
||||||
{
|
{
|
||||||
<script src="@Url.ContentAdmin("js/bootstrap-notify.min.js")"></script>
|
<script src="@Url.ContentAdmin("js/bootstrap-notify.min.js")"></script>
|
||||||
<script type="text/javascript" src="@Url.ContentAdmin("js/lightyear.js")"></script>
|
<script type="text/javascript" src="@Url.ContentAdmin("js/lightyear.js")"></script>
|
||||||
<script type="text/javascript" src="@Url.ContentAdmin("js/Validate.js")"></script>
|
<script type="text/javascript" src="@Url.ContentAdmin("js/Validate.js")"></script>
|
||||||
<script src="@Url.ContentAdmin("js/jconfirm/jquery-confirm.min.js")"></script>
|
<script src="@Url.ContentAdmin("js/jconfirm/jquery-confirm.min.js")"></script>
|
||||||
<script>
|
<script>
|
||||||
$('#exampleModal').on('hidden.bs.modal', function(event) {
|
$('#exampleModal').on('show.bs.modal', function(event) {
|
||||||
$('#exampleModal').modal('dispose')
|
var button = $(event.relatedTarget); // Button that triggered the modal
|
||||||
|
var recipient = button.data('src'); // Extract info from data-* attributes
|
||||||
|
var content = $(this).find(".modal-content");
|
||||||
|
content.html("正在加载,请稍后...");
|
||||||
|
$.get(recipient, function(data, status) {
|
||||||
|
if (status === "success") {
|
||||||
|
content.html(data)
|
||||||
|
} else{
|
||||||
|
content.html("发生错误,请重试")
|
||||||
|
}
|
||||||
|
})
|
||||||
});
|
});
|
||||||
function delWebsite(id) {
|
function delWebsite(id, name) {
|
||||||
$.alert({
|
$.alert({
|
||||||
title: '嗨',
|
title: '删除采集地址' + name,
|
||||||
content: '这是对用户的简单提示框。 <br> 一些 <strong>HTML</strong> <em>内容</em>' + id,
|
content: '是否删除' + name + '?该操作不可恢复',
|
||||||
buttons: {
|
buttons: {
|
||||||
confirm: {
|
confirm: {
|
||||||
text: '确认',
|
text: '是',
|
||||||
btnClass: 'btn-primary',
|
btnClass: 'btn-primary',
|
||||||
action: function(){
|
action: function(){
|
||||||
$.alert('你点击了确认!');
|
$('#delId').val(id);
|
||||||
|
$('#delForm').submit();
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
cancel: {
|
cancel: {
|
||||||
text: '取消',
|
text: '否'
|
||||||
action: function () {
|
|
||||||
$.alert('你点击了取消!');
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function delWebsiteBatch() {
|
||||||
|
$.alert({
|
||||||
|
title: '批量删除采集地址',
|
||||||
|
content: '是否要批量删除选中的采集地址?该操作不可恢复',
|
||||||
|
buttons: {
|
||||||
|
confirm: {
|
||||||
|
text: '是',
|
||||||
|
btnClass: 'btn-primary',
|
||||||
|
action: function(){
|
||||||
|
$('#batchForm').attr('action', '@Url.Action("DeleteWebSiteBatch")').submit();
|
||||||
|
}
|
||||||
|
},
|
||||||
|
cancel: {
|
||||||
|
text: '否'
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
function enableWebsiteBatch() {
|
||||||
|
$.alert({
|
||||||
|
title: '批量启用采集地址',
|
||||||
|
content: '是否要批量启用选中的采集地址?',
|
||||||
|
buttons: {
|
||||||
|
confirm: {
|
||||||
|
text: '是',
|
||||||
|
btnClass: 'btn-primary',
|
||||||
|
action: function(){
|
||||||
|
$('#batchForm').attr('action', '@Url.Action("EnableWebSiteBatch")').submit();
|
||||||
|
}
|
||||||
|
},
|
||||||
|
cancel: {
|
||||||
|
text: '否'
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
function disableWebsiteBatch() {
|
||||||
|
$.alert({
|
||||||
|
title: '批量禁用采集地址',
|
||||||
|
content: '是否要禁用删除选中的采集地址?',
|
||||||
|
buttons: {
|
||||||
|
confirm: {
|
||||||
|
text: '是',
|
||||||
|
btnClass: 'btn-primary',
|
||||||
|
action: function(){
|
||||||
|
$('#batchForm').attr('action', '@Url.Action("DisableWebSiteBatch")').submit();
|
||||||
|
}
|
||||||
|
},
|
||||||
|
cancel: {
|
||||||
|
text: '否'
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
</script>
|
</script>
|
||||||
}
|
}
|
@ -19,6 +19,7 @@
|
|||||||
<PackageReference Include="FreeSql.Provider.SqlServer" Version="0.11.20" />
|
<PackageReference Include="FreeSql.Provider.SqlServer" Version="0.11.20" />
|
||||||
<PackageReference Include="McMaster.NETCore.Plugins" Version="0.3.1" />
|
<PackageReference Include="McMaster.NETCore.Plugins" Version="0.3.1" />
|
||||||
<PackageReference Include="Newtonsoft.Json" Version="12.0.3" />
|
<PackageReference Include="Newtonsoft.Json" Version="12.0.3" />
|
||||||
|
<PackageReference Include="Quartz" Version="3.0.7" />
|
||||||
<PackageReference Include="Serilog.AspNetCore" Version="3.2.0" />
|
<PackageReference Include="Serilog.AspNetCore" Version="3.2.0" />
|
||||||
<PackageReference Include="Serilog.Settings.Configuration" Version="3.1.0" />
|
<PackageReference Include="Serilog.Settings.Configuration" Version="3.1.0" />
|
||||||
<PackageReference Include="Serilog.Sinks.Console" Version="3.1.2-dev-00824" />
|
<PackageReference Include="Serilog.Sinks.Console" Version="3.1.2-dev-00824" />
|
||||||
|
40
Core/JXCMS.Core/TimingTask/QuartzTask.cs
Normal file
40
Core/JXCMS.Core/TimingTask/QuartzTask.cs
Normal file
@ -0,0 +1,40 @@
|
|||||||
|
using System;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
using Quartz;
|
||||||
|
using Quartz.Impl;
|
||||||
|
|
||||||
|
namespace JXCMS.Core.TimingTask
|
||||||
|
{
|
||||||
|
public class QuartzTask
|
||||||
|
{
|
||||||
|
private ISchedulerFactory _schedulerFactory;
|
||||||
|
private IScheduler _scheduler;
|
||||||
|
|
||||||
|
private QuartzTask()
|
||||||
|
{
|
||||||
|
_schedulerFactory = new StdSchedulerFactory();
|
||||||
|
_scheduler = _schedulerFactory.GetScheduler().Result;
|
||||||
|
_scheduler.Start();
|
||||||
|
}
|
||||||
|
|
||||||
|
private static QuartzTask _instance;
|
||||||
|
|
||||||
|
public static QuartzTask Instance()
|
||||||
|
{
|
||||||
|
if (_instance == null)
|
||||||
|
{
|
||||||
|
_instance = new QuartzTask();
|
||||||
|
}
|
||||||
|
|
||||||
|
return _instance;
|
||||||
|
}
|
||||||
|
|
||||||
|
public async Task<bool> AddTask(Type jobType, string cron, string jobName, string jobGroup = "default")
|
||||||
|
{
|
||||||
|
var job = JobBuilder.Create(jobType).WithIdentity("job", "job").Build();
|
||||||
|
var trigger = TriggerBuilder.Create().WithIdentity(jobName + "tigger").StartNow().WithCronSchedule(cron).Build();
|
||||||
|
await _scheduler.ScheduleJob(job, trigger);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user