增加标准品牌

parent 82d4f74f
......@@ -4,7 +4,7 @@ mode = debug
[spu]
user_name = spu
password = spu
host = 192.168.1.234
host = 192.168.1.238
database = liexin_spu
table_prefix =lie_
type = mysql
......
;存放es配置
[es]
url = http://192.168.1.234:9200
urls = http://192.168.1.234:9200,http://192.168.1.234:9200
url = http://192.168.1.237:9200
urls = http://192.168.1.237:9200,http://192.168.1.237:9200
index_name = future,rochester,tme,verical,element14,digikey,chip1stop,aipco,arrow,alliedelec,avnet,mouser,zhuanmai,peigenesis,powell,rs,buerklin,liexin_ziying
search_supplier = future,rochester,tme,verical,element14,digikey,chip1stop,aipco,arrow,alliedelec,avnet,mouser,peigenesis,powell,rs,buerklin,zhuanmai
hk_delivery_type_supplier = future,rochester,tme,verical,element14,digikey,chip1stop,aipco,arrow,alliedelec,avnet,mouser,peigenesis,powell,rs,buerklin
......
;redis连接信息
[default_redis_read]
host = 192.168.1.235:6379
host = 192.168.1.234:6379
password = icDb29mLy2s
max_idle = 500
max_active = 500
idle_timeout = 20
[default_redis_write]
host = 192.168.1.235:6379
host = 192.168.1.234:6379
password = icDb29mLy2s
max_idle = 500
max_active = 500
idle_timeout = 20
[api_redis]
host = 192.168.1.235:6379
host = 192.168.1.234:6379
password = icDb29mLy2s
max_idle = 50
max_active = 100
......
......@@ -14,6 +14,8 @@ type ApiGoods struct {
Mpq int `json:"-"`
MpqStr interface{} `json:"mpq"`
Mpl int `json:"-"`
StandardBrandName string `json:"standard_brand_name"`
StandardBrandUrl string `json:"standard_brand_url"`
MplStr interface{} `json:"mpl,omitempty"`
Stock int `json:"-"`
StockStr interface{} `json:"stock"`
......
......@@ -14,7 +14,7 @@ import (
)
//获取商品信息,需要传入userId用于判断是否登陆
func GetGoodsInfo(ctx *gin.Context,goodsIds []string) (goodsList []model.ApiGoods, err error) {
func GetGoodsInfo(ctx *gin.Context, goodsIds []string) (goodsList []model.ApiGoods, err error) {
var userIdStr string
userIdStr, _ = ctx.Cookie("Yo4teW_uid")
userId, _ := strconv.Atoi(userIdStr)
......@@ -26,26 +26,26 @@ func GetGoodsInfo(ctx *gin.Context,goodsIds []string) (goodsList []model.ApiGood
"power[member]": isMember,
}
common.PrintDebugHtml(ctx,params)
common.PrintDebugHtml(ctx, params)
goodsList, _, err = CurlGoodsInfo(ctx,goodsIdsStr, params)
goodsList, _, err = CurlGoodsInfo(ctx, goodsIdsStr, params)
common.PrintDebugHtml(ctx,goodsList)
common.PrintDebugHtml(ctx, goodsList)
return
}
//获取商品信息
func GetGoodsInfoByApi(ctx *gin.Context,goodsIdsStr string) (goodsList []model.ApiGoods, err error) {
func GetGoodsInfoByApi(ctx *gin.Context, goodsIdsStr string) (goodsList []model.ApiGoods, err error) {
params := req.Param{
"goods_id": goodsIdsStr,
}
goodsList, _, err = CurlGoodsInfo(ctx,goodsIdsStr, params)
goodsList, _, err = CurlGoodsInfo(ctx, goodsIdsStr, params)
return
}
//isMap:是否以字典形式返回值,默认是数组
func CurlGoodsInfo(ctx *gin.Context,goodsIdsStr string, params req.Param) (goodsList []model.ApiGoods, goodsListMap map[string]model.ApiGoods, err error) {
func CurlGoodsInfo(ctx *gin.Context, goodsIdsStr string, params req.Param) (goodsList []model.ApiGoods, goodsListMap map[string]model.ApiGoods, err error) {
goodsIdList := strings.Split(goodsIdsStr, ",")
if len(goodsIdList) == 0 {
return
......@@ -54,14 +54,14 @@ func CurlGoodsInfo(ctx *gin.Context,goodsIdsStr string, params req.Param) (goods
var goodsServerUrl string
if len(goodsIdList[0]) > 7 {
goodsServerUrl = config.Get("goods.api_url").String()
}else{
} else {
goodsServerUrl = config.Get("goods.sz_api_url").String()
}
resp, err := req.Post(goodsServerUrl+"/synchronization", params)
common.PrintDebugHtml(ctx,goodsServerUrl+"/synchronization") //debug
common.PrintDebugHtml(ctx,params) //debug
common.PrintDebugHtml(ctx,resp.String()) //debug
common.PrintDebugHtml(ctx, goodsServerUrl+"/synchronization") //debug
common.PrintDebugHtml(ctx, params) //debug
common.PrintDebugHtml(ctx, resp.String()) //debug
if err != nil {
return
......@@ -76,6 +76,17 @@ func CurlGoodsInfo(ctx *gin.Context,goodsIdsStr string, params req.Param) (goods
//还要去判断是否是false,因为商品服务可能返回 "1000":false 这样子的形式
if data.IsObject() {
var goods model.ApiGoods
//todo 2023.1.10 标准品牌
standard_brand := data.Get("standard_brand").String()
standard_brand_name := gjson.Get(standard_brand, "brand_name").String()
if standard_brand_name != "" {
goods.StandardBrandName = standard_brand_name
goods.StandardBrandUrl = "https://ly.ichunt.com/brand/" + gjson.Get(standard_brand, "standard_brand_id").String() + ".html"
} else {
goods.StandardBrandName = ""
goods.StandardBrandUrl = ""
}
goods.PickType = int(data.Get("pick_type").Int())
goods.BarCode = data.Get("bar_code").String()
goods.GoodsId = data.Get("goods_id").String()
......
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