Commit c34a5b04 by lzzzzl

init

parent 16217c69
......@@ -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);
}
......
......@@ -30,7 +30,7 @@ class SpiderModel extends Model
foreach ($data['data'] as $k => $v) {
$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]['run_time'] = date("Y-m-d H:i:s", $v['run_time']);
$data['data'][$k]['run_time'] .= '秒';
}
return $data;
......@@ -41,11 +41,11 @@ class SpiderModel extends Model
* 更新状态
* @return array
*/
public function updateOnOff() {
public function updateStatus() {
$collect = Request::all();
$map['id'] = !empty($collect['id']) ? $collect['id'] : '';
$collect = TrimX($collect, false, ['on_off']);
$collect = TrimX($collect, false, ['status']);
$result = $this->where($map)->update($collect);
if ($result) {
return [0,'成功'];
......
......@@ -6,7 +6,7 @@ return [
'NotAuth'
),
//api不用验证方法
'ApiNotAuth'=>array('ApiAddConfig','ApiConfigContent','ApiUpdateManualPush','ApiUpdateOnOff','ApiManageList','ApiUpdateExcel','ApiFileList','ApiDeleteFile'
'ApiNotAuth'=>array('ApiSpiderList','ApiUpdateStatus','ApiConfigContent','ApiAddConfig','ApiUpdateNode','ApiUpdateAllNode'
),
'MenuSign'=>'/web/',//菜单去除掉标记,生成菜单时用
......
......@@ -11,11 +11,10 @@ layui.use(['table', 'form', 'laydate', 'layer'], function () {
url: '/api/ApiSpiderList/',
request:{pageName:'p', limitName:'limit'},
cols: [[
{field:'on_off', title:'状态', width:85, templet: '#switchTpl', unresize: true},
{field:'status', title:'状态', width:85, templet: '#switchTpl', unresize: true},
{field:'platform', title:'平台名称'},
{field:'task_code', title:'任务码'},
{field:'concurrency', title:'并发数'},
{field:'status', title:'任务状态', templet: '#status'},
{field:'queue', title:'队列'},
{field:'unique_code', title:'唯一码'},
{field:'start_time', title:'开始时间', width:200},
......@@ -29,13 +28,13 @@ layui.use(['table', 'form', 'laydate', 'layer'], function () {
id: 'idTest'
});
form.on('switch(on_off)', function(){
form.on('switch(status)', function(){
var data = {
id:$(this).attr('data-id'),
on_off:this.checked ? 1:2
}
status:this.checked ? 0:1
};
$.ajax({
url:'/api/ApiUpdateOnOff',
url:'/api/ApiUpdateStatus',
type:'get',
dataType:'json',
data: data,
......
......@@ -7,7 +7,7 @@
</div>
<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 type="text/html" id="status">
......@@ -16,10 +16,7 @@
</a>
</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">
<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>
</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