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
bb5a0cbc
authored
Aug 27, 2021
by
mushishixian
Browse files
Options
_('Browse Files')
Download
Email Patches
Plain Diff
修改属性
parent
699d1ab6
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
13 additions
and
2 deletions
service/service_attr.go
service/service_ly_common.go
service/service_attr.go
View file @
bb5a0cbc
...
...
@@ -2,6 +2,7 @@ package service
import
(
"encoding/json"
"fmt"
"github.com/iancoleman/orderedmap"
"go_sku_server/pkg/logger"
"go_sku_server/pkg/mongo"
...
...
@@ -23,7 +24,11 @@ func (ls *LyService) GetSpuAttr(spuId string) (attrsResult interface{}) {
if
err
!=
nil
&&
err
!=
mgo
.
ErrNotFound
{
logger
.
Select
(
"sku_query"
)
.
Error
(
err
.
Error
())
}
if
spuAttr
.
Attrs
!=
""
{
fmt
.
Println
(
spuAttr
.
AttrsExtend
)
//如果有attrs_extend,就去取attrs_extend
if
len
(
spuAttr
.
AttrsExtend
)
!=
0
{
return
spuAttr
.
AttrsExtend
}
else
if
spuAttr
.
Attrs
!=
""
{
o
:=
orderedmap
.
New
()
err
:=
json
.
Unmarshal
([]
byte
(
spuAttr
.
Attrs
),
&
o
)
if
err
!=
nil
{
...
...
service/service_ly_common.go
View file @
bb5a0cbc
...
...
@@ -85,10 +85,16 @@ func (ls *LyService) GetCacheClass(classId int64) string {
type
SpuAttr
struct
{
SpuId
string
`bson:"spu_id"`
AttrsExtend
string
`bson:"attrs_extend"`
AttrsExtend
[]
AttrsExtend
`bson:"attrs_extend"`
Attrs
string
`bson:"attrs"`
}
type
AttrsExtend
struct
{
AttrName
string
`bson:"attr_name" json:"attr_name"`
AttrValue
string
`bson:"attr_value" json:"attr_value"`
AttrUnit
string
`bson:"attr_unit" json:"attr_unit,omitempty"`
}
//H获取供应链标准品牌
func
(
ls
*
LyService
)
GetScmBrand
(
brandId
int64
)
(
res
interface
{})
{
redisCon
:=
gredis
.
Conn
(
"default_r"
)
...
...
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