Commit 4714c1e0 by mushishixian

优化

parent 3f5b1808
......@@ -9,6 +9,7 @@ import (
func Cors() gin.HandlerFunc {
corsDomain := config.Get("web.cors_domain").Strings(",")
corsDomain = append(corsDomain, "https://bom.ichunt.com")
return cors.New(cors.Config{
AllowOrigins: corsDomain,
AllowMethods: []string{"POST", "GET", "PUT", "DELETE"},
......
......@@ -170,7 +170,7 @@ func getBomTermQuery(goodsName, brandName string, number int, isRawSearch bool)
if isRawSearch {
source.Size(100)
} else {
source.Size(1)
source.Size(50)
}
source.Sort("_score", false).Sort("sort", false).Sort("single_price", true)
queryRequest := elastic.NewSearchRequest().Source(source)
......
package service
import (
"fmt"
"github.com/gomodule/redigo/redis"
"github.com/imroc/req"
"github.com/tidwall/gjson"
......@@ -122,11 +121,11 @@ func CurlGoodsInfo(goodsIdsStr string, params req.Param) (goodsList []model.ApiG
ladderPrice := make([]model.LadderPrice, 0)
for _, price := range data.Get("ladder_price").Array() {
ladder := model.LadderPrice{
Purchases: int(price.Get("purchases").Int()),
Purchases: int(price.Get("purchases").Int()),
PurchasesStr: int(price.Get("purchases").Int()),
PriceUs: price.Get("price_us").Float(),
PriceCn: price.Get("price_cn").Float(),
PriceAc: price.Get("price_ac").Float(),
PriceUs: price.Get("price_us").Float(),
PriceCn: price.Get("price_cn").Float(),
PriceAc: price.Get("price_ac").Float(),
}
ladderPrice = append(ladderPrice, ladder)
}
......@@ -238,7 +237,6 @@ func GetGoodsIdsByEs(res string) (goodsIds []string) {
for _, item := range gjArray {
goodsIds = append(goodsIds, item.String())
}
fmt.Println(goodsIds)
return
}
......@@ -248,6 +246,5 @@ func GetGoodsIdsByEsMsearch(res string) (goodsIds []string) {
for _, item := range gjArray {
goodsIds = append(goodsIds, item.String())
}
fmt.Println(goodsIds)
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