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
ec2163bc
authored
Oct 12, 2024
by
杨树贤
Browse files
Options
_('Browse Files')
Download
Email Patches
Plain Diff
兼容老数据
parent
3e48025c
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
27 additions
and
0 deletions
model/ly_sku.go
service/service_ly.go
model/ly_sku.go
View file @
ec2163bc
...
...
@@ -148,6 +148,7 @@ type SpuExtra struct {
Name
string
`bson:"name" json:"name"`
Thumbnail
string
`bson:"thumbnail" json:"thumbnail"`
}
`bson:"image_list" json:"image_list"`
SpuDetail
string
`bson:"spu_detail" json:"spu_detail"`
SpuId
string
`bson:"spu_id" json:"spu_id"`
}
...
...
service/service_ly.go
View file @
ec2163bc
...
...
@@ -290,5 +290,31 @@ func (ls *LyService) GetSpuExtra(spuId string) (spuExtra model.SpuExtra) {
if
err
!=
nil
&&
err
!=
mgo
.
ErrNotFound
{
logger
.
Select
(
"sku_query"
)
.
Error
(
err
.
Error
())
}
//兼容老版本数据
if
len
(
spuExtra
.
ImageList
)
==
0
{
type
OldSpuExtra
struct
{
OldImageList
map
[
string
]
struct
{
Name
string
`bson:"name"`
Thumbnail
string
`bson:"thumbnail"`
}
`bson:"image_list" json:"old_image_list"`
}
var
oldSpuExtra
OldSpuExtra
err
=
mongodb
.
DB
(
"ichunt"
)
.
C
(
"spu_extra"
)
.
Find
(
bson
.
M
{
"spu_id"
:
spuId
})
.
One
(
&
oldSpuExtra
)
for
_
,
image
:=
range
oldSpuExtra
.
OldImageList
{
spuExtra
.
ImageList
=
append
(
spuExtra
.
ImageList
,
struct
{
Name
string
`bson:"name" json:"name"`
Thumbnail
string
`bson:"thumbnail" json:"thumbnail"`
}{
Name
:
image
.
Name
,
Thumbnail
:
image
.
Thumbnail
,
})
}
}
return
spuExtra
}
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