实现点击访问日志显示详情窗口

This commit is contained in:
GoEdgeLab
2020-11-02 21:15:31 +08:00
parent cd1109b387
commit 613eebf195
4 changed files with 145 additions and 6 deletions

View File

@@ -59,3 +59,25 @@ func (this *HTTPAccessLogService) ListHTTPAccessLogs(ctx context.Context, req *p
RequestId: requestId,
}, nil
}
// 查找单个日志
func (this *HTTPAccessLogService) FindHTTPAccessLog(ctx context.Context, req *pb.FindHTTPAccessLogRequest) (*pb.FindHTTPAccessLogResponse, error) {
// 校验请求
_, _, err := rpcutils.ValidateRequest(ctx, rpcutils.UserTypeAdmin)
if err != nil {
return nil, err
}
accessLog, err := models.SharedHTTPAccessLogDAO.FindAccessLogWithRequestId(req.RequestId)
if err != nil {
return nil, err
}
if accessLog == nil {
return &pb.FindHTTPAccessLogResponse{AccessLog: nil}, nil
}
a, err := accessLog.ToPB()
if err != nil {
return nil, err
}
return &pb.FindHTTPAccessLogResponse{AccessLog: a}, nil
}