瀏覽代碼

增加了unlike功能

master
邓淳远 4 年之前
父節點
當前提交
a3e0322973
共有 1 個檔案被更改,包括 10 行新增1 行删除
  1. +10
    -1
      APP/view/collection.py

+ 10
- 1
APP/view/collection.py 查看文件

@ -134,13 +134,22 @@ def get_like():
@bp_collection.route("/unlike", methods=["POST"])
def get_unlike():
id = request.form.get('colllection_id')
id = request.form.get('collection_id')
phonenum = request.form.get('phonenum')
"""
"""
ret = {'msg': 'succuss'}
try:
db_session.query(UserLike).filter(UserLike.collection_id == id, UserLike.phonenum == phonenum).update(
{UserLike.state: 0})
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)

Loading…
取消
儲存