Commit 8326e502 by huangchengyi

Merge branch 'dev' of http://119.23.72.7/mushishixian/search_server into dev

parents ffde30a9 63f671fb
...@@ -5,9 +5,9 @@ import ( ...@@ -5,9 +5,9 @@ import (
"github.com/gin-gonic/gin" "github.com/gin-gonic/gin"
"github.com/micro/go-micro/v2/web" "github.com/micro/go-micro/v2/web"
"search_server/boot" "search_server/boot"
"search_server/controller"
_ "search_server/controller" _ "search_server/controller"
"search_server/pkg/config" "search_server/pkg/config"
"search_server/routes"
) )
func main() { func main() {
...@@ -18,12 +18,8 @@ func main() { ...@@ -18,12 +18,8 @@ func main() {
panic(err) panic(err)
} }
gin.SetMode(config.Get("web.mode").String()) gin.SetMode(config.Get("web.mode").String())
r := gin.New()
//路由
r.POST("/search/bom/autospu", controller.AutoSpu)
r.POST("/search/bom/recommend", controller.Recommend)
r := routes.InitRouter()
port := config.Get("web.port").String() port := config.Get("web.port").String()
//web改成micro 就是grpc,并直接注册到etcd里面 //web改成micro 就是grpc,并直接注册到etcd里面
......
package common
//与supplier相关的变量
var SearchSupplier = map[int]string{
1: "uture",
//2:"powerandsignal",
3: "rochester",
4: "tme",
5: "verical",
6: "element14",
7: "digikey",
8: "chip1stop",
9: "aipco",
10: "arrow",
//11:"bisco",
12: "alliedelec",
13: "avnet",
14: "mouser",
//15:"company",
//16:"liexin_lianying1"
17: "zhuanmai",
//18:"liexin_ti",
19: "peigenesis",
20: "powell",
21: "rs",
//22:"liexin_sell",
//100:"ziying",
//101:"liexin_jingdiao",
1676: "buerklin",
}
package routes
import (
"github.com/gin-gonic/gin"
"search_server/controller"
)
//初始化路由
func InitRouter() *gin.Engine {
r := gin.New()
r.Use(gin.Logger())
r.Use(gin.Recovery())
//路由
r.POST("/search/bom/autospu", controller.AutoSpu)
r.POST("/search/bom/recommend", controller.Recommend)
return r
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment