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
399e502e
Commit
399e502e
authored
Jul 17, 2019
by
王浩
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'haow/dev' into 'dev'
fix code See merge request
alpha/sun!253
parents
a5046db2
7984f3af
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
17 additions
and
10 deletions
+17
-10
brand.py
api/brand.py
+8
-2
product.py
api/product.py
+9
-8
No files found.
api/brand.py
View file @
399e502e
...
...
@@ -55,10 +55,16 @@ class BrandInfoView(APIView):
data
=
self
.
rpc
[
'neptune/commodity/brand/info'
](
id_
=
id_
)
.
unwrap
()
classify_infos
=
self
.
rpc
[
'neptune/commodity/classify/infos'
](
brand_id
=
id_
)
.
unwrap
()
data
[
'classify_infos'
]
=
[{
'id'
:
obj
.
get
(
'id'
),
'cn_name'
:
obj
.
get
(
'cn_name'
)}
for
obj
in
classify_infos
]
if
classify_infos
:
data
[
'classify_infos'
]
=
[{
'id'
:
obj
.
get
(
'id'
),
'cn_name'
:
obj
.
get
(
'cn_name'
)}
for
obj
in
classify_infos
]
else
:
data
[
'classify_infos'
]
=
[]
category_ids
=
self
.
rpc
[
'neptune/commodity/brand/category_ids'
](
id_
=
id_
)
.
unwrap
()
category_infos
=
self
.
rpc
[
'neptune/commodity/category/infos'
](
ids
=
category_ids
)
.
unwrap
()
data
[
'category_infos'
]
=
[{
'id'
:
obj
.
get
(
'id'
),
'cn_name'
:
obj
.
get
(
'cn_name'
)}
for
obj
in
category_infos
]
if
category_infos
:
data
[
'category_infos'
]
=
[{
'id'
:
obj
.
get
(
'id'
),
'cn_name'
:
obj
.
get
(
'cn_name'
)}
for
obj
in
category_infos
]
else
:
data
[
'category_infos'
]
=
[]
return
data
...
...
api/product.py
View file @
399e502e
...
...
@@ -19,7 +19,7 @@ class ProductListView(APIView):
for
obj
in
category_infos
:
product_id
=
obj
.
get
(
'product_id'
)
if
ret
.
get
(
str
(
product_id
)):
ret
[
str
(
product_id
)]
=
ret
.
get
(
str
(
product_id
))
.
append
(
obj
)
ret
.
get
(
str
(
product_id
))
.
append
(
obj
)
else
:
ret
[
str
(
product_id
)]
=
[
obj
]
return
ret
...
...
@@ -32,7 +32,7 @@ class ProductListView(APIView):
for
obj
in
effect_infos
:
product_id
=
obj
.
get
(
'product_id'
)
if
ret
.
get
(
str
(
product_id
)):
ret
[
str
(
product_id
)]
=
ret
.
get
(
str
(
product_id
))
.
append
(
obj
)
ret
.
get
(
str
(
product_id
))
.
append
(
obj
)
else
:
ret
[
str
(
product_id
)]
=
[
obj
]
return
ret
...
...
@@ -45,7 +45,7 @@ class ProductListView(APIView):
for
obj
in
classify_infos
:
product_id
=
obj
.
get
(
'product_id'
)
if
ret
.
get
(
str
(
product_id
)):
ret
[
str
(
product_id
)]
=
ret
.
get
(
str
(
product_id
))
.
append
(
obj
)
ret
.
get
(
str
(
product_id
))
.
append
(
obj
)
else
:
ret
[
str
(
product_id
)]
=
[
obj
]
return
ret
...
...
@@ -61,6 +61,7 @@ class ProductListView(APIView):
has_brand
=
request
.
GET
.
get
(
'has_brand'
,
None
)
has_image
=
request
.
GET
.
get
(
'has_image'
,
None
)
brand_id
=
request
.
GET
.
get
(
'brand_id'
,
None
)
classify_id
=
request
.
GET
.
get
(
'classify_id'
,
None
)
category_id
=
request
.
GET
.
get
(
'category_id'
,
None
)
price_low
=
request
.
GET
.
get
(
'price_low'
,
None
)
price_high
=
request
.
GET
.
get
(
'price_high'
,
None
)
...
...
@@ -70,16 +71,16 @@ class ProductListView(APIView):
comment_nums_high
=
request
.
GET
.
get
(
'comment_nums_high'
,
None
)
data
=
self
.
rpc
[
'neptune/commodity/product/list'
](
offset
=
offset
,
count
=
count
,
id_
=
id_
,
cn_name
=
cn_name
,
en_name
=
en_name
,
alias
=
alias
,
is_online
=
is_online
,
has_area
=
has_area
,
has_brand
=
has_brand
,
has_image
=
has_image
,
brand_id
=
brand_id
,
category_id
=
category_id
,
price_low
=
price_low
,
price_high
=
price_high
,
grade_low
=
grade_low
,
grade_high
=
grade_high
,
comment_nums_low
=
comment_nums_low
,
comment_nums_high
=
comment_nums_high
)
.
unwrap
()
offset
=
offset
,
count
=
count
,
id_
=
id_
,
cn_name
=
cn_name
,
en_name
=
en_name
,
alias
=
alias
,
is_online
=
is_online
,
has_area
=
has_area
,
has_brand
=
has_brand
,
has_image
=
has_image
,
brand_id
=
brand_id
,
classify_id
=
classify_id
,
category_id
=
category_id
,
price_low
=
price_low
,
price_high
=
price_high
,
grade_low
=
grade_low
,
grade_high
=
grade_high
,
comment_nums_low
=
comment_nums_low
,
comment_nums_high
=
comment_nums_high
)
.
unwrap
()
product_ids
=
[
obj
.
get
(
'id'
)
for
obj
in
data
]
brand_product_dict
=
self
.
get_brand_infos
(
product_ids
)
category_product_dict
=
self
.
get_category_infos
(
product_ids
)
effect_product_dict
=
self
.
get_effect_infos
(
product_ids
)
classify_product_dict
=
self
.
get_classify_infos
(
product_ids
)
print
(
category_product_dict
,
effect_product_dict
,
classify_product_dict
)
for
obj
in
data
:
product_id
=
obj
.
get
(
'id'
)
...
...
@@ -99,7 +100,7 @@ class ProductListView(APIView):
count
=
self
.
rpc
[
'neptune/commodity/product/count'
](
id_
=
id_
,
cn_name
=
cn_name
,
en_name
=
en_name
,
alias
=
alias
,
is_online
=
is_online
,
has_area
=
has_area
,
has_brand
=
has_brand
,
has_image
=
has_image
,
brand_id
=
brand_id
,
category_id
=
category_id
,
price_low
=
price_low
,
price_high
=
price_high
,
has_image
=
has_image
,
brand_id
=
brand_id
,
category_id
=
category_id
,
classify_id
=
classify_id
,
price_low
=
price_low
,
price_high
=
price_high
,
grade_low
=
grade_low
,
grade_high
=
grade_high
,
comment_nums_low
=
comment_nums_low
,
comment_nums_high
=
comment_nums_high
)
.
unwrap
()
result
=
{
'list'
:
data
,
...
...
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