文档服务地址:http://47.92.0.57:3000/ 周报索引地址:http://47.92.0.57:3000/s/NruNXRYmV

Commit 560f1263 by 李景熙

添加选择分片后端

parent 12fe970a
...@@ -35,10 +35,10 @@ def create_relation(slice_id, user_id, data_id): ...@@ -35,10 +35,10 @@ def create_relation(slice_id, user_id, data_id):
Slice.add_annotation(slice_id) Slice.add_annotation(slice_id)
relation = Relation(slice_id=slice_id, user_id=user_id, data_id=data_id) relation = Relation(slice_id=slice_id, user_id=user_id, data_id=data_id)
relation.save() relation.save()
except: except Exception:
return 0 return Result(0, "create failed", {})
else: else:
return 1 return Result(1, "create success", {})
# 根据用户id找寻标注关系 # 根据用户id找寻标注关系
...@@ -46,9 +46,9 @@ def find_relationbyuserid(user_id): ...@@ -46,9 +46,9 @@ def find_relationbyuserid(user_id):
try: try:
p = Relation.get(Relation.user_id == user_id) p = Relation.get(Relation.user_id == user_id)
except Exception: except Exception:
print(0) return Result(0, "find failed", {})
else: else:
print(p.email) return Result(1, "find success", p.email)
# 根据数据id找标注关系 # 根据数据id找标注关系
...@@ -58,9 +58,9 @@ def find_relationbydataid(data_id): ...@@ -58,9 +58,9 @@ def find_relationbydataid(data_id):
try: try:
p = Relation.get(Relation.data_id == data_id) p = Relation.get(Relation.data_id == data_id)
except Exception: except Exception:
print(0) return Result(0, "find failed", {})
else: else:
print(p.email) return Result(1, "find success", p.email)
if __name__ == '__main__': if __name__ == '__main__':
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment