2021-01-30 20:59:12 +08:00
|
|
|
|
<?php
|
2021-07-26 17:41:59 +08:00
|
|
|
|
/**
|
|
|
|
|
* @copyright Copyright (c) 2021 勾股工作室
|
2021-11-24 17:17:29 +08:00
|
|
|
|
* @license https://opensource.org/licenses/Apache-2.0
|
2021-07-26 17:41:59 +08:00
|
|
|
|
* @link https://www.gougucms.com
|
|
|
|
|
*/
|
|
|
|
|
|
2021-02-25 11:36:14 +08:00
|
|
|
|
declare (strict_types = 1);
|
2021-01-30 20:59:12 +08:00
|
|
|
|
namespace app\admin\model;
|
2022-08-25 17:13:28 +08:00
|
|
|
|
use dateset\Dateset;
|
2021-01-30 20:59:12 +08:00
|
|
|
|
use think\Model;
|
|
|
|
|
|
|
|
|
|
class AdminLog extends Model
|
|
|
|
|
{
|
|
|
|
|
public function get_log_list($param = [])
|
|
|
|
|
{
|
|
|
|
|
$where = array();
|
|
|
|
|
if (!empty($param['no_delete'])) {
|
|
|
|
|
$where['type'] = ['neq', 'delete']; //过滤删除操作
|
|
|
|
|
}
|
|
|
|
|
if (!empty($param['no_admin'])) {
|
|
|
|
|
$where['uid'] = ['neq', 1]; //超级管理员删除操作
|
|
|
|
|
}
|
|
|
|
|
if (!empty($param['uid'])) {
|
|
|
|
|
$where['uid'] = $param['uid']; //查询指定用户的操作
|
|
|
|
|
}
|
|
|
|
|
$where['status'] = 1;
|
|
|
|
|
$rows = empty($param['limit']) ? get_config('app.pages') : $param['limit'];
|
2021-07-26 17:41:59 +08:00
|
|
|
|
$content = \think\facade\Db::name('AdminLog')
|
2021-06-15 01:09:01 +08:00
|
|
|
|
->field("id,uid,nickname,type,title,module,controller,function,param,content,create_time")
|
2021-01-30 20:59:12 +08:00
|
|
|
|
->order('create_time desc')
|
|
|
|
|
->where($where)
|
|
|
|
|
->paginate($rows, false, ['query' => $param]);
|
2022-08-25 17:13:28 +08:00
|
|
|
|
|
|
|
|
|
$content->toArray();
|
|
|
|
|
$date_set = new Dateset();
|
2021-01-30 20:59:12 +08:00
|
|
|
|
foreach ($content as $k => $v) {
|
|
|
|
|
$data = $v;
|
|
|
|
|
$param_array = json_decode($v['param'], true);
|
2021-02-25 11:36:14 +08:00
|
|
|
|
$name = '';
|
|
|
|
|
if (!empty($param_array['name'])) {
|
2021-07-26 17:41:59 +08:00
|
|
|
|
$name = ':' . $param_array['name'];
|
2021-01-30 20:59:12 +08:00
|
|
|
|
}
|
2021-02-25 11:36:14 +08:00
|
|
|
|
if (!empty($param_array['title'])) {
|
2021-07-26 17:41:59 +08:00
|
|
|
|
$name = ':' . $param_array['title'];
|
2021-01-30 20:59:12 +08:00
|
|
|
|
}
|
2021-06-15 01:09:01 +08:00
|
|
|
|
$data['content'] = $v['content'] . $name;
|
2022-08-25 17:13:28 +08:00
|
|
|
|
$data['times'] = $date_set->time_trans($v['create_time']);
|
2021-01-30 20:59:12 +08:00
|
|
|
|
$content->offsetSet($k, $data);
|
|
|
|
|
}
|
|
|
|
|
return $content;
|
|
|
|
|
}
|
|
|
|
|
}
|