2
0
mirror of https://github.com/acepanel/panel.git synced 2026-02-04 06:47:20 +08:00

fix: lint

This commit is contained in:
耗子
2024-10-12 18:38:11 +08:00
parent de7dd8834f
commit cab338c4c4
5 changed files with 9 additions and 38 deletions

View File

@@ -138,12 +138,7 @@ func (s *Service) Load(w http.ResponseWriter, r *http.Request) {
// ErrorLog 获取错误日志
func (s *Service) ErrorLog(w http.ResponseWriter, r *http.Request) {
log, err := shell.Execf("tail -n 100 %s/server/mysql/mysql-error.log", app.Root)
if err != nil {
service.Error(w, http.StatusInternalServerError, "%v", err)
return
}
log, _ := shell.Execf("tail -n 100 %s/server/mysql/mysql-error.log", app.Root)
service.Success(w, log)
}
@@ -159,12 +154,7 @@ func (s *Service) ClearErrorLog(w http.ResponseWriter, r *http.Request) {
// SlowLog 获取慢查询日志
func (s *Service) SlowLog(w http.ResponseWriter, r *http.Request) {
log, err := shell.Execf("tail -n 100 %s/server/mysql/mysql-slow.log", app.Root)
if err != nil {
service.Error(w, http.StatusInternalServerError, "%v", err)
return
}
log, _ := shell.Execf("tail -n 100 %s/server/mysql/mysql-slow.log", app.Root)
service.Success(w, log)
}

View File

@@ -58,16 +58,12 @@ func (s *Service) SaveConfig(w http.ResponseWriter, r *http.Request) {
}
func (s *Service) ErrorLog(w http.ResponseWriter, r *http.Request) {
if !io.Exists(fmt.Sprintf("%s/wwwlogs/nginx_error.log", app.Root)) {
service.Success(w, "")
}
out, _ := shell.Execf("tail -n 100 %s/%s", app.Root, "wwwlogs/openresty_error.log")
out, _ := shell.Execf("tail -n 100 %s/%s", app.Root, "wwwlogs/openresty-error.log")
service.Success(w, out)
}
func (s *Service) ClearErrorLog(w http.ResponseWriter, r *http.Request) {
if _, err := shell.Execf("echo '' > %s/%s", app.Root, "wwwlogs/openresty_error.log"); err != nil {
if _, err := shell.Execf("echo '' > %s/%s", app.Root, "wwwlogs/openresty-error.log"); err != nil {
service.Error(w, http.StatusInternalServerError, "%v", err)
return
}

View File

@@ -132,12 +132,7 @@ func (s *Service) Load(w http.ResponseWriter, r *http.Request) {
// Log 获取日志
func (s *Service) Log(w http.ResponseWriter, r *http.Request) {
log, err := shell.Execf("tail -n 100 %s/server/postgresql/logs/postgresql-%s.log", app.Root, time.Now().Format(time.DateOnly))
if err != nil {
service.Error(w, http.StatusInternalServerError, "%v", err)
return
}
log, _ := shell.Execf("tail -n 100 %s/server/postgresql/logs/postgresql-%s.log", app.Root, time.Now().Format(time.DateOnly))
service.Success(w, log)
}

View File

@@ -104,7 +104,7 @@ func (s *Service) Create(w http.ResponseWriter, r *http.Request) {
}
if mountCheck, err := shell.Execf("mount -a"); err != nil {
_, _ = shell.Execf(`sed -i 's@^s3fs#%s\s%s.*$@@g' /etc/fstab`, req.Bucket, req.Path)
service.Error(w, http.StatusInternalServerError, "/etc/fstab 有误: "+mountCheck)
service.Error(w, http.StatusInternalServerError, "/etc/fstab有误%s", mountCheck)
return
}
if _, err := shell.Execf(`df -h | grep '%s'`, req.Path); err != nil {
@@ -177,7 +177,7 @@ func (s *Service) Delete(w http.ResponseWriter, r *http.Request) {
return
}
if mountCheck, err := shell.Execf("mount -a"); err != nil {
service.Error(w, http.StatusInternalServerError, "/etc/fstab 有误: "+mountCheck)
service.Error(w, http.StatusInternalServerError, "/etc/fstab有误%s", mountCheck)
return
}
if err = io.Remove("/etc/passwd-s3fs-" + cast.ToString(mount.ID)); err != nil {

View File

@@ -39,12 +39,7 @@ func (s *Service) Service(w http.ResponseWriter, r *http.Request) {
// Log 日志
func (s *Service) Log(w http.ResponseWriter, r *http.Request) {
log, err := shell.Execf(`tail -n 200 /var/log/supervisor/supervisord.log`)
if err != nil {
service.Error(w, http.StatusInternalServerError, log)
return
}
log, _ := shell.Execf(`tail -n 200 /var/log/supervisor/supervisord.log`)
service.Success(w, log)
}
@@ -210,12 +205,7 @@ func (s *Service) ProcessLog(w http.ResponseWriter, r *http.Request) {
return
}
log, err := shell.Execf(`tail -n 200 '%s'`, logPath)
if err != nil {
service.Error(w, http.StatusInternalServerError, log)
return
}
log, _ := shell.Execf(`tail -n 200 '%s'`, logPath)
service.Success(w, log)
}