Browse Source

增加了block搜索功能

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

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

@ -48,6 +48,24 @@ def get_block():
blocks.append({'id': '2', 'content': 'mingg','type':'url'})
blocks.append({'id': '3', 'content': 'wnqian','type':'picture'})
"""
try:
row = db_session.query(Block).join(CollectionBlock, CollectionBlock.block_id == Block.id).filter(
CollectionBlock.id == id).all()
for item in row:
block_tmp = {}
block_tmp['id'] = item.id
block_tmp['type'] = item.type
if item.type == 'url' or item.type == 'text':
block_tmp['content'] = item.content_text
else:
block_tmp['content'] = item.content_pic
block_tmp['order'] = item.order
blocks.append(block_tmp)
except BaseException as e:
print(str(e))
ans = {'msg': 'failed'}
return json_util.dumps(ans)
ans = {'blocks': blocks, 'msg': 'succuss'}
return json_util.dumps(ans)

Loading…
Cancel
Save