修改系统任务管理

This commit is contained in:
邹景立 2022-03-02 22:58:38 +08:00
parent 07f7163d24
commit 2a01a22bb0
3 changed files with 10 additions and 18 deletions

View File

@ -98,15 +98,15 @@ class Queue extends Controller
{ {
if (AdminService::instance()->isSuper()) try { if (AdminService::instance()->isSuper()) try {
$message = $this->app->console->call('xadmin:queue', ['status'])->fetch(); $message = $this->app->console->call('xadmin:queue', ['status'])->fetch();
if (preg_match('/process.*?\d+.*?running/', $message, $attrs)) { if (preg_match('/process.*?\d+.*?running/', $message)) {
echo '<span class="color-green">' . $message . '</span>'; echo "<span class='color-green pointer' data-tips-text='{$message}'>已启动</span>";
} else { } else {
echo '<span class="color-red">' . $message . '</span>'; echo "<span class='color-red pointer' data-tips-text='{$message}'>未启动</span>";
} }
} catch (Exception $exception) { } catch (Exception $exception) {
echo '<span class="color-red">' . $exception->getMessage() . '</span>'; echo "<span class='color-red pointer' data-tips-text='{$exception->getMessage()}'>异 常</span>";
} else { } else {
echo '<span class="color-red">只有超级管理员才能操作!</span>'; echo "<span class='color-red pointer' data-tips-text='只有超级管理员才能操作!'>无权限</span>";
} }
} }
} }

View File

@ -20,6 +20,11 @@
{block name="content"} {block name="content"}
<div class="think-box-notify"> <div class="think-box-notify">
<!--{if isset($super) and $super}-->
<b>服务状态:</b><b class="margin-right-5" data-queue-message><span class="color-desc">检查中</span></b>
<b data-tips-text="点击可复制【任务服务启动指令】" class="layui-icon pointer margin-right-20" data-copy="{$command|default=''}">&#xe60e;</b>
<script>$('[data-queue-message]').load('{:sysuri("admin/api.queue/status")}')</script>
<!--{/if}-->
<b>任务统计:</b>待处理 <b class="color-text">{$total.pre|default=0}</b> 个任务,处理中 <b class="color-blue">{$total.dos|default=0}</b> 个任务,已完成 <b class="color-green">{$total.oks|default=0}</b> 个任务,已失败 <b class="color-red">{$total.ers|default=0}</b> 个任务。 <b>任务统计:</b>待处理 <b class="color-text">{$total.pre|default=0}</b> 个任务,处理中 <b class="color-blue">{$total.dos|default=0}</b> 个任务,已完成 <b class="color-green">{$total.oks|default=0}</b> 个任务,已失败 <b class="color-red">{$total.ers|default=0}</b> 个任务。
</div> </div>
<div class="think-box-shadow"> <div class="think-box-shadow">

View File

@ -1,16 +1,3 @@
<!--{if isset($super) and $super}-->
<fieldset class="margin-bottom-15">
<legend class="notselect">服务状态</legend>
<div class="layui-code border-0 margin-top-0">
<h4 class="color-desc notselect">后台服务主进程运行状态</h4>
<div data-queue-message>Checking task process running status ...</div>
<script>$('[data-queue-message]').load('{:sysuri("admin/api.queue/status")}')</script>
<h4 class="color-desc margin-top-10 notselect">配置定时任务来检查并启动进程(建议每分钟执行)</h4>
<div>{$command|default='--'}</div>
</div>
</fieldset>
<!--{/if}-->
<fieldset> <fieldset>
<legend>条件搜索</legend> <legend>条件搜索</legend>
<form class="layui-form layui-form-pane form-search" action="{:sysuri()}" onsubmit="return false" method="get" autocomplete="off"> <form class="layui-form layui-form-pane form-search" action="{:sysuri()}" onsubmit="return false" method="get" autocomplete="off">