|
|
@@ -122,7 +122,25 @@ class UpdateZjcs(BaseModel):
|
|
|
bh: str
|
|
|
mc: str
|
|
|
fl: str
|
|
|
-
|
|
|
+
|
|
|
+class Item(BaseModel):
|
|
|
+ bh: str
|
|
|
+ bt: str
|
|
|
+ name: str
|
|
|
+class Rcj(BaseModel):
|
|
|
+ bh: str
|
|
|
+ bt: str
|
|
|
+ bm: str
|
|
|
+ name: str
|
|
|
+class Dercj(BaseModel):
|
|
|
+ bh: str
|
|
|
+ bt: str
|
|
|
+ qdbm: str
|
|
|
+ debm: str
|
|
|
+ name: str
|
|
|
+class Zjcs(BaseModel):
|
|
|
+ bh: str
|
|
|
+ name: str
|
|
|
|
|
|
|
|
|
|
|
|
@@ -227,24 +245,7 @@ async def read_qdxm2(info: InfoWithID):
|
|
|
|
|
|
return await db.getQdxm(client, info.name, info.id)
|
|
|
|
|
|
-class Item(BaseModel):
|
|
|
- bh: str
|
|
|
- bt: str
|
|
|
- name: str
|
|
|
-class Rcj(BaseModel):
|
|
|
- bh: str
|
|
|
- bt: str
|
|
|
- bm: str
|
|
|
- name: str
|
|
|
-class Dercj(BaseModel):
|
|
|
- bh: str
|
|
|
- bt: str
|
|
|
- qdbm: str
|
|
|
- debm: str
|
|
|
- name: str
|
|
|
-class Zjcs(BaseModel):
|
|
|
- bh: str
|
|
|
- name: str
|
|
|
+
|
|
|
|
|
|
|
|
|
@app.post("/qingdanmingxi/")
|
|
|
@@ -499,7 +500,7 @@ async def read_dexilie(value: int, id: str):
|
|
|
#print(result)
|
|
|
return result
|
|
|
|
|
|
-@app.get("/singledexilie2/{zhuanye}/{debh}")
|
|
|
+@app.get("/singledexilie2/{zhuanye}/{debh}")##debh = debh!description
|
|
|
@cache(expire=86400)
|
|
|
async def read_singledexilie2(zhuanye: int, debh: str):
|
|
|
if debh.startswith("D") :
|
|
|
@@ -853,29 +854,26 @@ async def upload(file: UploadFile):
|
|
|
|
|
|
@app.get("/download/{item_id}")
|
|
|
async def download_file(item_id):
|
|
|
+ tmp = str(uuid.uuid4())
|
|
|
file_path = "export/contacts.xml.b"
|
|
|
# Create the root element
|
|
|
root = ET.Element("JingJiBiao")
|
|
|
-
|
|
|
# Create a sub-element
|
|
|
##TouBiaoXx = ET.SubElement(root, "TouBiaoXx")
|
|
|
await db.build(client, root, item_id)
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
# Create the tree and write to a file
|
|
|
tree = ET.ElementTree(root)
|
|
|
- tree.write("export/contacts.xml", encoding="utf-8")
|
|
|
- dom = MD.parse("export/contacts.xml")
|
|
|
+ tree.write("export/contacts.xml"+tmp, encoding="utf-8")
|
|
|
+ dom = MD.parse("export/contacts.xml"+tmp)
|
|
|
|
|
|
- with open("export/contacts.xml.b", 'w') as f:
|
|
|
+ with open("export/contacts.xml.b" + tmp, 'w') as f:
|
|
|
f.write("<?xml version=\"1.0\" encoding=\"UTF-8\" ?>\n")
|
|
|
content = (dom.toprettyxml(indent=" "))
|
|
|
content_ = content.split("\n")
|
|
|
f.write("\n".join(content_[1:]))
|
|
|
|
|
|
|
|
|
- return FileResponse(file_path, media_type='application/octet-stream', filename="contacts.xml")
|
|
|
+ return FileResponse(file_path+tmp, media_type='application/octet-stream', filename="contacts.xml")
|
|
|
|
|
|
|
|
|
|