From e47516cd15735bf9650c4cbbe34bc92a1afb8b68 Mon Sep 17 00:00:00 2001 From: TossPig Date: Thu, 20 Nov 2014 02:14:04 +0800 Subject: [PATCH] =?UTF-8?q?=E8=A1=A5=E4=B8=8ABasePath?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 还有个根路径 --- g_docs.go | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/g_docs.go b/g_docs.go index 1e3076a..04c0400 100644 --- a/g_docs.go +++ b/g_docs.go @@ -44,17 +44,17 @@ import ( "github.com/astaxie/beego" "github.com/astaxie/beego/swagger" ) + const ( Rootinfo string = {{.rootinfo}} Subapi string = {{.subapi}} + BasePath string= "{{.version}}" ) var rootapi swagger.ResourceListing - var apilist map[string]*swagger.ApiDeclaration func init() { - basepath := "{{.version}}" err := json.Unmarshal([]byte(Rootinfo), &rootapi) if err != nil { beego.Error(err) @@ -69,7 +69,7 @@ func init() { a.Path = urlReplace(k + a.Path) v.Apis[i] = a } - v.BasePath = basepath + v.BasePath = BasePath beego.GlobalDocApi[strings.Trim(k, "/")] = v } }