mirror of
https://github.com/TeaOSLab/EdgeAPI.git
synced 2025-12-25 06:26:35 +08:00
服务访问日志增加今天和历史的访问日志查看
This commit is contained in:
@@ -110,7 +110,7 @@ func (this *HTTPAccessLogDAO) CreateHTTPAccessLogsWithDAO(daoWrapper *HTTPAccess
|
||||
}
|
||||
|
||||
// 读取往前的 单页访问日志
|
||||
func (this *HTTPAccessLogDAO) ListAccessLogs(lastRequestId string, size int64, day string, serverId int64, reverse bool) (result []*HTTPAccessLog, nextLastRequestId string, hasMore bool, err error) {
|
||||
func (this *HTTPAccessLogDAO) ListAccessLogs(lastRequestId string, size int64, day string, serverId int64, reverse bool, hasError bool) (result []*HTTPAccessLog, nextLastRequestId string, hasMore bool, err error) {
|
||||
if len(day) != 8 {
|
||||
return
|
||||
}
|
||||
@@ -120,18 +120,18 @@ func (this *HTTPAccessLogDAO) ListAccessLogs(lastRequestId string, size int64, d
|
||||
size = 1000
|
||||
}
|
||||
|
||||
result, nextLastRequestId, err = this.listAccessLogs(lastRequestId, size, day, serverId, reverse)
|
||||
result, nextLastRequestId, err = this.listAccessLogs(lastRequestId, size, day, serverId, reverse, hasError)
|
||||
if err != nil || int64(len(result)) < size {
|
||||
return
|
||||
}
|
||||
|
||||
moreResult, _, _ := this.listAccessLogs(nextLastRequestId, 1, day, serverId, reverse)
|
||||
moreResult, _, _ := this.listAccessLogs(nextLastRequestId, 1, day, serverId, reverse, hasError)
|
||||
hasMore = len(moreResult) > 0
|
||||
return
|
||||
}
|
||||
|
||||
// 读取往前的单页访问日志
|
||||
func (this *HTTPAccessLogDAO) listAccessLogs(lastRequestId string, size int64, day string, serverId int64, reverse bool) (result []*HTTPAccessLog, nextLastRequestId string, err error) {
|
||||
func (this *HTTPAccessLogDAO) listAccessLogs(lastRequestId string, size int64, day string, serverId int64, reverse bool, hasError bool) (result []*HTTPAccessLog, nextLastRequestId string, err error) {
|
||||
if size <= 0 {
|
||||
return nil, lastRequestId, nil
|
||||
}
|
||||
@@ -177,6 +177,9 @@ func (this *HTTPAccessLogDAO) listAccessLogs(lastRequestId string, size int64, d
|
||||
if serverId > 0 {
|
||||
query.Attr("serverId", serverId)
|
||||
}
|
||||
if hasError {
|
||||
query.Where("status>400")
|
||||
}
|
||||
|
||||
// offset
|
||||
if len(lastRequestId) > 0 {
|
||||
|
||||
@@ -491,7 +491,7 @@ func (this *NodeDAO) ComposeNodeConfig(nodeId int64) (*nodeconfigs.NodeConfig, e
|
||||
|
||||
// 全局设置
|
||||
// TODO 根据用户的不同读取不同的全局设置
|
||||
settingJSON, err := SharedSysSettingDAO.ReadSetting(SettingCodeGlobalConfig)
|
||||
settingJSON, err := SharedSysSettingDAO.ReadSetting(SettingCodeServerGlobalConfig)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
@@ -13,7 +13,9 @@ type SysSettingDAO dbs.DAO
|
||||
type SettingCode = string
|
||||
|
||||
const (
|
||||
SettingCodeGlobalConfig SettingCode = "globalConfig"
|
||||
SettingCodeServerGlobalConfig SettingCode = "serverGlobalConfig" // 服务相关全局设置
|
||||
SettingCodeNodeMonitor SettingCode = "nodeMonitor" // 监控节点状态
|
||||
SettingCodeClusterHealthCheck SettingCode = "clusterHealthCheck" // 集群健康检查
|
||||
)
|
||||
|
||||
func NewSysSettingDAO() *SysSettingDAO {
|
||||
|
||||
Reference in New Issue
Block a user