mirror of
https://gitee.com/zoujingli/ThinkAdmin.git
synced 2025-04-26 03:16:36 +08:00
[更新]修改系统任务
This commit is contained in:
parent
9546b9a668
commit
4bc8726015
@ -17,6 +17,7 @@ namespace app\admin\controller;
|
|||||||
|
|
||||||
use library\Controller;
|
use library\Controller;
|
||||||
use think\Console;
|
use think\Console;
|
||||||
|
use think\exception\HttpResponseException;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 系统系统任务
|
* 系统系统任务
|
||||||
@ -50,6 +51,7 @@ class Queue extends Controller
|
|||||||
$this->message = $exception->getMessage();
|
$this->message = $exception->getMessage();
|
||||||
}
|
}
|
||||||
$this->title = '系统任务管理';
|
$this->title = '系统任务管理';
|
||||||
|
$this->iswin = PATH_SEPARATOR === ';';
|
||||||
$query = $this->_query($this->table)->dateBetween('create_at,end_at');
|
$query = $this->_query($this->table)->dateBetween('create_at,end_at');
|
||||||
$query->like('title,preload')->equal('status')->order('id desc')->page();
|
$query->like('title,preload')->equal('status')->order('id desc')->page();
|
||||||
}
|
}
|
||||||
@ -65,6 +67,36 @@ class Queue extends Controller
|
|||||||
$this->_save($this->table, ['status' => '1']);
|
$this->_save($this->table, ['status' => '1']);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* (WIN)创建任务监听进程
|
||||||
|
* @auth true
|
||||||
|
*/
|
||||||
|
public function processStart()
|
||||||
|
{
|
||||||
|
try {
|
||||||
|
$this->success(nl2br(Console::call('xtask:start')->fetch()));
|
||||||
|
} catch (HttpResponseException $exception) {
|
||||||
|
throw $exception;
|
||||||
|
} catch (\Exception $e) {
|
||||||
|
$this->error($e->getMessage());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* (WIN)停止任务监听进程
|
||||||
|
* @auth true
|
||||||
|
*/
|
||||||
|
public function processStop()
|
||||||
|
{
|
||||||
|
try {
|
||||||
|
$this->success(nl2br(Console::call('xtask:stop')->fetch()));
|
||||||
|
} catch (HttpResponseException $exception) {
|
||||||
|
throw $exception;
|
||||||
|
} catch (\Exception $e) {
|
||||||
|
$this->error($e->getMessage());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 删除系统任务
|
* 删除系统任务
|
||||||
* @auth true
|
* @auth true
|
||||||
|
@ -87,14 +87,13 @@ if (!function_exists('sysqueue')) {
|
|||||||
$result = Db::name('SystemQueue')->insert([
|
$result = Db::name('SystemQueue')->insert([
|
||||||
'title' => $title, 'preload' => $loade,
|
'title' => $title, 'preload' => $loade,
|
||||||
'data' => json_encode($data, JSON_UNESCAPED_UNICODE),
|
'data' => json_encode($data, JSON_UNESCAPED_UNICODE),
|
||||||
'time' => ($later > 0 ? time() + $later : time()) - 3,
|
'time' => $later > 0 ? time() + $later : time(),
|
||||||
'double' => intval($double),
|
'double' => intval($double), 'create_at' => date('Y-m-d H:i:s'),
|
||||||
]);
|
]);
|
||||||
return $result !== false;
|
return $result !== false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
if (!function_exists('local_image')) {
|
if (!function_exists('local_image')) {
|
||||||
/**
|
/**
|
||||||
* 下载远程文件到本地
|
* 下载远程文件到本地
|
||||||
|
@ -2,8 +2,16 @@
|
|||||||
|
|
||||||
{block name="button"}
|
{block name="button"}
|
||||||
|
|
||||||
{if auth("admin/queue/remove")}
|
{if auth("remove")}
|
||||||
<button data-action='{:url("remove")}' data-confirm="确定要删除这些任务吗?" data-rule="id#{key}" class='layui-btn layui-btn-sm layui-btn-primary'>删除任务</button>
|
<button data-action='{:url("remove")}' data-confirm="确定要删除这些任务吗?" data-rule="id#{key}" class='layui-btn layui-btn-sm layui-btn-primary'>删除任务记录</button>
|
||||||
|
{/if}
|
||||||
|
|
||||||
|
{if auth("processstart") && $iswin}
|
||||||
|
<button data-load='{:url("processstart")}' class='layui-btn layui-btn-sm layui-btn-primary'>创建监听进程</button>
|
||||||
|
{/if}
|
||||||
|
|
||||||
|
{if auth("processstop") && $iswin}
|
||||||
|
<button data-load='{:url("processstop")}' class='layui-btn layui-btn-sm layui-btn-primary'>停止监听进程</button>
|
||||||
{/if}
|
{/if}
|
||||||
|
|
||||||
{/block}
|
{/block}
|
||||||
@ -36,8 +44,8 @@
|
|||||||
<span class="color-desc">任务指令:{$vo.preload}</span>
|
<span class="color-desc">任务指令:{$vo.preload}</span>
|
||||||
</td>
|
</td>
|
||||||
<td class='text-left nowrap'>
|
<td class='text-left nowrap'>
|
||||||
创建时间:{$vo.create_at|format_datetime|raw}<br>
|
创建时间:{$vo.create_at|format_datetime} / {$vo.time|format_datetime}<br>
|
||||||
跟进时间:{$vo.end_at|format_datetime|raw}
|
执行时间:{$vo.start_at|format_datetime} / {$vo.end_at|format_datetime}
|
||||||
</td>
|
</td>
|
||||||
<td class='text-left nowrap'>
|
<td class='text-left nowrap'>
|
||||||
任务状态:{eq name='vo.double' value='1'}
|
任务状态:{eq name='vo.double' value='1'}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user