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
312d652f
authored
Aug 30, 2021
by
hcy001
Browse files
Options
_('Browse Files')
Download
Email Patches
Plain Diff
更新自营属性
parent
672be618
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
5 additions
and
6 deletions
service/service_attr.go
service/service_ly.go
service/service_tags.go
service/service_zy.go
service/service_attr.go
View file @
312d652f
...
...
@@ -2,7 +2,6 @@ package service
import
(
"encoding/json"
"fmt"
"github.com/iancoleman/orderedmap"
"go_sku_server/pkg/logger"
"go_sku_server/pkg/mongo"
...
...
@@ -24,7 +23,7 @@ func (ls *LyService) GetSpuAttr(spuId string) (attrsResult interface{}) {
if
err
!=
nil
&&
err
!=
mgo
.
ErrNotFound
{
logger
.
Select
(
"sku_query"
)
.
Error
(
err
.
Error
())
}
fmt
.
Println
(
spuAttr
.
AttrsExtend
)
//
fmt.Println(spuAttr.AttrsExtend)
//如果有attrs_extend,就去取attrs_extend
if
len
(
spuAttr
.
AttrsExtend
)
!=
0
{
return
spuAttr
.
AttrsExtend
...
...
service/service_ly.go
View file @
312d652f
...
...
@@ -161,7 +161,7 @@ func (ls *LyService) LyGoodsDetail(ctx *gin.Context, goodsIds []string, ch chan
//}
var
TagService
TagsService
sku
.
GoodsTag
=
TagService
.
GetTags
(
sku
.
GoodsId
)
sku
.
GoodsTag
=
TagService
.
GetTags
(
sku
.
GoodsId
,
0
)
//用spuInfo补全信息
sku
=
ls
.
CombineSup
(
sku
,
spu
)
...
...
service/service_tags.go
View file @
312d652f
...
...
@@ -18,7 +18,7 @@ type TagsService struct {
const
TagZiyingSku
=
4
//获取Spu的属性
func
(
ts
*
TagsService
)
GetTags
(
skuId
string
)
(
goodsTags
model
.
GoodsTag
)
{
func
(
ts
*
TagsService
)
GetTags
(
skuId
string
,
self_supplier_type
int64
)
(
goodsTags
model
.
GoodsTag
)
{
redisCon
:=
gredis
.
Conn
(
"default_r"
)
defer
redisCon
.
Close
()
goodsTagsStr
,
_
:=
redis
.
String
(
redisCon
.
Do
(
"HGET"
,
"goods_tag"
,
skuId
))
...
...
@@ -41,7 +41,7 @@ func (ts *TagsService) GetTags(skuId string) (goodsTags model.GoodsTag) {
}
}
//如果是自营商品Id,就写死当天发货标签
if
len
(
skuId
)
<
10
{
if
len
(
skuId
)
<
10
&&
self_supplier_type
==
1
{
if
!
php2go
.
InArray
(
TagZiyingSku
,
tags
)
{
tags
=
append
(
tags
,
TagZiyingSku
)
tagNames
=
append
(
tagNames
,
vars
.
GoodsTags
[
TagZiyingSku
])
...
...
service/service_zy.go
View file @
312d652f
...
...
@@ -291,7 +291,7 @@ func (qs *ZiyingService) ZyGoodsDetail(ctx *gin.Context, goodsIds []string, ch c
//获取标签信息
var
tagService
TagsService
A
.
Set
(
"goods_tag"
,
tagService
.
GetTags
(
goodsId
))
A
.
Set
(
"goods_tag"
,
tagService
.
GetTags
(
goodsId
,
gjson
.
Get
(
info
,
"self_supplier_type"
)
.
Int
()
))
//最后写入sync map
(
GoodsRes
)
.
Store
(
goodsId
,
A
)
...
...
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