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
a246188b
Commit
a246188b
authored
Sep 24, 2019
by
zhongshangwu
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix
parent
dafbd47a
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
14 additions
and
9 deletions
+14
-9
product.py
api/product.py
+14
-9
No files found.
api/product.py
View file @
a246188b
...
...
@@ -73,9 +73,9 @@ class ProductListView(APIView):
sorted_condition
=
request
.
GET
.
get
(
'sorted_condition'
,
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
,
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
,
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
,
effect_name
=
effect_name
,
sorted_condition
=
sorted_condition
)
.
unwrap
()
...
...
@@ -90,11 +90,11 @@ class ProductListView(APIView):
obj
[
'brand_info'
]
=
{
'id'
:
brand_product_dict
.
get
(
str
(
product_id
))
.
get
(
'id'
),
'cn_name'
:
brand_product_dict
.
get
(
str
(
product_id
))
.
get
(
'cn_name'
)}
if
brand_product_dict
.
get
(
str
(
product_id
))
else
''
obj
[
'category_infos'
]
=
[{
'id'
:
obj
.
get
(
'id'
),
'cn_name'
:
obj
.
get
(
'cn_name'
)}
obj
[
'category_infos'
]
=
[{
'id'
:
obj
.
get
(
'id'
),
'cn_name'
:
obj
.
get
(
'cn_name'
)}
for
obj
in
category_product_dict
.
get
(
str
(
product_id
))]
if
category_product_dict
.
get
(
str
(
product_id
))
else
[]
obj
[
'effect_infos'
]
=
[{
'id'
:
obj
.
get
(
'id'
),
'cn_name'
:
obj
.
get
(
'cn_name'
)}
obj
[
'effect_infos'
]
=
[{
'id'
:
obj
.
get
(
'id'
),
'cn_name'
:
obj
.
get
(
'cn_name'
)}
for
obj
in
effect_product_dict
.
get
(
str
(
product_id
))]
if
effect_product_dict
.
get
(
str
(
product_id
))
else
[]
obj
[
'classify_infos'
]
=
[{
'id'
:
obj
.
get
(
'id'
),
'cn_name'
:
obj
.
get
(
'cn_name'
)}
obj
[
'classify_infos'
]
=
[{
'id'
:
obj
.
get
(
'id'
),
'cn_name'
:
obj
.
get
(
'cn_name'
)}
for
obj
in
classify_product_dict
.
get
(
str
(
product_id
))]
if
classify_product_dict
.
get
(
str
(
product_id
))
else
[]
obj
.
pop
(
'norms'
)
...
...
@@ -102,7 +102,7 @@ class ProductListView(APIView):
obj
.
pop
(
'platform'
)
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
,
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
,
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
,
effect_name
=
effect_name
)
.
unwrap
()
...
...
@@ -163,6 +163,7 @@ class ProductCreateView(APIView):
effect_ids
=
json
.
loads
(
request
.
POST
.
get
(
'effect_ids'
,
'[]'
))
is_online
=
request
.
POST
.
get
(
'is_online'
)
brand_id
=
request
.
POST
.
get
(
'brand_id'
)
period_of_use
=
request
.
POST
.
get
(
'period_of_use'
)
if
not
cn_name
or
not
image
:
return
r'缺少参数'
...
...
@@ -170,13 +171,15 @@ class ProductCreateView(APIView):
data
=
self
.
rpc
[
'neptune/commodity/product/create'
](
cn_name
=
cn_name
,
en_name
=
en_name
,
alias
=
alias
,
image
=
image
,
norms
=
norms
,
grade
=
grade
,
price
=
price
,
country
=
country
,
description
=
description
,
comment_nums
=
comment_nums
,
classify_ids
=
classify_ids
,
category_ids
=
category_ids
,
effect_ids
=
effect_ids
,
is_online
=
is_online
,
brand_id
=
brand_id
)
.
unwrap
()
category_ids
=
category_ids
,
effect_ids
=
effect_ids
,
is_online
=
is_online
,
brand_id
=
brand_id
,
period_of_use
=
period_of_use
)
.
unwrap
()
return
data
class
ProductUpdateView
(
APIView
):
def
post
(
self
,
request
):
id_
=
request
.
POST
.
get
(
'id'
)
cn_name
=
request
.
POST
.
get
(
'cn_name'
,
None
)
...
...
@@ -194,6 +197,7 @@ class ProductUpdateView(APIView):
effect_ids
=
json
.
loads
(
request
.
POST
.
get
(
'effect_ids'
,
'[]'
))
is_online
=
request
.
POST
.
get
(
'is_online'
)
brand_id
=
request
.
POST
.
get
(
'brand_id'
)
period_of_use
=
request
.
POST
.
get
(
'period_of_use'
,
0
)
if
not
id_
:
return
r'缺少参数'
...
...
@@ -201,7 +205,8 @@ class ProductUpdateView(APIView):
data
=
self
.
rpc
[
'neptune/commodity/product/update'
](
id_
=
id_
,
cn_name
=
cn_name
,
en_name
=
en_name
,
alias
=
alias
,
image
=
image
,
norms
=
norms
,
grade
=
grade
,
price
=
price
,
country
=
country
,
description
=
description
,
comment_nums
=
comment_nums
,
classify_ids
=
classify_ids
,
category_ids
=
category_ids
,
effect_ids
=
effect_ids
,
is_online
=
is_online
,
brand_id
=
brand_id
)
.
unwrap
()
category_ids
=
category_ids
,
effect_ids
=
effect_ids
,
is_online
=
is_online
,
brand_id
=
brand_id
,
period_of_use
=
period_of_use
)
.
unwrap
()
return
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