style: 错误信息英文返回-framework模块

This commit is contained in:
TsMask
2023-11-08 15:00:05 +08:00
parent 267a13d3d6
commit 81138b8c22
9 changed files with 28 additions and 21 deletions

View File

@@ -42,14 +42,16 @@ func referer(c *gin.Context) {
referer := c.GetHeader("Referer")
if referer == "" {
c.AbortWithStatusJSON(200, result.ErrMsg("无效 Referer 未知"))
// 无效 Referer 未知
c.AbortWithStatusJSON(200, result.ErrMsg("Invalid referer unknown"))
return
}
// 获取host
u, err := url.Parse(referer)
if err != nil {
c.AbortWithStatusJSON(200, result.ErrMsg("无效 Referer 未知"))
// 无效 Referer 未知
c.AbortWithStatusJSON(200, result.ErrMsg("Invalid referer unknown"))
return
}
host := u.Host
@@ -70,7 +72,8 @@ func referer(c *gin.Context) {
}
}
if !ok {
c.AbortWithStatusJSON(200, result.ErrMsg("无效 Referer "+host))
// 无效 Referer
c.AbortWithStatusJSON(200, result.ErrMsg("Invalid referer "+host))
return
}
}