Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
S
sun
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
谢林臻
sun
Commits
6522610b
Commit
6522610b
authored
Jul 17, 2019
by
haowang
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix code
parent
1ca74883
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
4 additions
and
1 deletion
+4
-1
brand.py
api/brand.py
+4
-1
No files found.
api/brand.py
View file @
6522610b
...
...
@@ -19,6 +19,9 @@ class BrandListView(APIView):
is_online
=
is_online
,
has_icon
=
has_icon
,
classify_id
=
classify_id
)
.
unwrap
()
brand_ids
=
[
obj
.
get
(
'id'
)
for
obj
in
data
]
brands_grade
=
self
.
rpc
[
'neptune/commodity/brand/grade'
](
ids
=
brand_ids
)
.
unwrap
()
grade_dict
=
{
str
(
obj
.
get
(
'brand_id'
)):
obj
.
get
(
'grade'
)
for
obj
in
brands_grade
}
product_count
=
self
.
rpc
[
'neptune/commodity/brand/product_count'
](
ids
=
brand_ids
)
.
unwrap
()
category_infos
=
self
.
rpc
[
'neptune/commodity/category/infos'
](
brand_ids
=
brand_ids
)
.
unwrap
()
...
...
@@ -40,7 +43,7 @@ class BrandListView(APIView):
category_info_list
=
category_dict
.
get
(
str
(
brand_id
))
obj
[
'category_infos'
]
=
[{
'id'
:
obj
.
get
(
'id'
),
'cn_name'
:
obj
.
get
(
'cn_name'
)}
for
obj
in
category_info_list
]
if
category_info_list
else
[]
obj
[
'grade'
]
=
0
obj
[
'grade'
]
=
grade_dict
.
get
(
str
(
brand_id
))
if
grade_dict
.
get
(
str
(
brand_id
))
else
0
classify_info
=
classify_dict
.
get
(
str
(
brand_id
))
obj
[
'classify_info'
]
=
[{
'id'
:
classify_info
.
get
(
'id'
),
'cn_name'
:
classify_info
.
get
(
'cn_name'
)}]
if
classify_info
else
[]
...
...
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