liuxiaolong
2020-08-06 dbc843d0b37f786fb816131bcc7ebca86dbe72e9
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,9 +40,9 @@
   //)
   //beego.AddNamespace(ns)
   //beego.Router("/basic/api/car/app/user", &controllers.UserController{})
   rootPath := getAppRootPath()
   rootPath := util.GetAppRootPath()
   fmt.Println("rootPath:", rootPath)
   beego.SetStaticPath("/download", "/data3/workspace/liuxiaolong/car-service/download")
   beego.SetStaticPath("/download", rootPath+"/download")
   preApi := "/basic/api"
   beego.Router(preApi+"/car/statistic", &controllers.CarController{}, "*:Statistic")
   beego.Router(preApi+"/car/spaceNo", &controllers.CarController{}, "*:SpaceNo")
@@ -59,16 +56,6 @@
   beego.Router(preApi+"/user/delPlateNo", &controllers.UserController{}, "*:DelPlateNo")
   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)
}
   beego.Router(preApi+"/car/crossRecord", &controllers.CarController{}, "*:CrossRecord")
}