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

Commit 8b012439 by convivae

imageUrl->imageName

parent 2e67275e
...@@ -52,12 +52,12 @@ class Label(db.EmbeddedDocument): ...@@ -52,12 +52,12 @@ class Label(db.EmbeddedDocument):
class Image(db.Document): class Image(db.Document):
relationId = db.IntField(required=True, unique=True) relationId = db.IntField(required=True, unique=True)
# photo = db.FileField() # photo = db.FileField()
imageUrl = db.StringField(required=True) imageName = db.StringField(required=True)
labelList = db.ListField(db.EmbeddedDocumentField(Label)) labelList = db.ListField(db.EmbeddedDocumentField(Label))
def to_json(self): def to_json(self):
return {'relationId': self.relationId, return {'relationId': self.relationId,
'imageUrl': self.imageUrl, 'imageName': self.imageName,
'labelList': [i.to_json() for i in self.labelList] 'labelList': [i.to_json() for i in self.labelList]
} }
...@@ -99,7 +99,7 @@ def create_images(image_list): ...@@ -99,7 +99,7 @@ def create_images(image_list):
delete_image(rid) delete_image(rid)
image = Image( image = Image(
relationId=i['relationId'], relationId=i['relationId'],
imageUrl=i['imageUrl'], imageName=i['imageName'],
labelList=create_labels(i['labelList']) labelList=create_labels(i['labelList'])
) )
image.save() image.save()
...@@ -112,7 +112,7 @@ def get_img_name(relation_id): ...@@ -112,7 +112,7 @@ def get_img_name(relation_id):
img = Image.objects(relationId=relation_id).first() img = Image.objects(relationId=relation_id).first()
if img is None: if img is None:
raise Exception("relation id = {} 的图片不存在".format(relation_id)) raise Exception("relation id = {} 的图片不存在".format(relation_id))
return img['imageUrl'].split('/')[-1] return img['imageName'].split('/')[-1]
# 根据 relationId 删除图片 # 根据 relationId 删除图片
......
...@@ -202,7 +202,7 @@ def export_kml(relationId): ...@@ -202,7 +202,7 @@ def export_kml(relationId):
# "imageList": [ # "imageList": [
# { # {
# "relationId": 123, # "relationId": 123,
# "imageUrl": "tom@qq.com", # "imageName": "tom@qq.com",
# "labelList": [ # "labelList": [
# { # {
# "labelId": 123, # "labelId": 123,
...@@ -219,7 +219,7 @@ def export_kml(relationId): ...@@ -219,7 +219,7 @@ def export_kml(relationId):
# }, # },
# { # {
# "relationId": 156, # "relationId": 156,
# "imageUrl": "jerry@qq.com", # "imageName": "jerry@qq.com",
# "labelList": [ # "labelList": [
# { # {
# "labelId": 13, # "labelId": 13,
......
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