因为机房电脑过于垃圾....害怕死机,所以没改多少也提交下
This commit is contained in:
@@ -201,7 +201,7 @@ def submit_post():
|
|||||||
|
|
||||||
identity_token = data.get('identity')
|
identity_token = data.get('identity')
|
||||||
|
|
||||||
# 违禁词检测 (使用内存缓存)
|
# 违禁词检测
|
||||||
for word in DENY_WORDS_CACHE:
|
for word in DENY_WORDS_CACHE:
|
||||||
if word in content:
|
if word in content:
|
||||||
return jsonify({"code": 2005, "data": "提交内容包含违禁词"})
|
return jsonify({"code": 2005, "data": "提交内容包含违禁词"})
|
||||||
@@ -258,6 +258,11 @@ def submit_comment():
|
|||||||
if not Submission.query.get(submission_id):
|
if not Submission.query.get(submission_id):
|
||||||
return jsonify({"code": 2004, "data": "投稿不存在"})
|
return jsonify({"code": 2004, "data": "投稿不存在"})
|
||||||
|
|
||||||
|
# 违禁词检测
|
||||||
|
for word in DENY_WORDS_CACHE:
|
||||||
|
if word in content:
|
||||||
|
return jsonify({"code": 2005, "data": "提交内容包含违禁词"})
|
||||||
|
|
||||||
# Identity 验证
|
# Identity 验证
|
||||||
if identity_token:
|
if identity_token:
|
||||||
if not Identity.query.filter_by(token=identity_token).first():
|
if not Identity.query.filter_by(token=identity_token).first():
|
||||||
@@ -284,7 +289,7 @@ def submit_comment():
|
|||||||
db.session.add(new_tag)
|
db.session.add(new_tag)
|
||||||
db.session.commit()
|
db.session.commit()
|
||||||
|
|
||||||
return jsonify({"code": 1000, "data": ""})
|
return jsonify({"code": 1001, "data": {"id": new_comment.id}})
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
return jsonify({"code": 2003, "data": f"评论失败: {str(e)}"})
|
return jsonify({"code": 2003, "data": f"评论失败: {str(e)}"})
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user