From c6b1cadc0214c6791a5c5bcc62ab57601e38f457 Mon Sep 17 00:00:00 2001 From: liuxiaolong <liuxiaolong@aiotlink.com> Date: 星期四, 13 八月 2020 11:31:08 +0800 Subject: [PATCH] add db restriction --- routers/router.go | 25 +++++++------------------ 1 files changed, 7 insertions(+), 18 deletions(-) diff --git a/routers/router.go b/routers/router.go index 0a88743..fa29e7c 100644 --- a/routers/router.go +++ b/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" @@ -59,16 +56,8 @@ beego.Router(preApi+"/user/delPlateNo", &controllers.UserController{}, "*:DelPlateNo") beego.Router(preApi+"/user/all", &controllers.UserController{}, "*:GetUserAll") -} + beego.Router(preApi+"/user/sync", &controllers.UserController{}, "*:Sync") -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) -} \ No newline at end of file + beego.Router(preApi+"/car/crossRecord", &controllers.CarController{}, "*:CrossRecord") + beego.Router(preApi+"/car/testPush", &controllers.CarController{}, "*:TestPush") +} -- Gitblit v1.8.0