浏览代码

增加了block的删除功能

master
邓淳远 4 年前
父节点
当前提交
2997d53a6c
共有 1 个文件被更改,包括 13 次插入0 次删除
  1. +13
    -0
      APP/view/block.py

+ 13
- 0
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)

正在加载...
取消
保存