日志搜索添加路径和IP搜索

This commit is contained in:
sugar1569 2019-01-26 11:53:04 +08:00
parent c56a0f47d9
commit 617cca0dda
2 changed files with 11 additions and 4 deletions

View File

@ -84,6 +84,8 @@ class SystemLog extends ModelBasic
$model = new self;
$model = $model->alias('l');
if($where['pages'] !== '') $model = $model->where('l.page','LIKE',"%$where[pages]%");
if($where['path'] !== '') $model = $model->where('l.path','LIKE',"%$where[path]%");
if($where['ip'] !== '') $model = $model->where('l.ip','LIKE',"%$where[ip]%");
if($where['admin_id'] != '')
$adminIds = $where['admin_id'];
else
@ -99,13 +101,11 @@ class SystemLog extends ModelBasic
return self::page($model,$where);
}
/**
* @day
* 删除超过90天的日志
*/
public static function deleteLog($day = 90){
public static function deleteLog(){
$model = new self;
$times = $day*86400;
$model->where('add_time','<',time()-$times);
$model->where('add_time','<',time()-7776000);
$model->delete();
}
}

View File

@ -24,6 +24,12 @@
</div>
<div class="input-group">
<input type="text" name="pages" value="{$where.pages}" placeholder="请输入行为" class="input-sm form-control"> <span class="input-group-btn">
</div>
<div class="input-group">
<input type="text" name="path" value="{$where.path}" placeholder="请输入链接" class="input-sm form-control"> <span class="input-group-btn">
</div>
<div class="input-group">
<input type="text" name="ip" value="{$where.ip}" placeholder="请输入ip" class="input-sm form-control"> <span class="input-group-btn">
<button type="submit" class="btn btn-sm btn-primary"><i class="fa fa-search" ></i> 搜索</button> </span>
</div>
</form>
@ -42,6 +48,7 @@
<th class="text-center">操作时间</th>
</tr>
</thead>
<tbody class="">
{volist name="list" id="vo"}
<tr>