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
1
Merge Requests
1
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
alpha
sun
Commits
4b0f5061
Commit
4b0f5061
authored
Sep 27, 2019
by
钟尚武
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'test' into 'master'
Like 2.4上线 See merge request
!362
parents
8d3b5758
fee2da8a
Show whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
100 additions
and
5 deletions
+100
-5
product.py
api/product.py
+7
-2
reply.py
api/reply.py
+27
-2
survey.py
api/survey.py
+40
-0
tag.py
api/tag.py
+4
-1
topic.py
api/topic.py
+15
-0
urls.py
api/urls.py
+7
-0
No files found.
api/product.py
View file @
4b0f5061
...
@@ -163,6 +163,7 @@ class ProductCreateView(APIView):
...
@@ -163,6 +163,7 @@ class ProductCreateView(APIView):
effect_ids
=
json
.
loads
(
request
.
POST
.
get
(
'effect_ids'
,
'[]'
))
effect_ids
=
json
.
loads
(
request
.
POST
.
get
(
'effect_ids'
,
'[]'
))
is_online
=
request
.
POST
.
get
(
'is_online'
)
is_online
=
request
.
POST
.
get
(
'is_online'
)
brand_id
=
request
.
POST
.
get
(
'brand_id'
)
brand_id
=
request
.
POST
.
get
(
'brand_id'
)
period_of_use
=
request
.
POST
.
get
(
'period_of_use'
)
if
not
cn_name
or
not
image
:
if
not
cn_name
or
not
image
:
return
r'缺少参数'
return
r'缺少参数'
...
@@ -170,7 +171,9 @@ class ProductCreateView(APIView):
...
@@ -170,7 +171,9 @@ class ProductCreateView(APIView):
data
=
self
.
rpc
[
'neptune/commodity/product/create'
](
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
,
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
,
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
return
data
...
@@ -194,6 +197,7 @@ class ProductUpdateView(APIView):
...
@@ -194,6 +197,7 @@ class ProductUpdateView(APIView):
effect_ids
=
json
.
loads
(
request
.
POST
.
get
(
'effect_ids'
,
'[]'
))
effect_ids
=
json
.
loads
(
request
.
POST
.
get
(
'effect_ids'
,
'[]'
))
is_online
=
request
.
POST
.
get
(
'is_online'
)
is_online
=
request
.
POST
.
get
(
'is_online'
)
brand_id
=
request
.
POST
.
get
(
'brand_id'
)
brand_id
=
request
.
POST
.
get
(
'brand_id'
)
period_of_use
=
request
.
POST
.
get
(
'period_of_use'
,
0
)
if
not
id_
:
if
not
id_
:
return
r'缺少参数'
return
r'缺少参数'
...
@@ -201,7 +205,8 @@ class ProductUpdateView(APIView):
...
@@ -201,7 +205,8 @@ class ProductUpdateView(APIView):
data
=
self
.
rpc
[
'neptune/commodity/product/update'
](
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
,
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
,
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
return
data
...
...
api/reply.py
View file @
4b0f5061
...
@@ -99,17 +99,24 @@ class ReplyManageListView(APIView):
...
@@ -99,17 +99,24 @@ class ReplyManageListView(APIView):
to_create_time
=
request
.
GET
.
get
(
'to_create_time'
,
None
)
to_create_time
=
request
.
GET
.
get
(
'to_create_time'
,
None
)
from_topic_create_time
=
request
.
GET
.
get
(
'from_topic_create_time'
,
None
)
from_topic_create_time
=
request
.
GET
.
get
(
'from_topic_create_time'
,
None
)
to_topic_create_time
=
request
.
GET
.
get
(
'to_topic_create_time'
,
None
)
to_topic_create_time
=
request
.
GET
.
get
(
'to_topic_create_time'
,
None
)
user_kol
=
request
.
GET
.
get
(
'user_kol'
,
None
)
user_shadow
=
request
.
GET
.
get
(
'user_shadow'
,
None
)
user_edit
=
request
.
GET
.
get
(
'user_edit'
,
None
)
replied_user_kol
=
request
.
GET
.
get
(
'replied_user_kol'
,
None
)
replied_user_shadow
=
request
.
GET
.
get
(
'replied_user_shadow'
,
None
)
replied_user_edit
=
request
.
GET
.
get
(
'replied_user_edit'
,
None
)
other_filters
=
{}
other_filters
=
{}
if
topic_content
:
if
topic_content
:
other_filters
[
'topic_content'
]
=
topic_content
.
strip
()
other_filters
[
'topic_content'
]
=
topic_content
.
strip
()
if
reply_user_type
:
if
reply_user_type
:
reply_user_type
=
int
(
reply_user_type
)
reply_user_type
=
int
(
reply_user_type
)
if
reply_user_type
i
n
[
USER_EXTRA_TYPE
.
REAL
,
USER_EXTRA_TYPE
.
SHADOW
,
USER_EXTRA_TYPE
.
KOL
]
:
if
reply_user_type
i
s
not
None
:
other_filters
[
'reply_user_type'
]
=
reply_user_type
other_filters
[
'reply_user_type'
]
=
reply_user_type
if
replied_user_type
:
if
replied_user_type
:
replied_user_type
=
int
(
replied_user_type
)
replied_user_type
=
int
(
replied_user_type
)
if
replied_user_type
i
n
[
USER_EXTRA_TYPE
.
REAL
,
USER_EXTRA_TYPE
.
SHADOW
,
USER_EXTRA_TYPE
.
KOL
]
:
if
replied_user_type
i
s
not
None
:
other_filters
[
'replied_user_type'
]
=
replied_user_type
other_filters
[
'replied_user_type'
]
=
replied_user_type
if
from_topic_create_time
and
to_topic_create_time
:
if
from_topic_create_time
and
to_topic_create_time
:
other_filters
[
'topic_create_time__gte'
]
=
from_topic_create_time
other_filters
[
'topic_create_time__gte'
]
=
from_topic_create_time
...
@@ -137,6 +144,24 @@ class ReplyManageListView(APIView):
...
@@ -137,6 +144,24 @@ class ReplyManageListView(APIView):
filters
[
'create_time__gte'
]
=
from_create_time
filters
[
'create_time__gte'
]
=
from_create_time
filters
[
'create_time__lte'
]
=
to_create_time
filters
[
'create_time__lte'
]
=
to_create_time
if
user_kol
is
not
None
:
filters
[
'user_kol'
]
=
int
(
user_kol
)
if
user_shadow
is
not
None
:
filters
[
'user_shadow'
]
=
int
(
user_shadow
)
if
user_edit
is
not
None
:
filters
[
'user_edit'
]
=
int
(
user_edit
)
if
replied_user_edit
is
not
None
:
filters
[
'replied_user_edit'
]
=
int
(
replied_user_edit
)
if
replied_user_kol
is
not
None
:
filters
[
'replied_user_kol'
]
=
int
(
replied_user_kol
)
if
replied_user_shadow
is
not
None
:
filters
[
'replied_user_shadow'
]
=
int
(
replied_user_shadow
)
try
:
try
:
data
=
self
.
rpc
[
'venus/sun/reply/manage/list'
](
offset
=
(
page
-
1
)
*
limit
,
limit
=
limit
,
filters
=
filters
,
other_filters
=
other_filters
)
.
unwrap
()
data
=
self
.
rpc
[
'venus/sun/reply/manage/list'
](
offset
=
(
page
-
1
)
*
limit
,
limit
=
limit
,
filters
=
filters
,
other_filters
=
other_filters
)
.
unwrap
()
except
Exception
as
e
:
except
Exception
as
e
:
...
...
api/survey.py
0 → 100644
View file @
4b0f5061
import
json
from
utils.base
import
APIView
,
get_offset_count
class
SurveyListView
(
APIView
):
def
get
(
self
,
request
):
offset
,
count
=
get_offset_count
(
request
)
data
=
self
.
rpc
[
'venus/sun/survey/list'
](
offset
=
offset
,
count
=
count
)
.
unwrap
()
return
data
class
SurveyView
(
APIView
):
def
get
(
self
,
request
):
id_
=
int
(
request
.
GET
.
get
(
'template_id'
))
data
=
self
.
rpc
[
'venus/sun/survey/get'
](
id_
=
id_
)
.
unwrap
()
return
data
def
post
(
self
,
request
):
questions
=
json
.
loads
(
request
.
POST
.
get
(
'questions'
))
data
=
{
"name"
:
request
.
POST
.
get
(
'name'
,
""
),
"questions"
:
questions
,
"template_id"
:
int
(
request
.
POST
.
get
(
'template_id'
,
0
)),
}
self
.
rpc
[
'venus/sun/survey/add'
](
data
=
data
)
.
unwrap
()
return
{
"status"
:
1
}
api/tag.py
View file @
4b0f5061
...
@@ -60,7 +60,7 @@ class TagUpdateOrCreateView(APIView):
...
@@ -60,7 +60,7 @@ class TagUpdateOrCreateView(APIView):
official_pictorial_id
=
official_pictorial_id
[
0
]
official_pictorial_id
=
official_pictorial_id
[
0
]
else
:
else
:
official_pictorial_id
=
None
official_pictorial_id
=
None
is_expert
=
int
(
request
.
POST
.
get
(
'is_expert'
,
0
))
data
=
{
data
=
{
'name'
:
request
.
POST
.
get
(
'name'
)
.
lower
(),
'name'
:
request
.
POST
.
get
(
'name'
)
.
lower
(),
'description'
:
request
.
POST
.
get
(
'description'
,
''
),
'description'
:
request
.
POST
.
get
(
'description'
,
''
),
...
@@ -74,6 +74,9 @@ class TagUpdateOrCreateView(APIView):
...
@@ -74,6 +74,9 @@ class TagUpdateOrCreateView(APIView):
'is_core'
:
request
.
POST
.
get
(
'is_core'
,
0
),
'is_core'
:
request
.
POST
.
get
(
'is_core'
,
0
),
'official_pictorial_id'
:
official_pictorial_id
,
'official_pictorial_id'
:
official_pictorial_id
,
'is_show_in_register'
:
request
.
POST
.
get
(
'is_show_in_register'
,
'false'
),
'is_show_in_register'
:
request
.
POST
.
get
(
'is_show_in_register'
,
'false'
),
'is_expert'
:
request
.
POST
.
get
(
'is_expert'
,
0
),
'gray_badge'
:
request
.
POST
.
get
(
'gray_badge'
,
''
)
if
is_expert
else
""
,
'light_badge'
:
request
.
POST
.
get
(
'light_badge'
,
''
)
if
is_expert
else
""
,
'pictorial_ids'
:
list
(
'pictorial_ids'
:
list
(
(
map
(
lambda
x
:
int
(
x
.
split
(
":"
)[
0
]),
json
.
loads
((
request
.
POST
.
get
(
'pictorial_ids'
,
'[]'
))))))
(
map
(
lambda
x
:
int
(
x
.
split
(
":"
)[
0
]),
json
.
loads
((
request
.
POST
.
get
(
'pictorial_ids'
,
'[]'
))))))
}
}
...
...
api/topic.py
View file @
4b0f5061
...
@@ -6,10 +6,12 @@
...
@@ -6,10 +6,12 @@
import
json
import
json
from
utils.base
import
APIView
,
get_offset_count
from
utils.base
import
APIView
,
get_offset_count
from
utils.logger
import
error_logger
from
utils.logger
import
error_logger
from
alpha_types.venus
import
USER_EXTRA_TYPE
class
TopicListView
(
APIView
):
class
TopicListView
(
APIView
):
def
get
(
self
,
request
):
def
get
(
self
,
request
):
pictorial_id
=
request
.
GET
.
get
(
'pictorial_id'
,
''
)
pictorial_id
=
request
.
GET
.
get
(
'pictorial_id'
,
''
)
user_id
=
request
.
GET
.
get
(
'user_id'
,
''
)
user_id
=
request
.
GET
.
get
(
'user_id'
,
''
)
page
=
int
(
request
.
GET
.
get
(
'page'
,
1
))
page
=
int
(
request
.
GET
.
get
(
'page'
,
1
))
...
@@ -31,6 +33,18 @@ class TopicListView(APIView):
...
@@ -31,6 +33,18 @@ class TopicListView(APIView):
if
filters
.
get
(
"is_finished"
)
is
not
None
:
if
filters
.
get
(
"is_finished"
)
is
not
None
:
filters
[
"is_finished"
]
=
True
if
filters
.
get
(
"is_finished"
)
else
False
filters
[
"is_finished"
]
=
True
if
filters
.
get
(
"is_finished"
)
else
False
user_type
=
filters
.
pop
(
"user_type"
)
if
filters
.
get
(
"user_type"
)
else
None
if
user_type
:
if
int
(
user_type
)
==
USER_EXTRA_TYPE
.
COMMON
:
filters
[
"is_shadow"
]
=
0
elif
int
(
user_type
)
==
USER_EXTRA_TYPE
.
SHADOW
:
filters
[
"is_shadow"
]
=
1
elif
int
(
user_type
)
==
USER_EXTRA_TYPE
.
KOL
:
filters
[
"is_kol"
]
=
1
elif
int
(
user_type
)
==
USER_EXTRA_TYPE
.
EDIT
:
filters
[
"is_edit"
]
=
1
res
=
self
.
rpc
[
'physical/search/business/topic'
](
res
=
self
.
rpc
[
'physical/search/business/topic'
](
offset
=
(
page
-
1
)
*
limit
,
offset
=
(
page
-
1
)
*
limit
,
size
=
limit
,
size
=
limit
,
...
@@ -147,6 +161,7 @@ class TopicUpdateOrCreateView(APIView):
...
@@ -147,6 +161,7 @@ class TopicUpdateOrCreateView(APIView):
'is_recommend'
:
int
(
request
.
POST
.
get
(
'is_recommend'
,
0
)),
'is_recommend'
:
int
(
request
.
POST
.
get
(
'is_recommend'
,
0
)),
'body_esthetics_tag_ids'
:
body_esthetics_tag_ids
,
'body_esthetics_tag_ids'
:
body_esthetics_tag_ids
,
'product_id'
:
request
.
POST
.
get
(
'product_id'
),
'product_id'
:
request
.
POST
.
get
(
'product_id'
),
'product_recommend'
:
int
(
request
.
POST
.
get
(
'product_recommend'
,
0
)),
'have_face'
:
int
(
request
.
POST
.
get
(
'have_face'
,
0
)),
'have_face'
:
int
(
request
.
POST
.
get
(
'have_face'
,
0
)),
'is_finished'
:
int
(
request
.
POST
.
get
(
'is_finished'
,
1
)),
'is_finished'
:
int
(
request
.
POST
.
get
(
'is_finished'
,
1
)),
}
}
...
...
api/urls.py
View file @
4b0f5061
...
@@ -33,6 +33,7 @@ from .classify import *
...
@@ -33,6 +33,7 @@ from .classify import *
from
.effect
import
*
from
.effect
import
*
from
.skin_check
import
*
from
.skin_check
import
*
from
.reply
import
*
from
.reply
import
*
from
.survey
import
*
urlpatterns
=
[
urlpatterns
=
[
...
@@ -244,6 +245,12 @@ urlpatterns = [
...
@@ -244,6 +245,12 @@ urlpatterns = [
# 测肤
# 测肤
url
(
r'^skin_check/pictorial$'
,
SkinCheckPictorial
.
as_view
()),
url
(
r'^skin_check/pictorial$'
,
SkinCheckPictorial
.
as_view
()),
url
(
r'^skin_check/config$'
,
SkinCheckConfig
.
as_view
()),
url
(
r'^skin_check/config$'
,
SkinCheckConfig
.
as_view
()),
# 调查问卷
url
(
r'^survey_question/create$'
,
SurveyView
.
as_view
()),
url
(
r'^survey_question/get$'
,
SurveyView
.
as_view
()),
url
(
r'^survey_question/list$'
,
SurveyListView
.
as_view
()),
]
]
search_urlpatterns
=
[
search_urlpatterns
=
[
...
...
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