增加标准品牌

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
......
package model
type ApiGoods struct {
PickType int `json:"pick_type,omitempty"`
BarCode string `json:"barcode,omitempty"`
GoodsId string `json:"goods_id"`
GoodsName string `json:"goods_name"`
GoodsSn string `json:"goods_sn"`
GoodsType int `json:"goods_type"`
GoodsStatus int `json:"goods_status"`
SupplierId int `json:"supplier_id"`
Moq int `json:"-"`
MoqStr interface{} `json:"moq"`
Mpq int `json:"-"`
MpqStr interface{} `json:"mpq"`
Mpl int `json:"-"`
MplStr interface{} `json:"mpl,omitempty"`
Stock int `json:"-"`
StockStr interface{} `json:"stock"`
HkDeliveryTime string `json:"hk_delivery_time"`
CnDeliveryTime string `json:"cn_delivery_time"`
LadderPrice []LadderPrice `json:"ladder_price"`
BrandName string `json:"brand_name"`
SupplierName string `json:"supplier_name"`
BrandId int `json:"brand_id"`
ClassId1 int `json:"class_id1"`
ClassId2 int `json:"class_id2"`
ClassName string `json:"class_name"`
Encoded string `json:"encoded"`
Packing string `json:"packing,omitempty"`
GoodsUnit string `json:"goods_unit,goods_unit"`
GoodsImages string `json:"goods_images"`
GoodsDetails string `json:"goods_details"`
GoodsBrief string `json:"goods_brief,omitempty"`
IsBuy int `json:"is_buy"`
Status int `json:"status"`
Pdf string `json:"pdf"`
Encap string `json:"encap"`
AcType int `json:"ac_type"`
OtherAttrs OtherAttrs `json:"other_attrs"`
UpdateTime int `json:"update_time"`
SkuName string `json:"sku_name,omitempty"`
Attrs Attrs `json:"attrs"`
Cost string `json:"cost,omitempty"`
NewCost string `json:"new_cost,omitempty"`
SupplierStock int `json:"supplier_stock,omitempty"`
SelfSupplierType int `json:"self_supplier_type,omitempty"`
GoodsUnitName string `json:"goods_unit_name,omitempty"`
PackingName string `json:"packing_name,omitempty"`
MpgUnitName string `json:"mpg_unit_name,omitempty"`
ScmBrandName string `json:"scm_brand_name,omitempty"`
AllowCoupon int `json:"allow_coupon"`
ClassId1Name string `json:"class_id1_name"`
CLassId2Name string `json:"class_id2_name"`
SpuId string `json:"spu_id,omitempty"`
BatchSn string `json:"batch_sn"`
Canal string `json:"canal"`
CpTime int `json:"cp_time"`
Coefficient Coefficient `json:"coefficient,omitempty"`
OriginalPrice []OriginalPrice `json:"original_price,omitempty"`
SuppExtendFee SuppExtendFee `json:"supp_extend_fee,omitempty"`
ClassId3 int `json:"class_id3"`
SpuName string `json:"spu_name,omitempty"`
ImagesL string `json:"images_l,omitempty"`
SpuBrief string `json:"spu_brief"`
SpuDetail string `json:"spu_detail"`
ClassName3 string `json:"class_name3"`
ErpTax bool `json:"erp_tax"`
ScmBrand ScmBrand `json:"scm_brand,omitempty"`
ActivityEndTime int64 `json:"activity_end_time,omitempty"`
PickType int `json:"pick_type,omitempty"`
BarCode string `json:"barcode,omitempty"`
GoodsId string `json:"goods_id"`
GoodsName string `json:"goods_name"`
GoodsSn string `json:"goods_sn"`
GoodsType int `json:"goods_type"`
GoodsStatus int `json:"goods_status"`
SupplierId int `json:"supplier_id"`
Moq int `json:"-"`
MoqStr interface{} `json:"moq"`
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"`
HkDeliveryTime string `json:"hk_delivery_time"`
CnDeliveryTime string `json:"cn_delivery_time"`
LadderPrice []LadderPrice `json:"ladder_price"`
BrandName string `json:"brand_name"`
SupplierName string `json:"supplier_name"`
BrandId int `json:"brand_id"`
ClassId1 int `json:"class_id1"`
ClassId2 int `json:"class_id2"`
ClassName string `json:"class_name"`
Encoded string `json:"encoded"`
Packing string `json:"packing,omitempty"`
GoodsUnit string `json:"goods_unit,goods_unit"`
GoodsImages string `json:"goods_images"`
GoodsDetails string `json:"goods_details"`
GoodsBrief string `json:"goods_brief,omitempty"`
IsBuy int `json:"is_buy"`
Status int `json:"status"`
Pdf string `json:"pdf"`
Encap string `json:"encap"`
AcType int `json:"ac_type"`
OtherAttrs OtherAttrs `json:"other_attrs"`
UpdateTime int `json:"update_time"`
SkuName string `json:"sku_name,omitempty"`
Attrs Attrs `json:"attrs"`
Cost string `json:"cost,omitempty"`
NewCost string `json:"new_cost,omitempty"`
SupplierStock int `json:"supplier_stock,omitempty"`
SelfSupplierType int `json:"self_supplier_type,omitempty"`
GoodsUnitName string `json:"goods_unit_name,omitempty"`
PackingName string `json:"packing_name,omitempty"`
MpgUnitName string `json:"mpg_unit_name,omitempty"`
ScmBrandName string `json:"scm_brand_name,omitempty"`
AllowCoupon int `json:"allow_coupon"`
ClassId1Name string `json:"class_id1_name"`
CLassId2Name string `json:"class_id2_name"`
SpuId string `json:"spu_id,omitempty"`
BatchSn string `json:"batch_sn"`
Canal string `json:"canal"`
CpTime int `json:"cp_time"`
Coefficient Coefficient `json:"coefficient,omitempty"`
OriginalPrice []OriginalPrice `json:"original_price,omitempty"`
SuppExtendFee SuppExtendFee `json:"supp_extend_fee,omitempty"`
ClassId3 int `json:"class_id3"`
SpuName string `json:"spu_name,omitempty"`
ImagesL string `json:"images_l,omitempty"`
SpuBrief string `json:"spu_brief"`
SpuDetail string `json:"spu_detail"`
ClassName3 string `json:"class_name3"`
ErpTax bool `json:"erp_tax"`
ScmBrand ScmBrand `json:"scm_brand,omitempty"`
ActivityEndTime int64 `json:"activity_end_time,omitempty"`
}
type ZiyinGoodsInfo struct {
GoodsNameOrg string `json:"goods_name_org"`
SampleStatus string `json:"sample_status"`
SampleMaxNumber string `json:"sample_max_number"`
SampleClassId string `json:"sample_class_id"`
SampleClassIdName string `json:"sample_class_id_name"`
Quota int `json:"quota"`
GoodsNameOrg string `json:"goods_name_org"`
SampleStatus string `json:"sample_status"`
SampleMaxNumber string `json:"sample_max_number"`
SampleClassId string `json:"sample_class_id"`
SampleClassIdName string `json:"sample_class_id_name"`
Quota int `json:"quota"`
DullGoodsData
}
......@@ -84,7 +86,7 @@ type ZiyinGoodsInfo struct {
type DullGoodsData struct {
ApiGoods
//额外增加的字段
Tprice float64 `json:"tprice,omitempty"` //用于比价梯度判断
Tprice float64 `json:"tprice,omitempty"` //用于比价梯度判断
GoodsNameTemp string `json:"goods_name_temp,omitempty"`
Multiple int `json:"-"`
MultipleStr interface{} `json:"multiple,omitempty"`
......
......@@ -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