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
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
30 additions
and
17 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
...
@@ -14,6 +14,8 @@ type ApiGoods struct {
...
@@ -14,6 +14,8 @@ type ApiGoods struct {
Mpq
int
`json:"-"`
Mpq
int
`json:"-"`
MpqStr
interface
{}
`json:"mpq"`
MpqStr
interface
{}
`json:"mpq"`
Mpl
int
`json:"-"`
Mpl
int
`json:"-"`
StandardBrandName
string
`json:"standard_brand_name"`
StandardBrandUrl
string
`json:"standard_brand_url"`
MplStr
interface
{}
`json:"mpl,omitempty"`
MplStr
interface
{}
`json:"mpl,omitempty"`
Stock
int
`json:"-"`
Stock
int
`json:"-"`
StockStr
interface
{}
`json:"stock"`
StockStr
interface
{}
`json:"stock"`
...
...
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