mirror of
https://gitee.com/ulthon/ulthon_admin.git
synced 2026-08-30 12:45:32 +08:00
refactor(timer): TimerLog 控制器迁移到 Base 层 + toolbar 与事件监听修正
控制器逻辑移入 extend/base/admin/controller/system/TimerLogBase.php,app 层改为空壳继承。index.js 补 toolbar:[] + defaultToolbar:['filter'](B 类只读页面),修正 ua.table.on → layui.table.on。 Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-openagent) Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai>
This commit is contained in:
109
extend/base/admin/controller/system/TimerLogBase.php
Normal file
109
extend/base/admin/controller/system/TimerLogBase.php
Normal file
@@ -0,0 +1,109 @@
|
||||
<?php
|
||||
|
||||
namespace base\admin\controller\system;
|
||||
|
||||
use app\common\controller\AdminController;
|
||||
use app\admin\service\annotation\ControllerAnnotation;
|
||||
use app\admin\service\annotation\NodeAnotation;
|
||||
use think\App;
|
||||
|
||||
/**
|
||||
* @ControllerAnnotation(title="定时器执行日志")
|
||||
*/
|
||||
class TimerLogBase extends AdminController
|
||||
{
|
||||
|
||||
use \app\admin\traits\Curd;
|
||||
|
||||
protected $sort = [
|
||||
'id' => 'desc',
|
||||
];
|
||||
|
||||
public function __construct(App $app)
|
||||
{
|
||||
parent::__construct($app);
|
||||
|
||||
$this->model = new \app\admin\model\SystemTimerLog();
|
||||
}
|
||||
|
||||
/**
|
||||
* @NodeAnotation(title="列表")
|
||||
*/
|
||||
public function index()
|
||||
{
|
||||
if ($this->request->isAjax()) {
|
||||
if (input('selectFields')) {
|
||||
return $this->selectList();
|
||||
}
|
||||
list($page, $limit, $where, $excludes, $request_options, $group) = $this->buildTableParames();
|
||||
$count = $this->model
|
||||
->where($where)
|
||||
->group($group)
|
||||
->count();
|
||||
$list = $this->model
|
||||
->where($where)
|
||||
->page($page, $limit)
|
||||
->order($this->sort)
|
||||
->group($group)
|
||||
->select();
|
||||
$data = [
|
||||
'code' => 0,
|
||||
'msg' => '',
|
||||
'count' => $count,
|
||||
'data' => $list,
|
||||
];
|
||||
|
||||
return json($data);
|
||||
}
|
||||
|
||||
return $this->fetch();
|
||||
}
|
||||
|
||||
/**
|
||||
* @NodeAnotation(title="详情")
|
||||
*/
|
||||
public function read($id)
|
||||
{
|
||||
$row = $this->model->find($id);
|
||||
empty($row) && $this->error('数据不存在');
|
||||
|
||||
$title = $row->title;
|
||||
|
||||
$this->assign('row', $row);
|
||||
$this->assign('title', $title);
|
||||
|
||||
return $this->fetch();
|
||||
}
|
||||
|
||||
/**
|
||||
* @NodeAnotation(title="添加")
|
||||
*/
|
||||
public function add()
|
||||
{
|
||||
$this->error('日志表不允许手动添加');
|
||||
}
|
||||
|
||||
/**
|
||||
* @NodeAnotation(title="编辑")
|
||||
*/
|
||||
public function edit($id)
|
||||
{
|
||||
$this->error('日志表不允许编辑');
|
||||
}
|
||||
|
||||
/**
|
||||
* @NodeAnotation(title="删除")
|
||||
*/
|
||||
public function delete($id)
|
||||
{
|
||||
$this->error('日志表不允许删除');
|
||||
}
|
||||
|
||||
/**
|
||||
* @NodeAnotation(title="属性修改")
|
||||
*/
|
||||
public function modify()
|
||||
{
|
||||
$this->error('日志表不允许修改');
|
||||
}
|
||||
}
|
||||
@@ -56,6 +56,8 @@ $(function(){
|
||||
|
||||
ua.table.render({
|
||||
init: init,
|
||||
toolbar: [],
|
||||
defaultToolbar: ['filter'],
|
||||
cols: [[
|
||||
{type: 'checkbox'},
|
||||
{field: 'id', title: 'ID', width: 80, sort: true},
|
||||
@@ -85,7 +87,7 @@ $(function(){
|
||||
});
|
||||
|
||||
// 点击错误信息查看完整内容
|
||||
ua.table.on('tool(currentTable)', function(obj) {
|
||||
layui.table.on('tool(currentTable)', function(obj) {
|
||||
if (obj.event === 'showError') {
|
||||
var text = obj.data.error_message || '';
|
||||
layer.alert('<pre style="white-space:pre-wrap;word-break:break-all;max-height:400px;overflow-y:auto;">'+text.replace(/</g,'<').replace(/>/g,'>')+'</pre>', {
|
||||
|
||||
Reference in New Issue
Block a user