Browse Source

增加了like功能

master
邓淳远 4 years ago
parent
commit
ac250d8691
1 changed files with 11 additions and 0 deletions
  1. +11
    -0
      APP/view/collection.py

+ 11
- 0
APP/view/collection.py View File

@ -114,17 +114,28 @@ def islike():
@bp_collection.route("/like", methods=["POST"])
def get_like():
id = request.form.get('collection_id')
phonenum = request.form.get('phonenum')
"""
"""
ret = {'msg': 'succuss'}
try:
s = UserLike(phonenum=phonenum, collection_id=id, state=1)
db_session.add(s)
db_session.query(Collection).filter(Collection.id == id).update({Collection.like: Collection.like + 1})
db_session.commit()
except BaseException as e:
print(str(e))
ret = {'msg': 'failed!'}
return json_util.dumps(ret)
return json_util.dumps(ret)
@bp_collection.route("/unlike", methods=["POST"])
def get_unlike():
id = request.form.get('colllection_id')
phonenum = request.form.get('phonenum')
"""

Loading…
Cancel
Save