该系统为使用PHP开发的基于web的Subversion(SVN)服务器端管理工具。支持功能:SVN仓库管理、SVN用户管理、SVN分组管理、目录授权、目录浏览、Hooks管理、在线dump备份、在线备份恢复、SVN用户禁用、服务器状态管理、日志管理、消息通知、更新检测...
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 

92 lines
2.2 KiB

<?php
/*
* @Author: witersen
* @Date: 2022-04-24 23:37:05
* @LastEditors: witersen
* @LastEditTime: 2022-05-06 21:37:57
* @Description: QQ:1801168257
*/
namespace app\service;
class Logs extends Base
{
function __construct()
{
parent::__construct();
}
/**
* 获取日志列表
*/
public function GetLogList()
{
$pageSize = $this->payload['pageSize'];
$currentPage = $this->payload['currentPage'];
$searchKeyword = trim($this->payload['searchKeyword']);
//分页
$begin = $pageSize * ($currentPage - 1);
$list = $this->database->select('logs', [
'log_id',
'log_type_name',
'log_content',
'log_add_user_name',
'log_add_time',
], [
'AND' => [
'OR' => [
'log_type_name[~]' => $searchKeyword,
'log_content[~]' => $searchKeyword,
'log_add_user_name[~]' => $searchKeyword,
'log_add_time[~]' => $searchKeyword,
],
],
'LIMIT' => [$begin, $pageSize]
]);
$total = $this->database->count('logs', [
'log_id'
], [
'AND' => [
'OR' => [
'log_type_name[~]' => $searchKeyword,
'log_content[~]' => $searchKeyword,
'log_add_user_name[~]' => $searchKeyword,
'log_add_time[~]' => $searchKeyword,
],
]
]);
return message(200, 1, '成功', [
'data' => $list,
'total' => $total
]);
}
/**
* 清空日志
*/
public function ClearLogs()
{
$this->database->delete('logs', [
'log_id[>]' => 0
]);
return message();
}
/**
* 写入日志
*/
public function InsertLog($log_type_name = '', $log_content = '', $log_add_user_name = '')
{
$this->database->insert('logs', [
'log_type_name' => $log_type_name,
'log_content' => $log_content,
'log_add_user_name' => $log_add_user_name,
'log_add_time' => date('Y-m-d H:i:s')
]);
}
}