(c *gin.Context, resType string)
| 96 | } |
| 97 | |
| 98 | func HandleNotSecurity(c *gin.Context, resType string) { |
| 99 | code := LoadErrCode() |
| 100 | if code == 444 { |
| 101 | CloseDirectly(c) |
| 102 | return |
| 103 | } |
| 104 | |
| 105 | file := fmt.Sprintf("html/%d.html", code) |
| 106 | if code == http.StatusOK && resType != "" { |
| 107 | file = fmt.Sprintf("html/200_%s.html", resType) |
| 108 | } |
| 109 | data, err := res.ErrorMsg.ReadFile(file) |
| 110 | if err != nil { |
| 111 | c.String(http.StatusInternalServerError, "Internal Server Error") |
| 112 | return |
| 113 | } |
| 114 | c.Data(code, "text/html; charset=utf-8", data) |
| 115 | } |
| 116 | |
| 117 | func LoadErrCode() int { |
| 118 | settingRepo := repo.NewISettingRepo() |
no test coverage detected