From 2997d53a6c9660a72e826dec3e823c8c4ebddc3b Mon Sep 17 00:00:00 2001 From: CharlesDDDD <10185101155@stu.ecnu.edu.cn> Date: Mon, 11 Jan 2021 23:21:15 +0800 Subject: [PATCH] =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E4=BA=86block=E7=9A=84?= =?UTF-8?q?=E5=88=A0=E9=99=A4=E5=8A=9F=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- APP/view/block.py | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/APP/view/block.py b/APP/view/block.py index f6b6dc5..68e4c5f 100644 --- a/APP/view/block.py +++ b/APP/view/block.py @@ -77,6 +77,19 @@ def delete(): """ 删除这个id的collection的block,记得刷新顺序 """ + try: + db_session.query(CollectionBlock).filter(CollectionBlock.id == collection_id, + CollectionBlock.block_id == block_id).delete() + item = db_session.query(Block).filter(Block.id == block_id).first() + order_item = item.order + db_session.delete(item) + db_session.query(Block).filter(Block.order > order_item).update({Block.order: Block.order - 1}) + db_session.commit() + except BaseException as e: + print(str(e)) + ret = {'msg': 'failed!'} + return json_util.dumps(ret) + ret = {'msg': 'succuss'} return json_util.dumps(ret)