Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
黄成意
/
go_sku_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
66089517
authored
Jun 20, 2025
by
杨树贤
Browse files
Options
_('Browse Files')
Download
Email Patches
Plain Diff
联营tags单独获取
parent
8dc5a759
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
41 additions
and
10 deletions
service/service_ly.go
service/service_tags.go
service/service_ly.go
View file @
66089517
...
...
@@ -263,7 +263,7 @@ func (ls *LyService) LyGoodsDetail(ctx *gin.Context, goodsIds []string, ch chan
//获取标签信息
var
TagService
TagsService
sku
.
GoodsTag
=
TagService
.
Get
Tags
(
sku
.
GoodsId
,
0
)
sku
.
GoodsTag
=
TagService
.
Get
LyTags
(
sku
)
//获取关税以及价格转换
sku
=
ls
.
GetTariffAndPrice
(
sku
)
...
...
service/service_tags.go
View file @
66089517
...
...
@@ -18,7 +18,7 @@ type TagsService struct {
const
TagZiyingSku
=
4
//获取Spu的属性
func
(
ts
*
TagsService
)
GetTags
(
skuId
string
,
self
_supplier_t
ype
int64
)
(
goodsTags
model
.
GoodsTag
)
{
func
(
ts
*
TagsService
)
GetTags
(
skuId
string
,
self
SupplierT
ype
int64
)
(
goodsTags
model
.
GoodsTag
)
{
redisCon
:=
gredis
.
Conn
(
"default_r"
)
defer
redisCon
.
Close
()
goodsTagsStr
,
_
:=
redis
.
String
(
redisCon
.
Do
(
"HGET"
,
"goods_tag"
,
skuId
))
...
...
@@ -33,13 +33,6 @@ func (ts *TagsService) GetTags(skuId string, self_supplier_type int64) (goodsTag
goodsLabel
=
goodsLabelMap
[
goodsLabelType
]
goodsTags
.
GoodsLabelName
=
goodsLabel
goodsTags
.
GoodsLabel
=
goodsLabelType
//for _, tagResult := range gjson.Get(goodsTagsStr, "tags").Array() {
// tagName := vars.GoodsTags[int(tagResult.Int())]
// tagNames = append(tagNames, tagName)
// tags = append(tags, int(tagResult.Int()))
//}
//自定义标签
customerTag
:=
gjson
.
Get
(
goodsTagsStr
,
"customer_tag"
)
.
String
()
if
customerTag
!=
""
{
...
...
@@ -50,7 +43,7 @@ func (ts *TagsService) GetTags(skuId string, self_supplier_type int64) (goodsTag
}
}
//如果是自营商品Id,就写死当天发货标签
if
len
(
skuId
)
<
10
&&
self
_supplier_t
ype
==
1
{
if
len
(
skuId
)
<
10
&&
self
SupplierT
ype
==
1
{
if
!
php2go
.
InArray
(
TagZiyingSku
,
tags
)
{
tags
=
append
(
tags
,
TagZiyingSku
)
tagNames
=
append
(
tagNames
,
vars
.
GoodsTags
[
TagZiyingSku
])
...
...
@@ -63,3 +56,41 @@ func (ts *TagsService) GetTags(skuId string, self_supplier_type int64) (goodsTag
goodsTags
.
GoodsTag
=
tags
return
goodsTags
}
//获取联营tags
func
(
ts
*
TagsService
)
GetLyTags
(
sku
model
.
LySku
)
(
goodsTags
model
.
GoodsTag
)
{
skuId
:=
sku
.
GoodsId
redisCon
:=
gredis
.
Conn
(
"default_r"
)
defer
redisCon
.
Close
()
goodsTagsStr
,
_
:=
redis
.
String
(
redisCon
.
Do
(
"HGET"
,
"goods_tag"
,
skuId
))
goodsLabel
:=
""
//goods_tag
var
tags
[]
int
var
tagNames
[]
string
if
goodsTagsStr
!=
""
{
//goods_label
goodsLabelType
:=
int
(
gjson
.
Get
(
goodsTagsStr
,
"goods_label"
)
.
Int
())
goodsLabelMap
:=
vars
.
GoodsLabel
goodsLabel
=
goodsLabelMap
[
goodsLabelType
]
goodsTags
.
GoodsLabelName
=
goodsLabel
goodsTags
.
GoodsLabel
=
goodsLabelType
//自定义标签
customerTag
:=
gjson
.
Get
(
goodsTagsStr
,
"customer_tag"
)
.
String
()
if
customerTag
!=
""
{
customerTagArr
:=
php2go
.
Explode
(
" "
,
php2go
.
Trim
(
customerTag
))
for
_
,
cname
:=
range
customerTagArr
{
//如果是爱智的话,去掉可议价标签
if
sku
.
OrgId
==
3
&&
cname
==
"可议价"
{
continue
}
tagNames
=
append
(
tagNames
,
cname
)
}
}
}
goodsTags
.
GoodsTagNames
=
tagNames
goodsTags
.
GoodsTag
=
tags
return
goodsTags
}
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