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
8abba4d7
Commit
8abba4d7
authored
Sep 23, 2019
by
杨成林
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'ycl/survey' into 'dev'
Ycl/survey See merge request
alpha/sun!355
parents
21bd1238
b9dbd592
Show whitespace changes
Inline
Side-by-side
Showing
10 changed files
with
257 additions
and
8 deletions
+257
-8
pictorial.py
api/pictorial.py
+36
-3
product.py
api/product.py
+13
-0
push.py
api/push.py
+47
-0
reply.py
api/reply.py
+10
-3
skin_check.py
api/skin_check.py
+3
-0
survey.py
api/survey.py
+37
-0
tag.py
api/tag.py
+80
-0
topic.py
api/topic.py
+5
-2
urls.py
api/urls.py
+17
-0
user.py
api/user.py
+9
-0
No files found.
api/pictorial.py
View file @
8abba4d7
...
...
@@ -48,9 +48,9 @@ class PictorialUpdateOrCreate(APIView):
id
=
int
(
request
.
POST
.
get
(
'id'
))
if
request
.
POST
.
get
(
'id'
)
else
None
star_ids
=
json
.
loads
(
request
.
POST
.
get
(
'star'
,
'[]'
))
pictorial_user_ids
=
json
.
loads
(
request
.
POST
.
get
(
'pictorial_user_ids'
,
'[]'
))
collection_tag_ids
=
json
.
loads
(
request
.
POST
.
get
(
'collection_tag_ids'
,
'[]'
))
pictorial_activity_id
=
request
.
POST
.
get
(
'pictorial_activity_id'
)
tab_config
=
request
.
POST
.
get
(
"tab_config"
,
"[]"
)
data
=
{
'name'
:
request
.
POST
.
get
(
'name'
,
''
),
'description'
:
request
.
POST
.
get
(
'description'
,
''
),
...
...
@@ -58,7 +58,6 @@ class PictorialUpdateOrCreate(APIView):
'celebrity_ids'
:
star_ids
,
'is_online'
:
int
(
request
.
POST
.
get
(
'is_online'
,
1
)),
'is_recommend'
:
int
(
request
.
POST
.
get
(
'is_recommend'
,
0
)),
'pictorial_user_ids'
:
pictorial_user_ids
,
'icon'
:
request
.
POST
.
get
(
'icon'
,
''
),
'collection_tag_ids'
:
collection_tag_ids
,
'is_home_recommend'
:
int
(
request
.
POST
.
get
(
'is_home_recommend'
,
0
)),
...
...
@@ -69,7 +68,7 @@ class PictorialUpdateOrCreate(APIView):
'pictorial_activity_ids'
:
[
int
(
pictorial_activity_id
)]
if
pictorial_activity_id
else
[],
'alias'
:
request
.
POST
.
get
(
'alias'
,
''
),
'comment_talk'
:
request
.
POST
.
get
(
'pictorial_comment_talk'
,
''
),
'tab_config'
:
json
.
loads
(
tab_config
),
}
try
:
data
=
self
.
rpc
[
'venus/sun/pictorial/edit'
](
id
=
id
,
data
=
data
)
.
unwrap
()
...
...
@@ -198,3 +197,37 @@ class PictorialTopicDel(APIView):
return
{
'message'
:
'删除成功'
}
class
PictorialFollowsDel
(
APIView
):
"""删除榜单中的关注者"""
def
post
(
self
,
request
):
pictorial_id
=
int
(
request
.
POST
.
get
(
'pictorial_id'
,
0
))
user_ids
=
json
.
loads
(
request
.
POST
.
get
(
'user_ids'
,
'[]'
))
user_ids
=
[
int
(
item
)
for
item
in
user_ids
]
try
:
self
.
rpc
[
'venus/sun/pictorial/follows/del'
](
pictorial_id
=
pictorial_id
,
user_ids
=
user_ids
)
.
unwrap
()
except
Exception
as
e
:
error_logger
.
error
(
u'操作失败
%
s'
%
(
e
))
raise
return
{
'message'
:
'删除成功'
}
class
PictorialFollowsAdd
(
APIView
):
"""新增榜单中的关注者"""
def
post
(
self
,
request
):
pictorial_id
=
int
(
request
.
POST
.
get
(
'pictorial_id'
,
0
))
user_ids
=
json
.
loads
(
request
.
POST
.
get
(
'user_ids'
,
'[]'
))
user_ids
=
[
int
(
item
)
for
item
in
user_ids
]
try
:
self
.
rpc
[
'venus/sun/pictorial/follows/add'
](
pictorial_id
=
pictorial_id
,
user_ids
=
user_ids
)
.
unwrap
()
except
Exception
as
e
:
error_logger
.
error
(
u'操作失败
%
s'
%
(
e
))
raise
return
{
'message'
:
'添加成功'
}
api/product.py
View file @
8abba4d7
...
...
@@ -204,3 +204,16 @@ class ProductUpdateView(APIView):
category_ids
=
category_ids
,
effect_ids
=
effect_ids
,
is_online
=
is_online
,
brand_id
=
brand_id
)
.
unwrap
()
return
data
class
ProductSearchView
(
APIView
):
def
post
(
self
,
request
):
name
=
request
.
POST
.
get
(
'name'
)
if
not
name
:
return
r'缺少参数'
data
=
self
.
rpc
[
'neptune/commodity/product/search'
](
name
=
name
)
.
unwrap
()
return
data
api/push.py
View file @
8abba4d7
...
...
@@ -75,3 +75,50 @@ class EffectPushTaskView(APIView):
return
{
'message'
:
'操作成功'
}
class
PushBlackListView
(
APIView
):
def
get
(
self
,
request
):
page
=
int
(
request
.
GET
.
get
(
'page'
,
1
))
limit
=
int
(
request
.
GET
.
get
(
'limit'
,
10
))
try
:
data
=
self
.
rpc
[
'venus/sun/push/black_list'
](
offset
=
(
page
-
1
)
*
limit
,
limit
=
limit
)
.
unwrap
()
except
Exception
as
e
:
error_logger
.
error
(
u'获取push黑名单列表失败
%
s'
,
e
)
raise
return
data
class
AddBlackListView
(
APIView
):
def
post
(
self
,
request
):
user_id
=
request
.
POST
.
get
(
'user_id'
)
.
split
(
':'
)[
0
]
try
:
self
.
rpc
[
'venus/sun/push/add_black_list'
](
user_id
=
user_id
)
.
unwrap
()
except
Exception
as
e
:
error_logger
.
error
(
u'添加失败
%
s'
,
e
)
raise
return
{
"message"
:
'添加成功'
}
class
RmBlackListView
(
APIView
):
def
post
(
self
,
request
):
user_id
=
request
.
POST
.
get
(
'user_id'
)
.
split
(
':'
)[
0
]
try
:
self
.
rpc
[
'venus/sun/push/rm_black_list'
](
user_id
=
user_id
)
.
unwrap
()
except
Exception
as
e
:
error_logger
.
error
(
u'删除失败
%
s'
,
e
)
raise
return
{
"message"
:
'添加成功'
}
api/reply.py
View file @
8abba4d7
...
...
@@ -72,7 +72,7 @@ class ReplyVote(APIView):
vote_num
=
int
(
request
.
POST
.
get
(
'vote_num'
))
try
:
self
.
rpc
[
'venus/sun/reply/vote'
](
reply_id
=
reply_id
,
vote_num
=
vote_num
)
.
unwrap
()
self
.
rpc
[
'venus/sun/reply/vote'
](
reply_id
=
reply_id
,
v
irtual_v
ote_num
=
vote_num
)
.
unwrap
()
except
Exception
as
e
:
error_logger
.
error
(
u'编辑帖子失败
%
s'
,
e
)
raise
...
...
@@ -178,9 +178,16 @@ class ReplyManageBatchUpdate(APIView):
def
post
(
self
,
request
):
ids
=
json
.
loads
(
request
.
POST
.
get
(
'ids'
,
'[]'
))
is_online
=
request
.
POST
.
get
(
'is_online'
,
None
)
data
=
{
}
if
request
.
POST
.
get
(
'is_online'
)
is
not
None
:
data
[
'is_online'
]
=
True
if
int
(
request
.
POST
.
get
(
'is_online'
,
0
))
else
False
if
request
.
POST
.
get
(
'is_quality'
)
is
not
None
:
data
[
'is_quality'
]
=
True
if
int
(
request
.
POST
.
get
(
'is_quality'
,
0
))
else
False
try
:
rep
=
self
.
rpc
[
'venus/sun/reply/manage/batch/update'
](
ids
=
ids
,
is_online
=
is_online
)
.
unwrap
()
rep
=
self
.
rpc
[
'venus/sun/reply/manage/batch/update'
](
ids
=
ids
,
data
=
data
)
.
unwrap
()
except
Exception
as
e
:
error_logger
.
error
(
u'更新-reply信息失败
%
s'
%
(
e
))
raise
...
...
api/skin_check.py
View file @
8abba4d7
...
...
@@ -101,6 +101,9 @@ class SkinCheckConfig(APIView):
return
text
.
replace
(
" "
,
""
)
def
_input_string_check
(
self
,
text
,
check_str
):
# 允许输入为空
if
not
text
:
return
True
"""
输入内容标签符号校验,是否都是 check_str
:param text:
...
...
api/survey.py
0 → 100644
View file @
8abba4d7
from
utils.base
import
APIView
class
SurveyListView
(
APIView
):
def
get
(
self
,
request
):
data
=
self
.
rpc
[
'venus/sun/survey/list'
]()
.
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
=
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 @
8abba4d7
...
...
@@ -6,6 +6,7 @@
import
json
from
utils.base
import
APIView
,
get_offset_count
from
utils.logger
import
error_logger
from
alpha_types.venus.error
import
ERROR
class
TagListView
(
APIView
):
...
...
@@ -53,6 +54,12 @@ class TagUpdateOrCreateView(APIView):
down_tags
=
list
(
set
(
map
(
lambda
x
:
x
.
split
(
":"
)[
0
],
json
.
loads
((
request
.
POST
.
get
(
'down_tags'
,
'[]'
))))))
up_tags
=
list
(
set
(
map
(
lambda
x
:
x
.
split
(
":"
)[
0
],
json
.
loads
((
request
.
POST
.
get
(
'up_tags'
,
'[]'
))))))
tagtypes
=
list
(
set
(
map
(
lambda
x
:
x
.
split
(
":"
)[
0
],
json
.
loads
((
request
.
POST
.
get
(
'tagtypes'
,
'[]'
))))))
request
.
POST
.
get
(
'official_pictorial_id'
,
''
)
.
split
(
":"
)
official_pictorial_id
=
request
.
POST
.
get
(
'official_pictorial_id'
,
''
)
.
split
(
":"
)
if
official_pictorial_id
:
official_pictorial_id
=
official_pictorial_id
[
0
]
else
:
official_pictorial_id
=
None
data
=
{
'name'
:
request
.
POST
.
get
(
'name'
)
.
lower
(),
...
...
@@ -64,6 +71,8 @@ class TagUpdateOrCreateView(APIView):
'platform'
:
request
.
POST
.
get
(
'platform'
,
1
),
'collection'
:
request
.
POST
.
get
(
'collection'
,
0
),
'alias'
:
request
.
POST
.
get
(
'alias'
,
''
),
'is_core'
:
request
.
POST
.
get
(
'is_core'
,
0
),
'official_pictorial_id'
:
official_pictorial_id
,
'is_show_in_register'
:
request
.
POST
.
get
(
'is_show_in_register'
,
'false'
),
'pictorial_ids'
:
list
(
(
map
(
lambda
x
:
int
(
x
.
split
(
":"
)[
0
]),
json
.
loads
((
request
.
POST
.
get
(
'pictorial_ids'
,
'[]'
))))))
...
...
@@ -246,3 +255,74 @@ class SearchDefaultKeyword(APIView):
error_logger
.
error
(
u'更新搜索默认关键字失败
%
s'
,
e
)
raise
return
data
class
TagSetListView
(
APIView
):
def
get
(
self
,
request
):
offset
=
int
(
request
.
GET
.
get
(
'offset'
,
1
))
limit
=
int
(
request
.
GET
.
get
(
'limit'
,
10
))
q
=
request
.
GET
.
get
(
'q'
,
""
)
type_
=
request
.
GET
.
get
(
'type'
,
""
)
try
:
data
=
self
.
rpc
[
'venus/sun/tag_set/list'
](
offset
=
(
offset
-
1
)
*
limit
,
limit
=
limit
,
q
=
q
,
type_
=
type_
)
.
unwrap
()
except
Exception
as
e
:
error_logger
.
error
(
u'获取词集列表失败
%
s'
,
e
)
raise
return
data
class
TagSetDeleteView
(
APIView
):
def
post
(
self
,
request
):
tag_set_id
=
request
.
POST
.
get
(
"id"
)
try
:
data
=
self
.
rpc
[
'venus/sun/tag_set/delete'
](
tag_set_id
=
tag_set_id
)
.
unwrap
()
except
Exception
as
e
:
error_logger
.
error
(
u'删除词集失败
%
s'
,
e
)
raise
return
{
"message"
:
"删除成功"
,
"code"
:
200
}
class
TagSetUpdateOrCreateView
(
APIView
):
def
post
(
self
,
request
):
tag_set_id
=
int
(
request
.
POST
.
get
(
"id"
,
0
)
or
0
)
name
=
request
.
POST
.
get
(
"name"
,
""
)
tag_ids
=
json
.
loads
(
request
.
POST
.
get
(
"tag_ids"
,
'[]'
))
if
tag_set_id
:
try
:
data
=
self
.
rpc
[
'venus/sun/tag_set/update'
](
tag_set_id
=
tag_set_id
,
name
=
name
,
tag_ids
=
tag_ids
)
.
unwrap
()
except
Exception
as
e
:
if
e
.
error
==
ERROR
.
TAG_SET_HAD_EXIST
:
return
{
'message'
:
e
.
message
,
'code'
:
500
}
else
:
error_logger
.
error
(
u'更新词集失败
%
s'
,
e
)
raise
return
{
"message"
:
"更新成功"
,
"code"
:
200
}
else
:
try
:
data
=
self
.
rpc
[
'venus/sun/tag_set/create'
](
name
=
name
,
tag_ids
=
tag_ids
)
.
unwrap
()
except
Exception
as
e
:
if
e
.
error
==
ERROR
.
TAG_SET_HAD_EXIST
:
return
{
'message'
:
e
.
message
,
'code'
:
500
}
else
:
error_logger
.
error
(
u'创建词集失败
%
s'
,
e
)
raise
return
{
"message"
:
"创建成功"
,
"code"
:
200
}
api/topic.py
View file @
8abba4d7
...
...
@@ -28,6 +28,8 @@ class TopicListView(APIView):
filters
.
update
({
'drop_score'
:
int
(
drop_score
)})
elif
int
(
drop_score
)
==
1
:
filters
.
update
({
'drop_score__exclude'
:
int
(
drop_score
)})
if
filters
.
get
(
"is_finished"
)
is
not
None
:
filters
[
"is_finished"
]
=
True
if
filters
.
get
(
"is_finished"
)
else
False
res
=
self
.
rpc
[
'physical/search/business/topic'
](
offset
=
(
page
-
1
)
*
limit
,
...
...
@@ -121,7 +123,6 @@ class TopicUpdateOrCreateView(APIView):
topic_images
=
list
(
map
(
lambda
x
:
x
[:
-
2
],
json
.
loads
(
request
.
POST
.
get
(
'topic_images'
,
'[]'
))))
tag_ids
=
list
(
map
(
lambda
x
:
x
.
split
(
':'
)[
0
],
json
.
loads
(
request
.
POST
.
get
(
'tags'
,
'[]'
))))
collection_tag_ids
=
list
(
map
(
lambda
x
:
x
.
split
(
':'
)[
0
],
json
.
loads
(
request
.
POST
.
get
(
'collection_tags'
,
'[]'
))))
cut_word_tag_ids
=
list
(
map
(
lambda
x
:
x
.
split
(
':'
)[
0
],
json
.
loads
(
request
.
POST
.
get
(
'cut_word_tags'
,
'[]'
))))
body_esthetics_tag_ids
=
list
(
map
(
lambda
x
:
x
.
split
(
':'
)[
0
],
json
.
loads
(
request
.
POST
.
get
(
'body_esthetics_tags'
,
'[]'
))))
pictorial_ids
=
list
(
json
.
loads
(
request
.
POST
.
get
(
'pictorial_ids'
,
'[]'
)))
...
...
@@ -137,7 +138,6 @@ class TopicUpdateOrCreateView(APIView):
'star_id'
:
request
.
POST
.
get
(
'star'
,
''
)
.
split
(
':'
)[
0
],
'tag_ids'
:
tag_ids
,
'collection_tag_ids'
:
collection_tag_ids
,
'cut_word_tag_ids'
:
cut_word_tag_ids
,
'is_online'
:
int
(
request
.
POST
.
get
(
'is_online'
,
0
)),
'drop_score'
:
int
(
request
.
POST
.
get
(
'drop_score'
,
0
)),
'has_image'
:
1
if
topic_images
else
0
,
...
...
@@ -146,6 +146,9 @@ class TopicUpdateOrCreateView(APIView):
'is_home'
:
int
(
request
.
POST
.
get
(
'is_home'
,
0
)),
'is_recommend'
:
int
(
request
.
POST
.
get
(
'is_recommend'
,
0
)),
'body_esthetics_tag_ids'
:
body_esthetics_tag_ids
,
'product_id'
:
request
.
POST
.
get
(
'product_id'
),
'have_face'
:
int
(
request
.
POST
.
get
(
'have_face'
,
0
)),
'is_finished'
:
int
(
request
.
POST
.
get
(
'is_finished'
,
1
)),
}
try
:
self
.
rpc
[
'venus/sun/topic/edit'
](
id
=
id
,
data
=
data
)
.
unwrap
()
...
...
api/urls.py
View file @
8abba4d7
...
...
@@ -33,6 +33,7 @@ from .classify import *
from
.effect
import
*
from
.skin_check
import
*
from
.reply
import
*
from
.survey
import
*
urlpatterns
=
[
...
...
@@ -78,6 +79,9 @@ urlpatterns = [
url
(
r'^push/create'
,
PushUpdateOrCreateView
.
as_view
()),
url
(
r'^push/detail'
,
PushUpdateOrCreateView
.
as_view
()),
url
(
r'^push/effect_push'
,
EffectPushTaskView
.
as_view
()),
url
(
r'^push/black_list'
,
PushBlackListView
.
as_view
()),
url
(
r'^push/add_black_list'
,
AddBlackListView
.
as_view
()),
url
(
r'^push/rm_black_list'
,
RmBlackListView
.
as_view
()),
# pick相关
url
(
r'^pick/list$'
,
PickListView
.
as_view
()),
...
...
@@ -110,6 +114,10 @@ urlpatterns = [
url
(
r'^tag/tagtype/create$'
,
TagTypeUpdateOrCreateView
.
as_view
()),
url
(
r'^tag/tagtype/detail$'
,
TagTypeUpdateOrCreateView
.
as_view
()),
url
(
r'^tag_set/list$'
,
TagSetListView
.
as_view
()),
url
(
r'^tag_set/create$'
,
TagSetUpdateOrCreateView
.
as_view
()),
url
(
r'^tag_set/delete$'
,
TagSetDeleteView
.
as_view
()),
# 扫脸相关
url
(
r'^face/star/create$'
,
FaceStarEdit
.
as_view
()),
url
(
r'^face/star/list$'
,
StarListView
.
as_view
()),
...
...
@@ -154,6 +162,8 @@ urlpatterns = [
url
(
r'^pictorial/feed/rank$'
,
PictorialFeedlRank
.
as_view
()),
url
(
r'^pictorial/feed/delete$'
,
PictorialFeedDelete
.
as_view
()),
url
(
r'^pictorial/topic/list$'
,
PictorialTopicList
.
as_view
()),
url
(
r'^pictorial/follows/del$'
,
PictorialFollowsDel
.
as_view
()),
url
(
r'^pictorial/follows/add$'
,
PictorialFollowsAdd
.
as_view
()),
#运营位
url
(
r'^topic/home_recommend/list'
,
TopicHomeRecommendList
.
as_view
()),
...
...
@@ -208,6 +218,7 @@ urlpatterns = [
url
(
r'^product/create$'
,
ProductCreateView
.
as_view
()),
url
(
r'^product/update$'
,
ProductUpdateView
.
as_view
()),
url
(
r'^product/info$'
,
ProductInfoView
.
as_view
()),
url
(
r'^product/search'
,
ProductSearchView
.
as_view
()),
# 商品类目
url
(
r'^category/list$'
,
CategoryListView
.
as_view
()),
...
...
@@ -234,6 +245,12 @@ urlpatterns = [
# 测肤
url
(
r'^skin_check/pictorial$'
,
SkinCheckPictorial
.
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
=
[
...
...
api/user.py
View file @
8abba4d7
...
...
@@ -66,6 +66,13 @@ class UserUpdateOrCreate(APIView):
body_esthetics_tag_ids
=
list
(
map
(
lambda
x
:
x
.
split
(
':'
)[
0
],
json
.
loads
(
request
.
POST
.
get
(
'body_esthetics_tags'
,
'[]'
))))
expert_tags
=
json
.
loads
(
request
.
POST
.
get
(
'expert_tags'
,
'[]'
))
try
:
expert_tag_ids
=
[[
int
(
item
[
0
]
.
split
(
":"
)[
0
]),
int
(
item
[
1
])]
for
item
in
expert_tags
]
except
:
error_logger
.
error
(
u'创建/编辑
%
s用户详情失败
%
s'
%
(
id
,
e
))
raise
data
=
{
'user_id'
:
user_id
,
'password'
:
password
,
...
...
@@ -80,7 +87,9 @@ class UserUpdateOrCreate(APIView):
'gender'
:
request
.
POST
.
get
(
'gender'
),
'is_tcc'
:
int
(
request
.
POST
.
get
(
'is_tcc'
,
0
)),
'body_esthetics_tag_ids'
:
body_esthetics_tag_ids
,
'expert_tag_ids'
:
expert_tag_ids
,
'is_kol'
:
int
(
request
.
POST
.
get
(
'is_kol'
,
0
)),
'is_edit'
:
int
(
request
.
POST
.
get
(
'is_edit'
,
0
)),
}
try
:
...
...
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