Commit 4714c1e0 by mushishixian

优化

parent 3f5b1808
...@@ -9,6 +9,7 @@ import ( ...@@ -9,6 +9,7 @@ import (
func Cors() gin.HandlerFunc { func Cors() gin.HandlerFunc {
corsDomain := config.Get("web.cors_domain").Strings(",") corsDomain := config.Get("web.cors_domain").Strings(",")
corsDomain = append(corsDomain, "https://bom.ichunt.com")
return cors.New(cors.Config{ return cors.New(cors.Config{
AllowOrigins: corsDomain, AllowOrigins: corsDomain,
AllowMethods: []string{"POST", "GET", "PUT", "DELETE"}, AllowMethods: []string{"POST", "GET", "PUT", "DELETE"},
......
...@@ -170,7 +170,7 @@ func getBomTermQuery(goodsName, brandName string, number int, isRawSearch bool) ...@@ -170,7 +170,7 @@ func getBomTermQuery(goodsName, brandName string, number int, isRawSearch bool)
if isRawSearch { if isRawSearch {
source.Size(100) source.Size(100)
} else { } else {
source.Size(1) source.Size(50)
} }
source.Sort("_score", false).Sort("sort", false).Sort("single_price", true) source.Sort("_score", false).Sort("sort", false).Sort("single_price", true)
queryRequest := elastic.NewSearchRequest().Source(source) queryRequest := elastic.NewSearchRequest().Source(source)
......
package service package service
import ( import (
"fmt"
"github.com/gomodule/redigo/redis" "github.com/gomodule/redigo/redis"
"github.com/imroc/req" "github.com/imroc/req"
"github.com/tidwall/gjson" "github.com/tidwall/gjson"
...@@ -238,7 +237,6 @@ func GetGoodsIdsByEs(res string) (goodsIds []string) { ...@@ -238,7 +237,6 @@ func GetGoodsIdsByEs(res string) (goodsIds []string) {
for _, item := range gjArray { for _, item := range gjArray {
goodsIds = append(goodsIds, item.String()) goodsIds = append(goodsIds, item.String())
} }
fmt.Println(goodsIds)
return return
} }
...@@ -248,6 +246,5 @@ func GetGoodsIdsByEsMsearch(res string) (goodsIds []string) { ...@@ -248,6 +246,5 @@ func GetGoodsIdsByEsMsearch(res string) (goodsIds []string) {
for _, item := range gjArray { for _, item := range gjArray {
goodsIds = append(goodsIds, item.String()) goodsIds = append(goodsIds, item.String())
} }
fmt.Println(goodsIds)
return return
} }
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