Commit c34a5b04 by lzzzzl

init

parent 16217c69
...@@ -68,9 +68,9 @@ class AccessApiController extends Controller ...@@ -68,9 +68,9 @@ class AccessApiController extends Controller
/** /**
* 更新开始结束状态 * 更新开始结束状态
*/ */
private function ApiUpdateOnOff() { private function ApiUpdateStatus() {
$data = (new SpiderModel())->updateOnOff(); $data = (new SpiderModel())->updateStatus();
$this->Export($data); $this->Export($data);
} }
......
...@@ -30,7 +30,7 @@ class SpiderModel extends Model ...@@ -30,7 +30,7 @@ class SpiderModel extends Model
foreach ($data['data'] as $k => $v) { foreach ($data['data'] as $k => $v) {
$data['data'][$k]['status_name'] = platform_status($v['status']); $data['data'][$k]['status_name'] = platform_status($v['status']);
$data['data'][$k]['start_time'] = date("Y-m-d H:i:s", $v['start_time']); $data['data'][$k]['start_time'] = date("Y-m-d H:i:s", $v['start_time']);
$data['data'][$k]['run_time'] = date("Y-m-d H:i:s", $v['run_time']); $data['data'][$k]['run_time'] .= '秒';
} }
return $data; return $data;
...@@ -41,11 +41,11 @@ class SpiderModel extends Model ...@@ -41,11 +41,11 @@ class SpiderModel extends Model
* 更新状态 * 更新状态
* @return array * @return array
*/ */
public function updateOnOff() { public function updateStatus() {
$collect = Request::all(); $collect = Request::all();
$map['id'] = !empty($collect['id']) ? $collect['id'] : ''; $map['id'] = !empty($collect['id']) ? $collect['id'] : '';
$collect = TrimX($collect, false, ['on_off']); $collect = TrimX($collect, false, ['status']);
$result = $this->where($map)->update($collect); $result = $this->where($map)->update($collect);
if ($result) { if ($result) {
return [0,'成功']; return [0,'成功'];
......
...@@ -6,7 +6,7 @@ return [ ...@@ -6,7 +6,7 @@ return [
'NotAuth' 'NotAuth'
), ),
//api不用验证方法 //api不用验证方法
'ApiNotAuth'=>array('ApiAddConfig','ApiConfigContent','ApiUpdateManualPush','ApiUpdateOnOff','ApiManageList','ApiUpdateExcel','ApiFileList','ApiDeleteFile' 'ApiNotAuth'=>array('ApiSpiderList','ApiUpdateStatus','ApiConfigContent','ApiAddConfig','ApiUpdateNode','ApiUpdateAllNode'
), ),
'MenuSign'=>'/web/',//菜单去除掉标记,生成菜单时用 'MenuSign'=>'/web/',//菜单去除掉标记,生成菜单时用
......
...@@ -11,11 +11,10 @@ layui.use(['table', 'form', 'laydate', 'layer'], function () { ...@@ -11,11 +11,10 @@ layui.use(['table', 'form', 'laydate', 'layer'], function () {
url: '/api/ApiSpiderList/', url: '/api/ApiSpiderList/',
request:{pageName:'p', limitName:'limit'}, request:{pageName:'p', limitName:'limit'},
cols: [[ cols: [[
{field:'on_off', title:'状态', width:85, templet: '#switchTpl', unresize: true}, {field:'status', title:'状态', width:85, templet: '#switchTpl', unresize: true},
{field:'platform', title:'平台名称'}, {field:'platform', title:'平台名称'},
{field:'task_code', title:'任务码'}, {field:'task_code', title:'任务码'},
{field:'concurrency', title:'并发数'}, {field:'concurrency', title:'并发数'},
{field:'status', title:'任务状态', templet: '#status'},
{field:'queue', title:'队列'}, {field:'queue', title:'队列'},
{field:'unique_code', title:'唯一码'}, {field:'unique_code', title:'唯一码'},
{field:'start_time', title:'开始时间', width:200}, {field:'start_time', title:'开始时间', width:200},
...@@ -29,13 +28,13 @@ layui.use(['table', 'form', 'laydate', 'layer'], function () { ...@@ -29,13 +28,13 @@ layui.use(['table', 'form', 'laydate', 'layer'], function () {
id: 'idTest' id: 'idTest'
}); });
form.on('switch(on_off)', function(){ form.on('switch(status)', function(){
var data = { var data = {
id:$(this).attr('data-id'), id:$(this).attr('data-id'),
on_off:this.checked ? 1:2 status:this.checked ? 0:1
} };
$.ajax({ $.ajax({
url:'/api/ApiUpdateOnOff', url:'/api/ApiUpdateStatus',
type:'get', type:'get',
dataType:'json', dataType:'json',
data: data, data: data,
......
...@@ -7,7 +7,7 @@ ...@@ -7,7 +7,7 @@
</div> </div>
<script type="text/html" id="switchTpl"> <script type="text/html" id="switchTpl">
<input type="checkbox" name="check" value="" lay-skin="switch" lay-text="启动|停止" lay-filter="on_off" data-id="@{{d.id}}" @{{ d.on_off == 1?'checked':''}}> <input type="checkbox" name="check" value="" lay-skin="switch" lay-text="启动|停止" lay-filter="status" data-id="@{{d.id}}" @{{ d.status == 0?'checked':''}}>
</script> </script>
<script type="text/html" id="status"> <script type="text/html" id="status">
...@@ -16,10 +16,7 @@ ...@@ -16,10 +16,7 @@
</a> </a>
</script> </script>
<script type="text/html" id="manual_push">
<input type="checkbox" name="check" lay-skin="switch" lay-text="ON|OFF" lay-filter="manual_push" data-id="@{{d.id}}" @{{ d.manual_push == 1?'checked':''}}>
</script>
<script type="text/html" id="modify"> <script type="text/html" id="modify">
<a class="btn btn-xs btn-outline btn-primary" lay-event="detail">编辑</a>
<a class="btn btn-xs btn-outline btn-primary" lay-event="stop">停止任务</a> <a class="btn btn-xs btn-outline btn-primary" lay-event="stop">停止任务</a>
</script> </script>
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment