Commit 32fca706 authored by zhanglu's avatar zhanglu

Merge branch 'hotfix/modify_time' into 'master'

Hotfix/modify time

See merge request alpha/sun!18
parents d18fd366 e6377f5a
......@@ -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'):
......@@ -49,7 +47,7 @@ class PushUpdateOrCreateView(APIView):
data = {
'url': full_url,
'push_time': push_time,
'push_time': request.POST.get('push_time'),
'icon': icon,
'content': request.POST.get('content', ''),
'title': request.POST.get('title', ''),
......
......@@ -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],
......
......@@ -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
......
This diff is collapsed.
.createPost-container[data-v-61de98ac]{position:relative}.createPost-container .createPost-main-container[data-v-61de98ac]{padding:40px 45px 20px 50px}.createPost-container .createPost-main-container .postInfo-container[data-v-61de98ac]{position:relative;margin-bottom:10px}.createPost-container .createPost-main-container .postInfo-container[data-v-61de98ac]:after{content:"";display:table;clear:both}.createPost-container .createPost-main-container .postInfo-container .postInfo-container-item[data-v-61de98ac]{float:left}.createPost-container .createPost-main-container .editor-container[data-v-61de98ac]{min-height:500px;margin:0 0 30px}.createPost-container .createPost-main-container .editor-container .editor-upload-btn-container[data-v-61de98ac]{text-align:right;margin-right:10px}.createPost-container .createPost-main-container .editor-container .editor-upload-btn-container .editor-upload-btn[data-v-61de98ac]{display:inline-block}.createPost-container .word-counter[data-v-61de98ac]{width:40px;position:absolute;right:-10px;top:0}
\ No newline at end of file
.createPost-container[data-v-2463032a]{position:relative}.createPost-container .createPost-main-container[data-v-2463032a]{padding:40px 45px 20px 50px}.createPost-container .createPost-main-container .postInfo-container[data-v-2463032a]{position:relative;margin-bottom:10px}.createPost-container .createPost-main-container .postInfo-container[data-v-2463032a]:after{content:"";display:table;clear:both}.createPost-container .createPost-main-container .postInfo-container .postInfo-container-item[data-v-2463032a]{float:left}.createPost-container .createPost-main-container .editor-container[data-v-2463032a]{min-height:500px;margin:0 0 30px}.createPost-container .createPost-main-container .editor-container .editor-upload-btn-container[data-v-2463032a]{text-align:right;margin-right:10px}.createPost-container .createPost-main-container .editor-container .editor-upload-btn-container .editor-upload-btn[data-v-2463032a]{display:inline-block}.createPost-container .word-counter[data-v-2463032a]{width:40px;position:absolute;right:-10px;top:0}
\ No newline at end of file
.createPost-container[data-v-61de98ac]{position:relative}.createPost-container .createPost-main-container[data-v-61de98ac]{padding:40px 45px 20px 50px}.createPost-container .createPost-main-container .postInfo-container[data-v-61de98ac]{position:relative;margin-bottom:10px}.createPost-container .createPost-main-container .postInfo-container[data-v-61de98ac]:after{content:"";display:table;clear:both}.createPost-container .createPost-main-container .postInfo-container .postInfo-container-item[data-v-61de98ac]{float:left}.createPost-container .createPost-main-container .editor-container[data-v-61de98ac]{min-height:500px;margin:0 0 30px}.createPost-container .createPost-main-container .editor-container .editor-upload-btn-container[data-v-61de98ac]{text-align:right;margin-right:10px}.createPost-container .createPost-main-container .editor-container .editor-upload-btn-container .editor-upload-btn[data-v-61de98ac]{display:inline-block}.createPost-container .word-counter[data-v-61de98ac]{width:40px;position:absolute;right:-10px;top:0}
\ No newline at end of file
.createPost-container[data-v-2463032a]{position:relative}.createPost-container .createPost-main-container[data-v-2463032a]{padding:40px 45px 20px 50px}.createPost-container .createPost-main-container .postInfo-container[data-v-2463032a]{position:relative;margin-bottom:10px}.createPost-container .createPost-main-container .postInfo-container[data-v-2463032a]:after{content:"";display:table;clear:both}.createPost-container .createPost-main-container .postInfo-container .postInfo-container-item[data-v-2463032a]{float:left}.createPost-container .createPost-main-container .editor-container[data-v-2463032a]{min-height:500px;margin:0 0 30px}.createPost-container .createPost-main-container .editor-container .editor-upload-btn-container[data-v-2463032a]{text-align:right;margin-right:10px}.createPost-container .createPost-main-container .editor-container .editor-upload-btn-container .editor-upload-btn[data-v-2463032a]{display:inline-block}.createPost-container .word-counter[data-v-2463032a]{width:40px;position:absolute;right:-10px;top:0}
\ No newline at end of file
This source diff could not be displayed because it is too large. You can view the blob instead.
This source diff could not be displayed because it is too large. You can view the blob instead.
......@@ -58,6 +58,7 @@
placeholder="选择日期时间"
style="width: 199px"
:picker-options="expireTimeOption"
value-format="yyyy-MM-dd HH:mm:ss"
/>
</el-form-item>
</el-col>
......
......@@ -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"
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment