Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
杨树贤
/
search_server
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Snippets
Settings
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit
afcb8b0d
authored
Jan 10, 2023
by
SUDPTDUBLXEROFX\Administrator
Browse files
Options
_('Browse Files')
Download
Email Patches
Plain Diff
增加标准品牌
parent
82d4f74f
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
105 additions
and
92 deletions
conf/dev/database.ini
conf/dev/elastic.ini
conf/dev/redis.ini
model/goods.go
service/goods_service.go
conf/dev/database.ini
View file @
afcb8b0d
...
@@ -4,7 +4,7 @@ mode = debug
...
@@ -4,7 +4,7 @@ mode = debug
[spu]
[spu]
user_name
=
spu
user_name
=
spu
password
=
spu
password
=
spu
host
=
192.168.1.23
4
host
=
192.168.1.23
8
database
=
liexin_spu
database
=
liexin_spu
table_prefix
=
lie_
table_prefix
=
lie_
type
=
mysql
type
=
mysql
...
...
conf/dev/elastic.ini
View file @
afcb8b0d
;存放es配置
;存放es配置
[es]
[es]
url
=
http://192.168.1.23
4
:9200
url
=
http://192.168.1.23
7
:9200
urls
=
http://192.168.1.23
4:9200,http://192.168.1.234
:9200
urls
=
http://192.168.1.23
7: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
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
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
hk_delivery_type_supplier
=
future,rochester,tme,verical,element14,digikey,chip1stop,aipco,arrow,alliedelec,avnet,mouser,peigenesis,powell,rs,buerklin
...
...
conf/dev/redis.ini
View file @
afcb8b0d
;redis连接信息
;redis连接信息
[default_redis_read]
[default_redis_read]
host
=
192.168.1.23
5
:6379
host
=
192.168.1.23
4
:6379
password
=
icDb29mLy2s
password
=
icDb29mLy2s
max_idle
=
500
max_idle
=
500
max_active
=
500
max_active
=
500
idle_timeout
=
20
idle_timeout
=
20
[default_redis_write]
[default_redis_write]
host
=
192.168.1.23
5
:6379
host
=
192.168.1.23
4
:6379
password
=
icDb29mLy2s
password
=
icDb29mLy2s
max_idle
=
500
max_idle
=
500
max_active
=
500
max_active
=
500
idle_timeout
=
20
idle_timeout
=
20
[api_redis]
[api_redis]
host
=
192.168.1.23
5
:6379
host
=
192.168.1.23
4
:6379
password
=
icDb29mLy2s
password
=
icDb29mLy2s
max_idle
=
50
max_idle
=
50
max_active
=
100
max_active
=
100
...
...
model/goods.go
View file @
afcb8b0d
package
model
package
model
type
ApiGoods
struct
{
type
ApiGoods
struct
{
PickType
int
`json:"pick_type,omitempty"`
PickType
int
`json:"pick_type,omitempty"`
BarCode
string
`json:"barcode,omitempty"`
BarCode
string
`json:"barcode,omitempty"`
GoodsId
string
`json:"goods_id"`
GoodsId
string
`json:"goods_id"`
GoodsName
string
`json:"goods_name"`
GoodsName
string
`json:"goods_name"`
GoodsSn
string
`json:"goods_sn"`
GoodsSn
string
`json:"goods_sn"`
GoodsType
int
`json:"goods_type"`
GoodsType
int
`json:"goods_type"`
GoodsStatus
int
`json:"goods_status"`
GoodsStatus
int
`json:"goods_status"`
SupplierId
int
`json:"supplier_id"`
SupplierId
int
`json:"supplier_id"`
Moq
int
`json:"-"`
Moq
int
`json:"-"`
MoqStr
interface
{}
`json:"moq"`
MoqStr
interface
{}
`json:"moq"`
Mpq
int
`json:"-"`
Mpq
int
`json:"-"`
MpqStr
interface
{}
`json:"mpq"`
MpqStr
interface
{}
`json:"mpq"`
Mpl
int
`json:"-"`
Mpl
int
`json:"-"`
MplStr
interface
{}
`json:"mpl,omitempty"`
StandardBrandName
string
`json:"standard_brand_name"`
Stock
int
`json:"-"`
StandardBrandUrl
string
`json:"standard_brand_url"`
StockStr
interface
{}
`json:"stock"`
MplStr
interface
{}
`json:"mpl,omitempty"`
HkDeliveryTime
string
`json:"hk_delivery_time"`
Stock
int
`json:"-"`
CnDeliveryTime
string
`json:"cn_delivery_time"`
StockStr
interface
{}
`json:"stock"`
LadderPrice
[]
LadderPrice
`json:"ladder_price"`
HkDeliveryTime
string
`json:"hk_delivery_time"`
BrandName
string
`json:"brand_name"`
CnDeliveryTime
string
`json:"cn_delivery_time"`
SupplierName
string
`json:"supplier_name"`
LadderPrice
[]
LadderPrice
`json:"ladder_price"`
BrandId
int
`json:"brand_id"`
BrandName
string
`json:"brand_name"`
ClassId1
int
`json:"class_id1"`
SupplierName
string
`json:"supplier_name"`
ClassId2
int
`json:"class_id2"`
BrandId
int
`json:"brand_id"`
ClassName
string
`json:"class_name"`
ClassId1
int
`json:"class_id1"`
Encoded
string
`json:"encoded"`
ClassId2
int
`json:"class_id2"`
Packing
string
`json:"packing,omitempty"`
ClassName
string
`json:"class_name"`
GoodsUnit
string
`json:"goods_unit,goods_unit"`
Encoded
string
`json:"encoded"`
GoodsImages
string
`json:"goods_images"`
Packing
string
`json:"packing,omitempty"`
GoodsDetails
string
`json:"goods_details"`
GoodsUnit
string
`json:"goods_unit,goods_unit"`
GoodsBrief
string
`json:"goods_brief,omitempty"`
GoodsImages
string
`json:"goods_images"`
IsBuy
int
`json:"is_buy"`
GoodsDetails
string
`json:"goods_details"`
Status
int
`json:"status"`
GoodsBrief
string
`json:"goods_brief,omitempty"`
Pdf
string
`json:"pdf"`
IsBuy
int
`json:"is_buy"`
Encap
string
`json:"encap"`
Status
int
`json:"status"`
AcType
int
`json:"ac_type"`
Pdf
string
`json:"pdf"`
OtherAttrs
OtherAttrs
`json:"other_attrs"`
Encap
string
`json:"encap"`
UpdateTime
int
`json:"update_time"`
AcType
int
`json:"ac_type"`
SkuName
string
`json:"sku_name,omitempty"`
OtherAttrs
OtherAttrs
`json:"other_attrs"`
Attrs
Attrs
`json:"attrs"`
UpdateTime
int
`json:"update_time"`
Cost
string
`json:"cost,omitempty"`
SkuName
string
`json:"sku_name,omitempty"`
NewCost
string
`json:"new_cost,omitempty"`
Attrs
Attrs
`json:"attrs"`
SupplierStock
int
`json:"supplier_stock,omitempty"`
Cost
string
`json:"cost,omitempty"`
SelfSupplierType
int
`json:"self_supplier_type,omitempty"`
NewCost
string
`json:"new_cost,omitempty"`
GoodsUnitName
string
`json:"goods_unit_name,omitempty"`
SupplierStock
int
`json:"supplier_stock,omitempty"`
PackingName
string
`json:"packing_name,omitempty"`
SelfSupplierType
int
`json:"self_supplier_type,omitempty"`
MpgUnitName
string
`json:"mpg_unit_name,omitempty"`
GoodsUnitName
string
`json:"goods_unit_name,omitempty"`
ScmBrandName
string
`json:"scm_brand_name,omitempty"`
PackingName
string
`json:"packing_name,omitempty"`
AllowCoupon
int
`json:"allow_coupon"`
MpgUnitName
string
`json:"mpg_unit_name,omitempty"`
ClassId1Name
string
`json:"class_id1_name"`
ScmBrandName
string
`json:"scm_brand_name,omitempty"`
CLassId2Name
string
`json:"class_id2_name"`
AllowCoupon
int
`json:"allow_coupon"`
SpuId
string
`json:"spu_id,omitempty"`
ClassId1Name
string
`json:"class_id1_name"`
BatchSn
string
`json:"batch_sn"`
CLassId2Name
string
`json:"class_id2_name"`
Canal
string
`json:"canal"`
SpuId
string
`json:"spu_id,omitempty"`
CpTime
int
`json:"cp_time"`
BatchSn
string
`json:"batch_sn"`
Coefficient
Coefficient
`json:"coefficient,omitempty"`
Canal
string
`json:"canal"`
OriginalPrice
[]
OriginalPrice
`json:"original_price,omitempty"`
CpTime
int
`json:"cp_time"`
SuppExtendFee
SuppExtendFee
`json:"supp_extend_fee,omitempty"`
Coefficient
Coefficient
`json:"coefficient,omitempty"`
ClassId3
int
`json:"class_id3"`
OriginalPrice
[]
OriginalPrice
`json:"original_price,omitempty"`
SpuName
string
`json:"spu_name,omitempty"`
SuppExtendFee
SuppExtendFee
`json:"supp_extend_fee,omitempty"`
ImagesL
string
`json:"images_l,omitempty"`
ClassId3
int
`json:"class_id3"`
SpuBrief
string
`json:"spu_brief"`
SpuName
string
`json:"spu_name,omitempty"`
SpuDetail
string
`json:"spu_detail"`
ImagesL
string
`json:"images_l,omitempty"`
ClassName3
string
`json:"class_name3"`
SpuBrief
string
`json:"spu_brief"`
ErpTax
bool
`json:"erp_tax"`
SpuDetail
string
`json:"spu_detail"`
ScmBrand
ScmBrand
`json:"scm_brand,omitempty"`
ClassName3
string
`json:"class_name3"`
ActivityEndTime
int64
`json:"activity_end_time,omitempty"`
ErpTax
bool
`json:"erp_tax"`
ScmBrand
ScmBrand
`json:"scm_brand,omitempty"`
ActivityEndTime
int64
`json:"activity_end_time,omitempty"`
}
}
type
ZiyinGoodsInfo
struct
{
type
ZiyinGoodsInfo
struct
{
GoodsNameOrg
string
`json:"goods_name_org"`
GoodsNameOrg
string
`json:"goods_name_org"`
SampleStatus
string
`json:"sample_status"`
SampleStatus
string
`json:"sample_status"`
SampleMaxNumber
string
`json:"sample_max_number"`
SampleMaxNumber
string
`json:"sample_max_number"`
SampleClassId
string
`json:"sample_class_id"`
SampleClassId
string
`json:"sample_class_id"`
SampleClassIdName
string
`json:"sample_class_id_name"`
SampleClassIdName
string
`json:"sample_class_id_name"`
Quota
int
`json:"quota"`
Quota
int
`json:"quota"`
DullGoodsData
DullGoodsData
}
}
...
@@ -84,7 +86,7 @@ type ZiyinGoodsInfo struct {
...
@@ -84,7 +86,7 @@ type ZiyinGoodsInfo struct {
type
DullGoodsData
struct
{
type
DullGoodsData
struct
{
ApiGoods
ApiGoods
//额外增加的字段
//额外增加的字段
Tprice
float64
`json:"tprice,omitempty"`
//用于比价梯度判断
Tprice
float64
`json:"tprice,omitempty"`
//用于比价梯度判断
GoodsNameTemp
string
`json:"goods_name_temp,omitempty"`
GoodsNameTemp
string
`json:"goods_name_temp,omitempty"`
Multiple
int
`json:"-"`
Multiple
int
`json:"-"`
MultipleStr
interface
{}
`json:"multiple,omitempty"`
MultipleStr
interface
{}
`json:"multiple,omitempty"`
...
...
service/goods_service.go
View file @
afcb8b0d
...
@@ -14,7 +14,7 @@ import (
...
@@ -14,7 +14,7 @@ import (
)
)
//获取商品信息,需要传入userId用于判断是否登陆
//获取商品信息,需要传入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
var
userIdStr
string
userIdStr
,
_
=
ctx
.
Cookie
(
"Yo4teW_uid"
)
userIdStr
,
_
=
ctx
.
Cookie
(
"Yo4teW_uid"
)
userId
,
_
:=
strconv
.
Atoi
(
userIdStr
)
userId
,
_
:=
strconv
.
Atoi
(
userIdStr
)
...
@@ -26,26 +26,26 @@ func GetGoodsInfo(ctx *gin.Context,goodsIds []string) (goodsList []model.ApiGood
...
@@ -26,26 +26,26 @@ func GetGoodsInfo(ctx *gin.Context,goodsIds []string) (goodsList []model.ApiGood
"power[member]"
:
isMember
,
"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
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
{
params
:=
req
.
Param
{
"goods_id"
:
goodsIdsStr
,
"goods_id"
:
goodsIdsStr
,
}
}
goodsList
,
_
,
err
=
CurlGoodsInfo
(
ctx
,
goodsIdsStr
,
params
)
goodsList
,
_
,
err
=
CurlGoodsInfo
(
ctx
,
goodsIdsStr
,
params
)
return
return
}
}
//isMap:是否以字典形式返回值,默认是数组
//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
,
","
)
goodsIdList
:=
strings
.
Split
(
goodsIdsStr
,
","
)
if
len
(
goodsIdList
)
==
0
{
if
len
(
goodsIdList
)
==
0
{
return
return
...
@@ -54,14 +54,14 @@ func CurlGoodsInfo(ctx *gin.Context,goodsIdsStr string, params req.Param) (goods
...
@@ -54,14 +54,14 @@ func CurlGoodsInfo(ctx *gin.Context,goodsIdsStr string, params req.Param) (goods
var
goodsServerUrl
string
var
goodsServerUrl
string
if
len
(
goodsIdList
[
0
])
>
7
{
if
len
(
goodsIdList
[
0
])
>
7
{
goodsServerUrl
=
config
.
Get
(
"goods.api_url"
)
.
String
()
goodsServerUrl
=
config
.
Get
(
"goods.api_url"
)
.
String
()
}
else
{
}
else
{
goodsServerUrl
=
config
.
Get
(
"goods.sz_api_url"
)
.
String
()
goodsServerUrl
=
config
.
Get
(
"goods.sz_api_url"
)
.
String
()
}
}
resp
,
err
:=
req
.
Post
(
goodsServerUrl
+
"/synchronization"
,
params
)
resp
,
err
:=
req
.
Post
(
goodsServerUrl
+
"/synchronization"
,
params
)
common
.
PrintDebugHtml
(
ctx
,
goodsServerUrl
+
"/synchronization"
)
//debug
common
.
PrintDebugHtml
(
ctx
,
goodsServerUrl
+
"/synchronization"
)
//debug
common
.
PrintDebugHtml
(
ctx
,
params
)
//debug
common
.
PrintDebugHtml
(
ctx
,
params
)
//debug
common
.
PrintDebugHtml
(
ctx
,
resp
.
String
())
//debug
common
.
PrintDebugHtml
(
ctx
,
resp
.
String
())
//debug
if
err
!=
nil
{
if
err
!=
nil
{
return
return
...
@@ -76,6 +76,17 @@ func CurlGoodsInfo(ctx *gin.Context,goodsIdsStr string, params req.Param) (goods
...
@@ -76,6 +76,17 @@ func CurlGoodsInfo(ctx *gin.Context,goodsIdsStr string, params req.Param) (goods
//还要去判断是否是false,因为商品服务可能返回 "1000":false 这样子的形式
//还要去判断是否是false,因为商品服务可能返回 "1000":false 这样子的形式
if
data
.
IsObject
()
{
if
data
.
IsObject
()
{
var
goods
model
.
ApiGoods
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
.
PickType
=
int
(
data
.
Get
(
"pick_type"
)
.
Int
())
goods
.
BarCode
=
data
.
Get
(
"bar_code"
)
.
String
()
goods
.
BarCode
=
data
.
Get
(
"bar_code"
)
.
String
()
goods
.
GoodsId
=
data
.
Get
(
"goods_id"
)
.
String
()
goods
.
GoodsId
=
data
.
Get
(
"goods_id"
)
.
String
()
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment