修改日志列表

This commit is contained in:
JaguarJack
2020-04-28 22:02:50 +08:00
parent 50bcb7e289
commit 08aee72ab9
5 changed files with 63 additions and 16 deletions

View File

@@ -4,22 +4,31 @@ namespace catchAdmin\system\controller;
use catcher\base\CatchController;
use catcher\CatchResponse;
use think\facade\Db;
use catchAdmin\system\model\OperateLog as Log;
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(
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)
);
return CatchResponse::paginate($log->getList());
}
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(), '清空成功');
}
}