Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[chapter_6]修复post_message的if分支逻辑 #18

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 2 additions & 3 deletions chapter_6/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
import datetime
import hashlib
import time
from your_code_here.RedisUtil import RedisUtil
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

这个地方需要改成 your_code_here

from answer.RedisUtil import RedisUtil
from urllib.parse import quote, unquote
from flask import Flask, render_template, request, redirect

Expand Down Expand Up @@ -61,7 +61,7 @@ def post_message():
return json.dumps({'success': False, 'reason': '昵称或聊天内容为空!'}, ensure_ascii=False)

expire_time = redis_util.get_nick_msg_expire_time(nick, msg)
if not expire_time:
if expire_time < 1:
message_info = {'msg': message['msg'],
'post_time': datetime.datetime.now().strftime('%Y-%m-%d %H:%M:%S'),
'nick': message['nick']}
Expand All @@ -83,4 +83,3 @@ def post_message():