liuxiaolong
2020-07-30 0ec1b163ed54bdf61d4e953e9fca894e8bd9b71a
routers/router.go
@@ -9,13 +9,10 @@
import (
   "car-service/controllers"
   "car-service/extend/util"
   "fmt"
   "github.com/astaxie/beego/plugins/cors"
   "os"
   "os/exec"
   "path/filepath"
   "github.com/astaxie/beego"
   "github.com/astaxie/beego/plugins/cors"
)
func init() {
@@ -43,7 +40,7 @@
   //)
   //beego.AddNamespace(ns)
   //beego.Router("/basic/api/car/app/user", &controllers.UserController{})
   rootPath := getAppRootPath()
   rootPath := util.GetAppRootPath()
   fmt.Println("rootPath:", rootPath)
   beego.SetStaticPath("/download", rootPath+"/download")
   preApi := "/basic/api"
@@ -60,15 +57,3 @@
   beego.Router(preApi+"/user/all", &controllers.UserController{}, "*:GetUserAll")
}
func getAppRootPath() string {
   file,err:= exec.LookPath(os.Args[0])
   if err != nil {
      return ""
   }
   p, err := filepath.Abs(file)
   if err != nil {
      return ""
   }
   return filepath.Dir(p)
}