Explorar o código

fix:跳转失败页面

zqbao hai 3 meses
pai
achega
693728b0a6
Modificáronse 1 ficheiros con 18 adicións e 2 borrados
  1. 18 2
      controllers/report_v2.go

+ 18 - 2
controllers/report_v2.go

@@ -1707,8 +1707,24 @@ func (this *ReportCommonController) ShareTransform() {
 		if msg == "" {
 			msg = "获取失败"
 		}
-		br.Msg = msg
-		br.ErrMsg = "获取复制链接失败, Err: " + err.Error()
+
+		htmlTpl := `
+		<!DOCTYPE html>
+		<html lang="zh">
+		<head>
+		    <meta charset="UTF-8">
+		    <title>链接失效</title>
+		</head>
+		<body>
+		    <h1>链接失效</h1>
+		    <p>%s</p>
+		</body>
+		</html>
+		`
+		htmlTpl = fmt.Sprintf(htmlTpl, msg)
+		this.Ctx.Output.SetStatus(404)
+		this.Ctx.Output.Body([]byte(htmlTpl))
+		utils.FileLog.Info("获取复制链接失败, Err: " + err.Error())
 		return
 	}