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
10763992
Commit
10763992
authored
Dec 04, 2018
by
Davve
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
接入日志
parent
334aa545
Hide whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
107 additions
and
48 deletions
+107
-48
account.py
api/account.py
+15
-7
group.py
api/group.py
+16
-7
pick.py
api/pick.py
+16
-7
push.py
api/push.py
+10
-4
star.py
api/star.py
+11
-5
tag.py
api/tag.py
+10
-4
topic.py
api/topic.py
+15
-7
user.py
api/user.py
+10
-4
logger.py
utils/logger.py
+4
-3
No files found.
api/account.py
View file @
10763992
...
@@ -5,6 +5,7 @@
...
@@ -5,6 +5,7 @@
from
django.conf
import
settings
from
django.conf
import
settings
from
utils.base
import
APIView
from
utils.base
import
APIView
from
utils.user_util
import
make_password
from
utils.user_util
import
make_password
from
utils.logger
import
error_logger
class
AccountList
(
APIView
):
class
AccountList
(
APIView
):
...
@@ -15,7 +16,8 @@ class AccountList(APIView):
...
@@ -15,7 +16,8 @@ class AccountList(APIView):
try
:
try
:
data
=
self
.
rpc
[
'venus/sun/account/list'
](
offset
=
(
page
-
1
)
*
limit
,
limit
=
limit
,
filters
=
filter
)
.
unwrap
()
data
=
self
.
rpc
[
'venus/sun/account/list'
](
offset
=
(
page
-
1
)
*
limit
,
limit
=
limit
,
filters
=
filter
)
.
unwrap
()
except
Exception
as
e
:
except
Exception
as
e
:
raise
e
error_logger
.
error
(
u'获取账户列表失败,
%
s'
,
e
)
raise
return
data
return
data
def
post
(
self
,
request
):
def
post
(
self
,
request
):
...
@@ -29,7 +31,8 @@ class AccountList(APIView):
...
@@ -29,7 +31,8 @@ class AccountList(APIView):
try
:
try
:
self
.
rpc
[
'venus/sun/account/batch/update'
](
updates
=
updates
,
ids
=
ids
)
.
unwrap
()
self
.
rpc
[
'venus/sun/account/batch/update'
](
updates
=
updates
,
ids
=
ids
)
.
unwrap
()
except
Exception
as
e
:
except
Exception
as
e
:
raise
e
error_logger
.
error
(
u'上下线更新失败,
%
s'
,
e
)
raise
return
{
return
{
"message"
:
"更新成功"
"message"
:
"更新成功"
}
}
...
@@ -41,7 +44,8 @@ class AccountUpdateOrCreateView(APIView):
...
@@ -41,7 +44,8 @@ class AccountUpdateOrCreateView(APIView):
try
:
try
:
data
=
self
.
rpc
[
'venus/sun/account/get'
](
id
=
id
)
.
unwrap
()
data
=
self
.
rpc
[
'venus/sun/account/get'
](
id
=
id
)
.
unwrap
()
except
Exception
as
e
:
except
Exception
as
e
:
raise
e
error_logger
.
error
(
u'获取账户
%
s失败,
%
s'
%
(
id
,
e
))
raise
return
{
'data'
:
data
}
return
{
'data'
:
data
}
def
post
(
self
,
request
):
def
post
(
self
,
request
):
...
@@ -57,7 +61,8 @@ class AccountUpdateOrCreateView(APIView):
...
@@ -57,7 +61,8 @@ class AccountUpdateOrCreateView(APIView):
try
:
try
:
data
=
self
.
rpc
[
'venus/sun/account/edit'
](
id
=
id
,
data
=
data
)
.
unwrap
()
data
=
self
.
rpc
[
'venus/sun/account/edit'
](
id
=
id
,
data
=
data
)
.
unwrap
()
except
Exception
as
e
:
except
Exception
as
e
:
raise
e
error_logger
.
error
(
u'编辑账户
%
s失败,
%
s'
%
(
id
,
e
))
raise
return
data
return
data
...
@@ -74,7 +79,8 @@ class LoginView(APIView):
...
@@ -74,7 +79,8 @@ class LoginView(APIView):
'avatar'
:
settings
.
AVATAR
'avatar'
:
settings
.
AVATAR
})
})
except
Exception
as
e
:
except
Exception
as
e
:
raise
e
error_logger
.
error
(
u'获取用户信息失败,
%
s'
%
(
id
,
e
))
raise
return
{
'data'
:
data
}
return
{
'data'
:
data
}
def
post
(
self
,
request
):
def
post
(
self
,
request
):
...
@@ -105,7 +111,8 @@ class LoginView(APIView):
...
@@ -105,7 +111,8 @@ class LoginView(APIView):
'message'
:
data
[
'message'
]
'message'
:
data
[
'message'
]
}
}
except
Exception
as
e
:
except
Exception
as
e
:
raise
e
error_logger
.
error
(
u'登陆失败
%
s'
,
e
)
raise
return
{
return
{
'data'
:
data
'data'
:
data
}
}
...
@@ -126,7 +133,8 @@ class ResetPasswordView(APIView):
...
@@ -126,7 +133,8 @@ class ResetPasswordView(APIView):
try
:
try
:
self
.
rpc
[
'venus/sun/account/reset_password'
](
id
=
id
,
password
=
password
)
.
unwrap
()
self
.
rpc
[
'venus/sun/account/reset_password'
](
id
=
id
,
password
=
password
)
.
unwrap
()
except
Exception
as
e
:
except
Exception
as
e
:
raise
e
error_logger
.
error
(
u'
%
s重置密码失败
%
s'
%
(
id
,
e
))
raise
return
{
return
{
'message'
:
'操作成功'
'message'
:
'操作成功'
}
}
...
...
api/group.py
View file @
10763992
...
@@ -5,6 +5,7 @@
...
@@ -5,6 +5,7 @@
import
json
import
json
from
utils.base
import
APIView
from
utils.base
import
APIView
from
utils.logger
import
error_logger
class
GroupListView
(
APIView
):
class
GroupListView
(
APIView
):
...
@@ -21,7 +22,8 @@ class GroupListView(APIView):
...
@@ -21,7 +22,8 @@ class GroupListView(APIView):
try
:
try
:
data
=
self
.
rpc
[
'venus/sun/group/list'
](
filters
=
filters
,
offset
=
(
offset
-
1
)
*
limit
,
limit
=
limit
)
.
unwrap
()
data
=
self
.
rpc
[
'venus/sun/group/list'
](
filters
=
filters
,
offset
=
(
offset
-
1
)
*
limit
,
limit
=
limit
)
.
unwrap
()
except
Exception
as
e
:
except
Exception
as
e
:
raise
e
error_logger
.
error
(
u'获取小组列表失败
%
s'
,
e
)
raise
return
data
return
data
def
post
(
self
,
request
):
def
post
(
self
,
request
):
...
@@ -37,7 +39,8 @@ class GroupListView(APIView):
...
@@ -37,7 +39,8 @@ class GroupListView(APIView):
try
:
try
:
self
.
rpc
[
'venus/sun/group/batch/update'
](
updates
=
updates
,
ids
=
ids
)
.
unwrap
()
self
.
rpc
[
'venus/sun/group/batch/update'
](
updates
=
updates
,
ids
=
ids
)
.
unwrap
()
except
Exception
as
e
:
except
Exception
as
e
:
raise
e
error_logger
.
error
(
u'批量更新失败
%
s'
,
e
)
raise
return
{
return
{
"message"
:
"更新成功"
"message"
:
"更新成功"
}
}
...
@@ -49,7 +52,8 @@ class GroupUpdateOrCreate(APIView):
...
@@ -49,7 +52,8 @@ class GroupUpdateOrCreate(APIView):
try
:
try
:
data
=
self
.
rpc
[
'venus/sun/group/get'
](
id
=
id
)
.
unwrap
()
data
=
self
.
rpc
[
'venus/sun/group/get'
](
id
=
id
)
.
unwrap
()
except
Exception
as
e
:
except
Exception
as
e
:
raise
e
error_logger
.
error
(
u'获取
%
d用户信息失败
%
s'
%
(
id
,
e
))
raise
return
data
return
data
def
post
(
self
,
request
):
def
post
(
self
,
request
):
...
@@ -69,7 +73,8 @@ class GroupUpdateOrCreate(APIView):
...
@@ -69,7 +73,8 @@ class GroupUpdateOrCreate(APIView):
try
:
try
:
self
.
rpc
[
'venus/sun/group/edit'
](
id
=
id
,
data
=
data
)
.
unwrap
()
self
.
rpc
[
'venus/sun/group/edit'
](
id
=
id
,
data
=
data
)
.
unwrap
()
except
Exception
as
e
:
except
Exception
as
e
:
raise
e
error_logger
.
error
(
u'编辑
%
d用户信息失败
%
s'
%
(
id
,
e
))
raise
return
{
return
{
'message'
:
'更新成功'
'message'
:
'更新成功'
}
}
...
@@ -84,7 +89,8 @@ class GroupRelatedUser(APIView):
...
@@ -84,7 +89,8 @@ class GroupRelatedUser(APIView):
try
:
try
:
data
=
self
.
rpc
[
'venus/sun/group/user/list'
](
filters
=
filters
,
offset
=
(
offset
-
1
)
*
count
,
limit
=
count
)
.
unwrap
()
data
=
self
.
rpc
[
'venus/sun/group/user/list'
](
filters
=
filters
,
offset
=
(
offset
-
1
)
*
count
,
limit
=
count
)
.
unwrap
()
except
Exception
as
e
:
except
Exception
as
e
:
raise
e
error_logger
.
error
(
u'获取小组用户信息失败
%
s'
,
e
)
raise
return
data
return
data
...
@@ -94,7 +100,8 @@ class GroupRelatedUserGET(APIView):
...
@@ -94,7 +100,8 @@ class GroupRelatedUserGET(APIView):
try
:
try
:
data
=
self
.
rpc
[
'venus/sun/group/user/get'
](
id
=
id
)
.
unwrap
()
data
=
self
.
rpc
[
'venus/sun/group/user/get'
](
id
=
id
)
.
unwrap
()
except
Exception
as
e
:
except
Exception
as
e
:
raise
e
error_logger
.
error
(
u'获取小组用户信息失败
%
s'
,
e
)
raise
return
[
data
,
]
return
[
data
,
]
def
post
(
self
,
request
):
def
post
(
self
,
request
):
...
@@ -106,5 +113,6 @@ class GroupRelatedUserGET(APIView):
...
@@ -106,5 +113,6 @@ class GroupRelatedUserGET(APIView):
try
:
try
:
self
.
rpc
[
'venus/sun/group/user/edit'
](
id
=
group_id
,
user_id
=
user_id
,
data
=
data
)
.
unwrap
()
self
.
rpc
[
'venus/sun/group/user/edit'
](
id
=
group_id
,
user_id
=
user_id
,
data
=
data
)
.
unwrap
()
except
Exception
as
e
:
except
Exception
as
e
:
raise
e
error_logger
.
error
(
u'编辑小组用户
%
d信息失败
%
s'
%
(
user_id
,
e
))
raise
return
return
\ No newline at end of file
api/pick.py
View file @
10763992
...
@@ -6,6 +6,7 @@
...
@@ -6,6 +6,7 @@
import
json
import
json
from
utils.base
import
APIView
from
utils.base
import
APIView
from
alpha_types.venus
import
PICK_TYPE
from
alpha_types.venus
import
PICK_TYPE
from
utils.logger
import
error_logger
class
PickListView
(
APIView
):
class
PickListView
(
APIView
):
...
@@ -16,7 +17,8 @@ class PickListView(APIView):
...
@@ -16,7 +17,8 @@ class PickListView(APIView):
try
:
try
:
data
=
self
.
rpc
[
'venus/sun/pick/list'
](
offset
=
(
offset
-
1
)
*
limit
,
limit
=
limit
,
filters
=
filter
)
.
unwrap
()
data
=
self
.
rpc
[
'venus/sun/pick/list'
](
offset
=
(
offset
-
1
)
*
limit
,
limit
=
limit
,
filters
=
filter
)
.
unwrap
()
except
Exception
as
e
:
except
Exception
as
e
:
raise
e
error_logger
.
error
(
u'获取pick列表失败
%
s'
,
e
)
raise
return
data
return
data
def
post
(
self
,
request
):
def
post
(
self
,
request
):
...
@@ -32,7 +34,8 @@ class PickListView(APIView):
...
@@ -32,7 +34,8 @@ class PickListView(APIView):
try
:
try
:
self
.
rpc
[
'venus/sun/pick/batch/update'
](
updates
=
updates
,
ids
=
ids
)
.
unwrap
()
self
.
rpc
[
'venus/sun/pick/batch/update'
](
updates
=
updates
,
ids
=
ids
)
.
unwrap
()
except
Exception
as
e
:
except
Exception
as
e
:
raise
e
error_logger
.
error
(
u'批量更新pick列表失败
%
s'
,
e
)
raise
return
{
return
{
"message"
:
"更新成功"
"message"
:
"更新成功"
}
}
...
@@ -44,7 +47,8 @@ class UpdateOrCreateView(APIView):
...
@@ -44,7 +47,8 @@ class UpdateOrCreateView(APIView):
try
:
try
:
data
=
self
.
rpc
[
'venus/sun/pick/get'
](
id
=
id
)
.
unwrap
()
data
=
self
.
rpc
[
'venus/sun/pick/get'
](
id
=
id
)
.
unwrap
()
except
Exception
as
e
:
except
Exception
as
e
:
raise
e
error_logger
.
error
(
u'获取
%
d-pcik信息失败
%
s'
%
(
id
,
e
))
raise
return
{
'data'
:
data
}
return
{
'data'
:
data
}
def
post
(
self
,
request
):
def
post
(
self
,
request
):
...
@@ -85,7 +89,8 @@ class UpdateOrCreateView(APIView):
...
@@ -85,7 +89,8 @@ class UpdateOrCreateView(APIView):
try
:
try
:
self
.
rpc
[
'venus/sun/pick/edit'
](
id
=
id
,
data
=
data
)
.
unwrap
()
self
.
rpc
[
'venus/sun/pick/edit'
](
id
=
id
,
data
=
data
)
.
unwrap
()
except
Exception
as
e
:
except
Exception
as
e
:
raise
e
error_logger
.
error
(
u'编辑
%
d-pcik信息失败
%
s'
%
(
id
,
e
))
raise
return
{
return
{
'message'
:
'操作成功'
'message'
:
'操作成功'
}
}
...
@@ -113,7 +118,8 @@ class PickUserListView(APIView):
...
@@ -113,7 +118,8 @@ class PickUserListView(APIView):
try
:
try
:
data
=
self
.
rpc
[
dispatch_rpc_endpoint
[
pick_type
]](
offset
=
(
offset
-
1
)
*
limit
,
limit
=
limit
,
filters
=
filters
)
.
unwrap
()
data
=
self
.
rpc
[
dispatch_rpc_endpoint
[
pick_type
]](
offset
=
(
offset
-
1
)
*
limit
,
limit
=
limit
,
filters
=
filters
)
.
unwrap
()
except
Exception
as
e
:
except
Exception
as
e
:
raise
e
error_logger
.
error
(
u'获取
%
d-pcik信息失败
%
s'
%
(
pick_id
,
e
))
raise
return
data
return
data
def
post
(
self
,
request
):
def
post
(
self
,
request
):
...
@@ -123,7 +129,8 @@ class PickUserListView(APIView):
...
@@ -123,7 +129,8 @@ class PickUserListView(APIView):
try
:
try
:
self
.
rpc
[
'venus/sun/pick/add_fake_pick_nums'
](
celebrity_id
=
celebrity_id
,
topic_id
=
topic_id
,
pick_nums
=
fake_pick_nums
)
.
unwrap
()
self
.
rpc
[
'venus/sun/pick/add_fake_pick_nums'
](
celebrity_id
=
celebrity_id
,
topic_id
=
topic_id
,
pick_nums
=
fake_pick_nums
)
.
unwrap
()
except
Exception
as
e
:
except
Exception
as
e
:
raise
e
error_logger
.
error
(
u'增加fake_pick_num失败
%
s'
,
e
)
raise
return
{
return
{
'message'
:
'操作失败'
'message'
:
'操作失败'
}
}
...
@@ -185,5 +192,6 @@ class PickCelebrityListView(APIView):
...
@@ -185,5 +192,6 @@ class PickCelebrityListView(APIView):
try
:
try
:
data
=
self
.
rpc
[
'venus/sun/pick/pick_celebrity'
](
celebrity_id
=
celebrity_id
,
pick_id
=
pick_id
,
del_ids
=
del_ids
)
.
unwrap
()
data
=
self
.
rpc
[
'venus/sun/pick/pick_celebrity'
](
celebrity_id
=
celebrity_id
,
pick_id
=
pick_id
,
del_ids
=
del_ids
)
.
unwrap
()
except
Exception
as
e
:
except
Exception
as
e
:
raise
e
error_logger
.
error
(
u'操作失败
%
s'
,
e
)
raise
return
data
return
data
\ No newline at end of file
api/push.py
View file @
10763992
...
@@ -5,6 +5,7 @@
...
@@ -5,6 +5,7 @@
from
utils.base
import
APIView
from
utils.base
import
APIView
from
utils.time_utils
import
analysis_time
from
utils.time_utils
import
analysis_time
from
utils.logger
import
error_logger
class
PushListView
(
APIView
):
class
PushListView
(
APIView
):
...
@@ -15,7 +16,8 @@ class PushListView(APIView):
...
@@ -15,7 +16,8 @@ class PushListView(APIView):
try
:
try
:
data
=
self
.
rpc
[
'venus/sun/push/list'
](
offset
=
(
page
-
1
)
*
limit
,
limit
=
limit
,
filters
=
filter
)
.
unwrap
()
data
=
self
.
rpc
[
'venus/sun/push/list'
](
offset
=
(
page
-
1
)
*
limit
,
limit
=
limit
,
filters
=
filter
)
.
unwrap
()
except
Exception
as
e
:
except
Exception
as
e
:
raise
e
error_logger
.
error
(
u'获取push列表失败
%
s'
,
e
)
raise
return
data
return
data
...
@@ -25,7 +27,8 @@ class PushUpdateOrCreateView(APIView):
...
@@ -25,7 +27,8 @@ class PushUpdateOrCreateView(APIView):
try
:
try
:
data
=
self
.
rpc
[
'venus/sun/push/get'
](
id
=
id
)
.
unwrap
()
data
=
self
.
rpc
[
'venus/sun/push/get'
](
id
=
id
)
.
unwrap
()
except
Exception
as
e
:
except
Exception
as
e
:
raise
e
error_logger
.
error
(
u'获取
%
s-push信息失败
%
s'
%
(
id
,
e
))
raise
return
{
'data'
:
data
}
return
{
'data'
:
data
}
def
post
(
self
,
request
):
def
post
(
self
,
request
):
...
@@ -46,7 +49,8 @@ class PushUpdateOrCreateView(APIView):
...
@@ -46,7 +49,8 @@ class PushUpdateOrCreateView(APIView):
try
:
try
:
rep
=
self
.
rpc
[
'venus/sun/push/edit'
](
id
=
id
,
data
=
data
)
.
unwrap
()
rep
=
self
.
rpc
[
'venus/sun/push/edit'
](
id
=
id
,
data
=
data
)
.
unwrap
()
except
Exception
as
e
:
except
Exception
as
e
:
raise
e
error_logger
.
error
(
u'创建/编辑
%
s-push信息失败
%
s'
%
(
id
,
e
))
raise
return
{
return
{
"message"
:
'更新成功'
,
"message"
:
'更新成功'
,
"id"
:
rep
[
'id'
]
"id"
:
rep
[
'id'
]
...
@@ -59,7 +63,8 @@ class EffectPushTaskView(APIView):
...
@@ -59,7 +63,8 @@ class EffectPushTaskView(APIView):
try
:
try
:
self
.
rpc
[
'venus/sun/push/effect_push_task'
](
id
=
push_task_id
)
.
unwrap
()
self
.
rpc
[
'venus/sun/push/effect_push_task'
](
id
=
push_task_id
)
.
unwrap
()
except
Exception
as
e
:
except
Exception
as
e
:
raise
e
error_logger
.
error
(
u'
%
s-push生效失败
%
s'
%
(
push_task_id
,
e
))
raise
return
{
return
{
'message'
:
'操作成功'
'message'
:
'操作成功'
}
}
\ No newline at end of file
api/star.py
View file @
10763992
...
@@ -5,6 +5,7 @@
...
@@ -5,6 +5,7 @@
import
json
import
json
from
utils.base
import
APIView
from
utils.base
import
APIView
from
utils.logger
import
error_logger
class
CelebrityListView
(
APIView
):
class
CelebrityListView
(
APIView
):
...
@@ -15,7 +16,8 @@ class CelebrityListView(APIView):
...
@@ -15,7 +16,8 @@ class CelebrityListView(APIView):
try
:
try
:
data
=
self
.
rpc
[
'venus/sun/celebrity/list'
](
offset
=
(
page
-
1
)
*
limit
,
limit
=
limit
,
filters
=
filter
)
.
unwrap
()
data
=
self
.
rpc
[
'venus/sun/celebrity/list'
](
offset
=
(
page
-
1
)
*
limit
,
limit
=
limit
,
filters
=
filter
)
.
unwrap
()
except
Exception
as
e
:
except
Exception
as
e
:
raise
e
error_logger
.
error
(
u'获取明星列表失败
%
s'
,
e
)
raise
return
data
return
data
def
post
(
self
,
request
):
def
post
(
self
,
request
):
...
@@ -31,7 +33,8 @@ class CelebrityListView(APIView):
...
@@ -31,7 +33,8 @@ class CelebrityListView(APIView):
try
:
try
:
self
.
rpc
[
'venus/sun/celebrity/batch/update'
](
updates
=
updates
,
ids
=
ids
)
.
unwrap
()
self
.
rpc
[
'venus/sun/celebrity/batch/update'
](
updates
=
updates
,
ids
=
ids
)
.
unwrap
()
except
Exception
as
e
:
except
Exception
as
e
:
raise
e
error_logger
.
error
(
u'批量更新明星列表失败
%
s'
,
e
)
raise
return
{
return
{
"message"
:
"更新成功"
"message"
:
"更新成功"
}
}
...
@@ -43,7 +46,8 @@ class CelebrityUpdateOrCreate(APIView):
...
@@ -43,7 +46,8 @@ class CelebrityUpdateOrCreate(APIView):
try
:
try
:
data
=
self
.
rpc
[
'venus/sun/celebrity/get'
](
id
=
id
)
.
unwrap
()
data
=
self
.
rpc
[
'venus/sun/celebrity/get'
](
id
=
id
)
.
unwrap
()
except
Exception
as
e
:
except
Exception
as
e
:
raise
e
error_logger
.
error
(
u'获取
%
d明星信息失败
%
s'
%
(
id
,
e
))
raise
return
{
'data'
:
data
}
return
{
'data'
:
data
}
def
post
(
self
,
request
):
def
post
(
self
,
request
):
...
@@ -78,7 +82,8 @@ class CelebrityUpdateOrCreate(APIView):
...
@@ -78,7 +82,8 @@ class CelebrityUpdateOrCreate(APIView):
try
:
try
:
self
.
rpc
[
'venus/sun/celebrity/edit'
](
id
=
id
,
data
=
data
)
.
unwrap
()
self
.
rpc
[
'venus/sun/celebrity/edit'
](
id
=
id
,
data
=
data
)
.
unwrap
()
except
Exception
as
e
:
except
Exception
as
e
:
raise
e
error_logger
.
error
(
u'创建/编辑
%
d明星信息失败
%
s'
%
(
id
,
e
))
raise
return
{
return
{
'message'
:
'更新成功'
'message'
:
'更新成功'
...
@@ -94,5 +99,6 @@ class CelebrityRelatedGroup(APIView):
...
@@ -94,5 +99,6 @@ class CelebrityRelatedGroup(APIView):
try
:
try
:
data
=
self
.
rpc
[
'venus/sun/group/list'
](
filters
=
filters
,
offset
=
(
offset
-
1
)
*
count
,
limit
=
count
)
.
unwrap
()
data
=
self
.
rpc
[
'venus/sun/group/list'
](
filters
=
filters
,
offset
=
(
offset
-
1
)
*
count
,
limit
=
count
)
.
unwrap
()
except
Exception
as
e
:
except
Exception
as
e
:
raise
e
error_logger
.
error
(
u'获取
%
d明星小组信息失败
%
s'
%
(
id
,
e
))
raise
return
data
return
data
api/tag.py
View file @
10763992
...
@@ -5,6 +5,7 @@
...
@@ -5,6 +5,7 @@
import
json
import
json
from
utils.base
import
APIView
from
utils.base
import
APIView
from
utils.logger
import
error_logger
class
TagListView
(
APIView
):
class
TagListView
(
APIView
):
...
@@ -15,7 +16,8 @@ class TagListView(APIView):
...
@@ -15,7 +16,8 @@ class TagListView(APIView):
try
:
try
:
data
=
self
.
rpc
[
'venus/sun/tag/list'
](
offset
=
(
offset
-
1
)
*
limit
,
limit
=
limit
,
filters
=
filter
)
.
unwrap
()
data
=
self
.
rpc
[
'venus/sun/tag/list'
](
offset
=
(
offset
-
1
)
*
limit
,
limit
=
limit
,
filters
=
filter
)
.
unwrap
()
except
Exception
as
e
:
except
Exception
as
e
:
raise
e
error_logger
.
error
(
u'获取标签列表失败
%
s'
,
e
)
raise
return
data
return
data
def
post
(
self
,
request
):
def
post
(
self
,
request
):
...
@@ -29,7 +31,8 @@ class TagListView(APIView):
...
@@ -29,7 +31,8 @@ class TagListView(APIView):
try
:
try
:
self
.
rpc
[
'venus/sun/tag/batch/update'
](
updates
=
updates
,
ids
=
ids
)
.
unwrap
()
self
.
rpc
[
'venus/sun/tag/batch/update'
](
updates
=
updates
,
ids
=
ids
)
.
unwrap
()
except
Exception
as
e
:
except
Exception
as
e
:
raise
e
error_logger
.
error
(
u'批量更新标签列表失败
%
s'
,
e
)
raise
return
{
return
{
"message"
:
"更新成功"
"message"
:
"更新成功"
}
}
...
@@ -41,7 +44,8 @@ class TagUpdateOrCreateView(APIView):
...
@@ -41,7 +44,8 @@ class TagUpdateOrCreateView(APIView):
try
:
try
:
data
=
self
.
rpc
[
'venus/sun/tag/get'
](
id
=
id
)
.
unwrap
()
data
=
self
.
rpc
[
'venus/sun/tag/get'
](
id
=
id
)
.
unwrap
()
except
Exception
as
e
:
except
Exception
as
e
:
raise
e
error_logger
.
error
(
u'获取标签
%
d信息失败
%
s'
%
(
id
,
e
))
raise
if
not
data
:
if
not
data
:
data
=
{}
data
=
{}
else
:
else
:
...
@@ -62,5 +66,6 @@ class TagUpdateOrCreateView(APIView):
...
@@ -62,5 +66,6 @@ class TagUpdateOrCreateView(APIView):
try
:
try
:
data
=
self
.
rpc
[
'venus/sun/tag/edit'
](
id
=
id
,
data
=
data
)
.
unwrap
()
data
=
self
.
rpc
[
'venus/sun/tag/edit'
](
id
=
id
,
data
=
data
)
.
unwrap
()
except
Exception
as
e
:
except
Exception
as
e
:
raise
e
error_logger
.
error
(
u'创建/编辑标签
%
d信息失败
%
s'
%
(
id
,
e
))
raise
return
data
return
data
\ No newline at end of file
api/topic.py
View file @
10763992
...
@@ -6,6 +6,7 @@
...
@@ -6,6 +6,7 @@
import
json
import
json
from
utils.base
import
APIView
from
utils.base
import
APIView
from
utils.time_utils
import
analysis_time
from
utils.time_utils
import
analysis_time
from
utils.logger
import
error_logger
class
TopicListView
(
APIView
):
class
TopicListView
(
APIView
):
...
@@ -22,7 +23,8 @@ class TopicListView(APIView):
...
@@ -22,7 +23,8 @@ class TopicListView(APIView):
try
:
try
:
data
=
self
.
rpc
[
'venus/sun/topic/list'
](
offset
=
(
offset
-
1
)
*
limit
,
limit
=
limit
,
filters
=
filter
)
.
unwrap
()
data
=
self
.
rpc
[
'venus/sun/topic/list'
](
offset
=
(
offset
-
1
)
*
limit
,
limit
=
limit
,
filters
=
filter
)
.
unwrap
()
except
Exception
as
e
:
except
Exception
as
e
:
raise
e
error_logger
.
error
(
u'获取帖子列表失败
%
s'
,
e
)
raise
return
data
return
data
...
@@ -33,7 +35,8 @@ class TopicUpdateOrCreateView(APIView):
...
@@ -33,7 +35,8 @@ class TopicUpdateOrCreateView(APIView):
try
:
try
:
data
=
self
.
rpc
[
'venus/sun/topic/get'
](
id
=
id
)
.
unwrap
()
data
=
self
.
rpc
[
'venus/sun/topic/get'
](
id
=
id
)
.
unwrap
()
except
Exception
as
e
:
except
Exception
as
e
:
raise
e
error_logger
.
error
(
u'获取
%
d-帖子信息失败
%
s'
%
(
id
,
e
))
raise
return
{
'data'
:
data
}
return
{
'data'
:
data
}
def
post
(
self
,
request
):
def
post
(
self
,
request
):
...
@@ -57,7 +60,8 @@ class TopicUpdateOrCreateView(APIView):
...
@@ -57,7 +60,8 @@ class TopicUpdateOrCreateView(APIView):
try
:
try
:
self
.
rpc
[
'venus/sun/topic/edit'
](
id
=
id
,
data
=
data
)
.
unwrap
()
self
.
rpc
[
'venus/sun/topic/edit'
](
id
=
id
,
data
=
data
)
.
unwrap
()
except
Exception
as
e
:
except
Exception
as
e
:
raise
e
error_logger
.
error
(
u'创建/编辑
%
d-帖子信息失败
%
s'
%
(
id
,
e
))
raise
return
{
return
{
'message'
:
'更新成功'
'message'
:
'更新成功'
}
}
...
@@ -73,7 +77,8 @@ class ReplyUpdateOrCreateView(APIView):
...
@@ -73,7 +77,8 @@ class ReplyUpdateOrCreateView(APIView):
try
:
try
:
data
=
self
.
rpc
[
'venus/sun/topic/reply/list'
](
offset
=
(
offset
-
1
)
*
limit
,
limit
=
limit
,
filters
=
filter
)
.
unwrap
()
data
=
self
.
rpc
[
'venus/sun/topic/reply/list'
](
offset
=
(
offset
-
1
)
*
limit
,
limit
=
limit
,
filters
=
filter
)
.
unwrap
()
except
Exception
as
e
:
except
Exception
as
e
:
raise
e
error_logger
.
error
(
u'回复帖子失败
%
s'
,
e
)
raise
return
data
return
data
def
post
(
self
,
request
):
def
post
(
self
,
request
):
...
@@ -81,7 +86,8 @@ class ReplyUpdateOrCreateView(APIView):
...
@@ -81,7 +86,8 @@ class ReplyUpdateOrCreateView(APIView):
try
:
try
:
self
.
rpc
[
'venus/sun/topic/reply/batch_delete'
](
ids
=
reply_ids
)
.
unwrap
()
self
.
rpc
[
'venus/sun/topic/reply/batch_delete'
](
ids
=
reply_ids
)
.
unwrap
()
except
Exception
as
e
:
except
Exception
as
e
:
raise
e
error_logger
.
error
(
u'批量更新帖子失败
%
s'
,
e
)
raise
return
{
return
{
'message'
:
'操作成功'
'message'
:
'操作成功'
}
}
...
@@ -98,7 +104,8 @@ class ReplyCreate(APIView):
...
@@ -98,7 +104,8 @@ class ReplyCreate(APIView):
try
:
try
:
data
=
self
.
rpc
[
'venus/sun/topic/reply/edit'
](
id
=
None
,
data
=
data
)
.
unwrap
()
data
=
self
.
rpc
[
'venus/sun/topic/reply/edit'
](
id
=
None
,
data
=
data
)
.
unwrap
()
except
Exception
as
e
:
except
Exception
as
e
:
raise
e
error_logger
.
error
(
u'编辑帖子失败
%
s'
,
e
)
raise
return
{
'data'
:
data
}
return
{
'data'
:
data
}
...
@@ -114,7 +121,8 @@ class TopicListBatchUpdate(APIView):
...
@@ -114,7 +121,8 @@ class TopicListBatchUpdate(APIView):
try
:
try
:
self
.
rpc
[
'venus/sun/topic/batch/update'
](
updates
=
updates
,
ids
=
ids
)
.
unwrap
()
self
.
rpc
[
'venus/sun/topic/batch/update'
](
updates
=
updates
,
ids
=
ids
)
.
unwrap
()
except
Exception
as
e
:
except
Exception
as
e
:
raise
e
error_logger
.
error
(
u'批量更新帖子失败
%
s'
,
e
)
raise
return
{
return
{
"message"
:
"更新成功"
"message"
:
"更新成功"
}
}
...
...
api/user.py
View file @
10763992
...
@@ -7,6 +7,7 @@ import json
...
@@ -7,6 +7,7 @@ import json
from
django.conf
import
settings
from
django.conf
import
settings
from
utils.base
import
APIView
from
utils.base
import
APIView
from
django.contrib.auth.hashers
import
make_password
from
django.contrib.auth.hashers
import
make_password
from
utils.logger
import
error_logger
class
UserListView
(
APIView
):
class
UserListView
(
APIView
):
...
@@ -20,7 +21,8 @@ class UserListView(APIView):
...
@@ -20,7 +21,8 @@ class UserListView(APIView):
try
:
try
:
data
=
self
.
rpc
[
'venus/sun/user/list'
](
offset
=
(
page
-
1
)
*
limit
,
limit
=
limit
,
filters
=
filter
)
.
unwrap
()
data
=
self
.
rpc
[
'venus/sun/user/list'
](
offset
=
(
page
-
1
)
*
limit
,
limit
=
limit
,
filters
=
filter
)
.
unwrap
()
except
Exception
as
e
:
except
Exception
as
e
:
raise
e
error_logger
.
error
(
u'获取用户列表失败
%
s'
,
e
)
raise
return
data
return
data
...
@@ -30,7 +32,8 @@ class UserUpdateOrCreate(APIView):
...
@@ -30,7 +32,8 @@ class UserUpdateOrCreate(APIView):
try
:
try
:
data
=
self
.
rpc
[
'venus/sun/user/get'
](
id
=
id
)
.
unwrap
()
data
=
self
.
rpc
[
'venus/sun/user/get'
](
id
=
id
)
.
unwrap
()
except
Exception
as
e
:
except
Exception
as
e
:
raise
e
error_logger
.
error
(
u'获取
%
d用户详情失败
%
s'
%
(
id
,
e
))
raise
return
data
return
data
def
post
(
self
,
request
):
def
post
(
self
,
request
):
...
@@ -56,7 +59,8 @@ class UserUpdateOrCreate(APIView):
...
@@ -56,7 +59,8 @@ class UserUpdateOrCreate(APIView):
try
:
try
:
self
.
rpc
[
'venus/sun/user/edit'
](
id
=
id
,
data
=
data
)
.
unwrap
()
self
.
rpc
[
'venus/sun/user/edit'
](
id
=
id
,
data
=
data
)
.
unwrap
()
except
Exception
as
e
:
except
Exception
as
e
:
raise
e
error_logger
.
error
(
u'创建/编辑
%
d用户详情失败
%
s'
%
(
id
,
e
))
raise
return
{
return
{
'message'
:
'更新成功'
'message'
:
'更新成功'
}
}
...
@@ -71,5 +75,6 @@ class UserGroupView(APIView):
...
@@ -71,5 +75,6 @@ class UserGroupView(APIView):
try
:
try
:
data
=
self
.
rpc
[
'venus/sun/group/user/list'
](
filters
=
filters
,
offset
=
(
offset
-
1
)
*
count
,
limit
=
count
)
.
unwrap
()
data
=
self
.
rpc
[
'venus/sun/group/user/list'
](
filters
=
filters
,
offset
=
(
offset
-
1
)
*
count
,
limit
=
count
)
.
unwrap
()
except
Exception
as
e
:
except
Exception
as
e
:
raise
e
error_logger
.
error
(
u'获取小组用户详情失败
%
s'
,
e
)
raise
return
data
return
data
\ No newline at end of file
utils/logger.py
View file @
10763992
# -*- coding: UTF-8 -*-
# -*- coding: UTF-8 -*-
import
os
import
logging
import
logging
import
traceback
import
traceback
from
django.conf
import
settings
from
django.conf
import
settings
from
raven.contrib.django.raven_compat.models
import
client
from
raven.contrib.django.raven_compat.models
import
client
APP_LOG_DIR
=
'/data/log/sun/app'
info_logger
=
logging
.
getLogger
(
'info_logger'
)
info_logger
=
logging
.
getLogger
(
'info_logger'
)
error_logger
=
logging
.
getLogger
(
'error_logger'
)
error_logger
=
logging
.
getLogger
(
'error_logger'
)
auth_logger
=
logging
.
getLogger
(
'auth_logger'
)
auth_logger
=
logging
.
getLogger
(
'auth_logger'
)
profile_logger
=
logging
.
getLogger
(
"profile_logger"
)
profile_logger
=
logging
.
getLogger
(
"profile_logger"
)
pay_logger
=
logging
.
getLogger
(
"pay_logger"
)
request_logger
=
logging
.
getLogger
(
'request_logger'
)
exception_logger
=
logging
.
getLogger
(
'exception_logger'
)
def
log_error
():
def
log_error
():
...
...
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