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
3bc44578
authored
Jan 15, 2026
by
hcy
Browse files
Options
_('Browse Files')
Download
Email Patches
Plain Diff
label_op
parent
57a29d40
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
9 additions
and
7 deletions
model/goods.go
service/goods_service.go
model/goods.go
View file @
3bc44578
...
...
@@ -60,6 +60,7 @@ type ApiGoods struct {
BatchSn
string
`json:"batch_sn"`
Canal
string
`json:"canal"`
CpTime
int
`json:"cp_time"`
LabelOp
int64
`json:"label_op"`
//操作按钮
Coefficient
Coefficient
`json:"coefficient,omitempty"`
OriginalPrice
[]
OriginalPrice
`json:"original_price,omitempty"`
SuppExtendFee
SuppExtendFee
`json:"supp_extend_fee,omitempty"`
...
...
@@ -84,7 +85,7 @@ type ZiyinGoodsInfo struct {
DullGoodsData
}
//经过处理后的商品数据
//
经过处理后的商品数据
type
DullGoodsData
struct
{
ApiGoods
//额外增加的字段
...
...
service/goods_service.go
View file @
3bc44578
...
...
@@ -14,7 +14,7 @@ import (
"strings"
)
//获取商品信息,需要传入userId用于判断是否登陆
//
获取商品信息,需要传入userId用于判断是否登陆
func
GetGoodsInfo
(
ctx
*
gin
.
Context
,
goodsIds
[]
string
)
(
goodsList
[]
model
.
ApiGoods
,
err
error
)
{
var
userIdStr
string
userIdStr
,
_
=
ctx
.
Cookie
(
"Yo4teW_uid"
)
...
...
@@ -35,7 +35,7 @@ func GetGoodsInfo(ctx *gin.Context, goodsIds []string) (goodsList []model.ApiGoo
return
}
//获取商品信息
//
获取商品信息
func
GetGoodsInfoByApi
(
ctx
*
gin
.
Context
,
goodsIdsStr
string
)
(
goodsList
[]
model
.
ApiGoods
,
err
error
)
{
params
:=
req
.
Param
{
"goods_id"
:
goodsIdsStr
,
...
...
@@ -45,7 +45,7 @@ func GetGoodsInfoByApi(ctx *gin.Context, goodsIdsStr string) (goodsList []model.
}
//isMap:是否以字典形式返回值,默认是数组
//
isMap:是否以字典形式返回值,默认是数组
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
{
...
...
@@ -137,6 +137,7 @@ func CurlGoodsInfo(ctx *gin.Context, goodsIdsStr string, params req.Param) (good
goods
.
GoodsUnit
=
data
.
Get
(
"goods_unit"
)
.
String
()
goods
.
GoodsImages
=
data
.
Get
(
"goods_images"
)
.
String
()
goods
.
GoodsBrief
=
data
.
Get
(
"goods_brief"
)
.
String
()
goods
.
LabelOp
=
data
.
Get
(
"label_op"
)
.
Int
()
goods
.
StandardBrand
=
data
.
Get
(
"standard_brand"
)
.
String
()
goods
.
Mpl
=
int
(
data
.
Get
(
"mpl"
)
.
Int
())
goods
.
MplStr
=
int
(
data
.
Get
(
"mpl"
)
.
Int
())
...
...
@@ -244,7 +245,7 @@ func CurlGoodsInfo(ctx *gin.Context, goodsIdsStr string, params req.Param) (good
return
}
//判断是否是新客价
//
判断是否是新客价
func
CheckIsNewCustomer
(
userId
int
)
(
isNewCustomer
,
isMember
bool
)
{
//判断新客价
if
userId
!=
0
{
...
...
@@ -269,7 +270,7 @@ func CheckIsNewCustomer(userId int) (isNewCustomer, isMember bool) {
return
}
//将供应商信息放到数据最外层,同时整合es相关数据
//
将供应商信息放到数据最外层,同时整合es相关数据
func
GetReturnSupplierData
(
dullData
[]
model
.
DullGoodsData
)
(
result
map
[
string
]
interface
{})
{
result
=
make
(
map
[
string
]
interface
{})
result
[
"data"
]
=
dullData
...
...
@@ -287,7 +288,7 @@ func GetReturnSupplierData(dullData []model.DullGoodsData) (result map[string]in
return
result
}
//根据es的结果获取goods_id列表
//
根据es的结果获取goods_id列表
func
GetGoodsIdsByEs
(
res
string
)
(
goodsIds
[]
string
)
{
//直接用gjson去获取goods_id列表
gjArray
:=
gjson
.
Get
(
res
,
"hits.hits.#._source.goods_id"
)
.
Array
()
...
...
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