作者 陈志颖

fix:添加日志id

@@ -2,9 +2,21 @@ package routers @@ -2,9 +2,21 @@ package routers
2 2
3 import ( 3 import (
4 "github.com/astaxie/beego" 4 "github.com/astaxie/beego"
  5 + "github.com/astaxie/beego/context"
5 "gitlab.fjmaimaimai.com/mmm-go/partner/pkg/constant" 6 "gitlab.fjmaimaimai.com/mmm-go/partner/pkg/constant"
  7 + "net/http"
6 ) 8 )
7 9
8 func init() { 10 func init() {
9 - beego.SetStaticPath("/log", constant.LOG_File) 11 + //beego.SetStaticPath("/log", constant.LOG_File)
  12 + beego.Get("/log", func(ctx *context.Context) {
  13 + var s string
  14 + _ = ctx.Input.Bind(&s, "id")
  15 + if s != "12345" {
  16 + ctx.Output.SetStatus(http.StatusBadRequest)
  17 + return
  18 + }
  19 + http.ServeFile(ctx.ResponseWriter, ctx.Request, constant.LOG_File)
  20 + return
  21 + })
10 } 22 }