修改日志列表
This commit is contained in:
parent
50bcb7e289
commit
08aee72ab9
@ -1 +1,20 @@
|
|||||||
<?php
|
<?php
|
||||||
|
namespace catchAdmin\system\controller;
|
||||||
|
|
||||||
|
use catcher\base\CatchController;
|
||||||
|
use catcher\CatchResponse;
|
||||||
|
use catcher\generate\Generator;
|
||||||
|
use think\Request;
|
||||||
|
|
||||||
|
class Generate extends CatchController
|
||||||
|
{
|
||||||
|
public function save(Request $request, Generator $generator)
|
||||||
|
{
|
||||||
|
return CatchResponse::success($generator->done($request->param()));
|
||||||
|
}
|
||||||
|
|
||||||
|
public function preview()
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
@ -4,16 +4,32 @@ namespace catchAdmin\system\controller;
|
|||||||
use catcher\base\CatchController;
|
use catcher\base\CatchController;
|
||||||
use catcher\CatchResponse;
|
use catcher\CatchResponse;
|
||||||
use think\facade\Db;
|
use think\facade\Db;
|
||||||
|
use catchAdmin\system\model\LoginLog as Log;
|
||||||
|
|
||||||
class LoginLog extends CatchController
|
class LoginLog extends CatchController
|
||||||
{
|
{
|
||||||
public function list()
|
/**
|
||||||
|
*
|
||||||
|
* @time 2020年04月28日
|
||||||
|
* @param Log $log
|
||||||
|
* @throws \think\db\exception\DbException
|
||||||
|
* @return \think\response\Json
|
||||||
|
*/
|
||||||
|
public function list(Log $log)
|
||||||
{
|
{
|
||||||
return CatchResponse::paginate(Db::name('login_log')->paginate(request()->param('limit') ?? 10));
|
return CatchResponse::paginate($log->paginate());
|
||||||
}
|
}
|
||||||
|
|
||||||
public function empty()
|
/**
|
||||||
|
* 清空
|
||||||
|
*
|
||||||
|
* @time 2020年04月28日
|
||||||
|
* @param Log $log
|
||||||
|
* @throws \Exception
|
||||||
|
* @return \think\response\Json
|
||||||
|
*/
|
||||||
|
public function empty(Log $log)
|
||||||
{
|
{
|
||||||
return CatchResponse::success(Db::name('login_log')->delete(true), '清空成功');
|
return CatchResponse::success($log->where('id', '>', 0)->delete(), '清空成功');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -4,22 +4,31 @@ namespace catchAdmin\system\controller;
|
|||||||
use catcher\base\CatchController;
|
use catcher\base\CatchController;
|
||||||
use catcher\CatchResponse;
|
use catcher\CatchResponse;
|
||||||
use think\facade\Db;
|
use think\facade\Db;
|
||||||
|
use catchAdmin\system\model\OperateLog as Log;
|
||||||
|
|
||||||
class OperateLog extends CatchController
|
class OperateLog extends CatchController
|
||||||
{
|
{
|
||||||
public function list()
|
/**
|
||||||
|
*
|
||||||
|
* @time 2020年04月28日
|
||||||
|
* @param Log $log
|
||||||
|
* @throws \think\db\exception\DbException
|
||||||
|
* @return \think\response\Json
|
||||||
|
*/
|
||||||
|
public function list(Log $log)
|
||||||
{
|
{
|
||||||
return CatchResponse::paginate(
|
return CatchResponse::paginate($log->getList());
|
||||||
Db::name('operate_log')
|
|
||||||
->field(['operate_log.*', 'users.username as creator'])
|
|
||||||
->join('users','users.id = operate_log.creator_id')
|
|
||||||
->order('id', 'desc')
|
|
||||||
->paginate(request()->param('limit') ?? 10)
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public function empty()
|
/**
|
||||||
|
*
|
||||||
|
* @time 2020年04月28日
|
||||||
|
* @param Log $log
|
||||||
|
* @throws \Exception
|
||||||
|
* @return \think\response\Json
|
||||||
|
*/
|
||||||
|
public function empty(Log $log)
|
||||||
{
|
{
|
||||||
return CatchResponse::success(Db::name('operate_log')->delete(true), '清空成功');
|
return CatchResponse::success($log->where('id', '>', 0)->delete(), '清空成功');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,7 +1,6 @@
|
|||||||
<?php
|
<?php
|
||||||
namespace catchAdmin\system\model;
|
namespace catchAdmin\system\model;
|
||||||
|
|
||||||
use catcher\base\CatchModel;
|
|
||||||
use catcher\traits\db\BaseOptionsTrait;
|
use catcher\traits\db\BaseOptionsTrait;
|
||||||
|
|
||||||
class LoginLog extends \think\Model
|
class LoginLog extends \think\Model
|
||||||
|
@ -21,4 +21,8 @@ $router->resource('attachments', '\catchAdmin\system\controller\Attachments');
|
|||||||
|
|
||||||
// 配置
|
// 配置
|
||||||
$router->get('config/parent', '\catchAdmin\system\controller\Config@parent');
|
$router->get('config/parent', '\catchAdmin\system\controller\Config@parent');
|
||||||
$router->resource('config', '\catchAdmin\system\controller\Config');
|
$router->resource('config', '\catchAdmin\system\controller\Config');
|
||||||
|
|
||||||
|
// 代码生成
|
||||||
|
$router->post('generate', '\catchAdmin\system\controller\Generate@save');
|
||||||
|
$router->post('generate/preview', '\catchAdmin\system\controller\Generate@preview'); // 预览
|
||||||
|
Loading…
x
Reference in New Issue
Block a user