static_router.go 482 字节
package routers

import (
	"github.com/astaxie/beego"
	"github.com/astaxie/beego/context"
	"gitlab.fjmaimaimai.com/mmm-go/partner/pkg/constant"
	"net/http"
)

func init() {
	//beego.SetStaticPath("/log", constant.LOG_File)
	beego.Get("/log", func(ctx *context.Context) {
		var s string
		_ = ctx.Input.Bind(&s, "id")
		if s != "12345" {
			ctx.Output.SetStatus(http.StatusBadRequest)
			return
		}
		http.ServeFile(ctx.ResponseWriter, ctx.Request, constant.LOG_File)
		return
	})
}