Browse Source

增加了block的删除功能

master
邓淳远 4 years ago
parent
commit
2997d53a6c
1 changed files with 13 additions and 0 deletions
  1. +13
    -0
      APP/view/block.py

+ 13
- 0
APP/view/block.py View File

@ -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)

Loading…
Cancel
Save