Commit 7544f0ac authored by xianyang's avatar xianyang

优化2.0.0

parent 576900f3
import datetime
import json
from configs.config import env
from src.libs.db_link import LinkMysql
......
......@@ -161,9 +161,24 @@ class FriendsCommentListFrom(BaseForm):
raise APIException(code=500, message='用户未查询到')
class GiveCommentListFrom(BaseForm):
'''
点赞
'''
uid = StringField(validators=[DataRequired(message="uid不能为空")])
fcmid = StringField(validators=[DataRequired(message="朋友圈信息id不能为空")])
def validate_uid(self, val):
if val.data:
sql = f"SELECT * FROM `missu_users` where user_uid='{val.data}'"
user_info = LinkMysql(env.BUSINESS).query_mysql(sql)
if user_info == ():
raise APIException(code=500, message='用户未查询到')
class CircleListFrom(BaseForm):
'''
评论列表
获取朋友圈详情
'''
uid = StringField(validators=[DataRequired(message="uid不能为空")])
......
......@@ -8,7 +8,7 @@ from src.app.api.friends.data_delte import FriendMessageNotice, save_friends, ge
CircleOfFriends
from src.app.api.friends.validaters import FriendSendAddFrom, FriendsListFrom, FriendCommentAddFrom, \
FriendCommentDeleteFrom, FriendGivetAddFrom, FriendGivetDeleteFrom, FriendBackgroundFrom, FriendsCommentListFrom, \
CircleListFrom, ContentListFrom
CircleListFrom, ContentListFrom, GiveCommentListFrom
from src.app.api.friends import api
from src.libs.functions import result_format, paginate_info, upload_file, children_comment, list_give
from src.modules.friend import FriendMessage, FriendComment, FriendGive
......@@ -150,7 +150,7 @@ def circle_comment():
'''
form = FriendsCommentListFrom(request.args).validate_()
data = children_comment(form.fcmid.data, form.myUid.data)
return result_format(code=200, data=data, message="查询成功")
return result_format(code=200, data=data, message="操作成功")
@api.route('/give/list', methods=['GET'])
......@@ -158,9 +158,9 @@ def give_list():
'''
点赞列表
'''
form = FriendsCommentListFrom(request.args).validate_()
form = GiveCommentListFrom(request.args).validate_()
data = list_give(form.fcmid.data, form.uid.data)
return result_format(code=200, data=data, message="查询成功")
return result_format(code=200, data=data, message="操作成功")
@api.route('/circle/info', methods=['GET'])
......
......@@ -52,6 +52,7 @@ class Query(BaseQuery):
db = SQLAlchemy(query_class=Query)
class Common(object):
"""orm通用操作"""
......
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