Commit 9623f3c8 by huangchengyi

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

# Conflicts:
#	service/mouser_service.go
parents 0f0554dd 349b9c68
...@@ -12,15 +12,14 @@ import ( ...@@ -12,15 +12,14 @@ import (
func main() { func main() {
var path string var path string
flag.StringVar(&path, "config", "conf/config.ini", "配置文件") flag.StringVar(&path, "config", "conf", "配置文件")
flag.Parse() flag.Parse()
if err := boot.Boot(path); err != nil { if err := boot.Boot(path); err != nil {
panic(err) panic(err)
} }
gin.SetMode(config.Get("web.mode").String())
gin.SetMode(config.Get("web.mode").String())
r := routes.InitRouter() r := routes.InitRouter()
port := config.Get("web.port").String() port := config.Get("web.port").String()
//web改成micro 就是grpc,并直接注册到etcd里面 //web改成micro 就是grpc,并直接注册到etcd里面
service := web.NewService( service := web.NewService(
......
...@@ -5,3 +5,8 @@ ...@@ -5,3 +5,8 @@
[common] [common]
'MOUSER_API'='http://footstone.liexin.net/webapi/handle_mouser' 'MOUSER_API'='http://footstone.liexin.net/webapi/handle_mouser'
[brand]
is_not_ti = 0
ti_ly_brand_ids=23,45069,7754,17484,43215,13421,5220,7636,44534,43556,44543,9429,758,9470,10430,10653,10707,11227,11276,11819,12608,12965,12997,13327,13675,13680,13752
ti_zy_brand_ids=23
\ No newline at end of file
...@@ -19,7 +19,7 @@ func init() { ...@@ -19,7 +19,7 @@ func init() {
func MouserGetData(c *service.MouserServiceImpl) gin_.Endpoint { func MouserGetData(c *service.MouserServiceImpl) gin_.Endpoint {
return func(context *gin.Context, request interface{}) (response interface{}, err error) { return func(context *gin.Context, request interface{}) (response interface{}, err error) {
rsp := &mouser.MouserResponse{} rsp := &mouser.MouserResponse{}
err = c.MouserGetData(context, request.(*mouser.MouserRequest), rsp) //err = c.MouserGetData(context, request.(*mouser.MouserRequest), rsp)
return rsp, err return rsp, err
} }
} }
......
package model
import (
"search_server/pkg/config"
)
//获取需要排除的品牌id
//branType = 1 : 联营 2 : 自营
func GetExcludeBrandIds(brandType int) (excludeBrandIds []int) {
isNoTi := config.Get("brand.is_not_ti").String()
//如果关闭,直接返回空数据
if isNoTi == "1" {
return
}
//返回联营的brand_id切片
if brandType == 1 {
tiLyBrandIds := config.Get("brand.ti_ly_brand_ids").Ints(",")
excludeBrandIds = tiLyBrandIds
//获取的是字符串
return
}
//返回自营的ti的brand_id切片
tiZyBrandId := config.Get("brand.ti_zy_brand_ids").Ints(",")
excludeBrandIds = tiZyBrandId
return
}
...@@ -10,7 +10,8 @@ var ( ...@@ -10,7 +10,8 @@ var (
) )
func SetUp(path string) (err error) { func SetUp(path string) (err error) {
cfg, err = ini.Load(path) //引入多个文件
cfg, err = ini.LooseLoad(path+"/config.ini", path+"/search.ini")
return return
} }
......
package main package main
import (
"flag"
"fmt"
"search_server/boot"
"search_server/model"
)
func main() { func main() {
//var path string var path string
//flag.StringVar(&path, "config", "conf/config.ini", "配置文件") flag.StringVar(&path, "configPath", "conf", "配置文件")
//flag.Parse() flag.Parse()
//if err := boot.Boot(path); err != nil { if err := boot.Boot(path); err != nil {
// log.Error("%s", err) fmt.Println(err)
//} }
fmt.Println(model.GetExcludeBrandIds(1))
//client := client. //client := client.
//c := course.NewCourseService("go.micro.api.jtthink.course", client) //c := course.NewCourseService("go.micro.api.jtthink.course", client)
//course_rsp, _ := c.ListForTop(context.TODO(), &course.ListRequest{Size: 10}) //course_rsp, _ := c.ListForTop(context.TODO(), &course.ListRequest{Size: 10})
......
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