修改日志列表
This commit is contained in:
@@ -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(), '清空成功');
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user