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
9515c914
Commit
9515c914
authored
Dec 10, 2018
by
Davve
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
删除utc时间格式化函数
parent
dd1da041
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
2 additions
and
39 deletions
+2
-39
push.py
api/push.py
+0
-2
topic.py
api/topic.py
+1
-3
time_utils.py
utils/time_utils.py
+0
-33
TopicDetail.vue
vu/src/views/topic/components/TopicDetail.vue
+1
-1
No files found.
api/push.py
View file @
9515c914
...
...
@@ -4,7 +4,6 @@
# Date: 2018/11/15
from
utils.base
import
APIView
from
utils.time_utils
import
analysis_time
from
utils.logger
import
error_logger
...
...
@@ -34,7 +33,6 @@ class PushUpdateOrCreateView(APIView):
def
post
(
self
,
request
):
id
=
request
.
POST
.
get
(
'id'
,
''
)
creator_id
=
request
.
POST
.
get
(
'creator_id'
)
# push_time = analysis_time(request.POST.get('push_time', 0))
group_topic_id
=
request
.
POST
.
get
(
'group_topic_id'
,
''
)
icon
=
request
.
POST
.
get
(
'icon'
,
''
)
if
icon
.
endswith
(
'-w'
):
...
...
api/topic.py
View file @
9515c914
...
...
@@ -5,7 +5,6 @@
import
json
from
utils.base
import
APIView
from
utils.time_utils
import
analysis_time
from
utils.logger
import
error_logger
...
...
@@ -41,13 +40,12 @@ class TopicUpdateOrCreateView(APIView):
def
post
(
self
,
request
):
id
=
request
.
POST
.
get
(
'id'
,
''
)
posting_time
=
analysis_time
(
request
.
POST
.
get
(
'posting_time'
,
0
))
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'
,
'[]'
))))
data
=
{
'topic_images'
:
topic_images
,
'video_url'
:
request
.
POST
.
get
(
'video_url'
,
''
),
'posting_time'
:
posting_time
,
'posting_time'
:
request
.
POST
.
get
(
'posting_time'
)
,
'content'
:
request
.
POST
.
get
(
'content'
,
''
),
'content_level'
:
request
.
POST
.
get
(
'content_level'
,
''
),
'group_id'
:
request
.
POST
.
get
(
'group'
,
''
)
.
split
(
':'
)[
0
],
...
...
utils/time_utils.py
View file @
9515c914
...
...
@@ -24,43 +24,10 @@ def utc_to_local(utc_time_str, utc_format='%Y-%m-%dT%H:%M:%SZ'):
return
int
(
time
.
mktime
(
time
.
strptime
(
time_str
,
local_format
)))
def
unix_time_to_datetime
(
stamp
):
"""
时间戳转化为datetime类型
:param stamp:
:return:
"""
return
datetime
.
fromtimestamp
(
stamp
)
def
utc_to_datetime
(
utc_time_str
):
"""
utc时间转化为datetime
:param utc_time_str:
:return:
"""
time_stamp
=
utc_to_local
(
utc_time_str
)
return
unix_time_to_datetime
(
time_stamp
)
def
datetime_toString
(
dt
):
return
dt
.
strftime
(
"
%
Y-
%
m-
%
d
%
H:
%
M:
%
S"
)
def
analysis_time
(
time
):
"""
:param time:
:return:
"""
try
:
target_time
=
unix_time_to_datetime
(
int
(
float
(
time
))
/
1000
)
except
ValueError
:
target_time
=
utc_to_datetime
(
time
[:
-
5
]
+
'Z'
)
return
datetime_toString
(
target_time
)
def
generate_id
():
nowTime
=
datetime
.
now
()
.
strftime
(
"
%
Y
%
m
%
d
%
H
%
M
%
S"
)
# 生成当前时间
randomNum
=
random
.
randint
(
0
,
100
);
# 生成的随机整数n,其中0<=n<=100
...
...
vu/src/views/topic/components/TopicDetail.vue
View file @
9515c914
...
...
@@ -46,7 +46,7 @@
<el-date-picker
v-model=
"postForm.posting_time "
type=
"datetime"
format=
"yyyy-MM-dd HH:mm:ss"
value-
format=
"yyyy-MM-dd HH:mm:ss"
:picker-options=
"expireTimeOption"
placeholder=
"选择日期时间"
style=
"width: 230px"
...
...
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