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

Commit dd0dbd3a by 李景熙

再返回文件列表时同时返回对应标注关系id

parent cd11ed22
......@@ -60,12 +60,14 @@ def find_data_by_slice(slice_id):
index = 0
list = []
while index < len(find):
rid = Relation.get_relation_id(executor, find[index].data_id)
list.append(
{
'id': find[index].data_id,
'name': find[index].name,
'size': find[index].size,
'url': find[index].url,
'relation_id': rid
}
)
index += 1
......@@ -84,13 +86,15 @@ def find_data_by_slice_state(slice_id, executor):
list = []
while index < len(find):
state = Relation.get_state(executor, find[index].data_id)
rid = Relation.get_relation_id(executor, find[index].data_id)
list.append(
{
'id': find[index].data_id,
'name': find[index].name,
'size': find[index].size,
'url': find[index].url,
'state': int(state)
'state': int(state),
'relation_id': rid
}
)
index += 1
......
......@@ -159,6 +159,15 @@ def get_executors(data_id):
return Result(1, "ok", list)
def get_relation_id(uid, did):
try:
r = Relation.get(Relation.user_id == uid, Relation.data_id == did)
except:
return 0
else:
return r.relation_id
if __name__ == '__main__':
Relation.drop_table()
Relation.create_table()
......
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