|
@@ -280,12 +280,13 @@ router.route("/updateFolder").all(async (req, res, next) => {
|
|
const { folderid, ...folderData } = req.body[0]; // 解构赋值,排除folderid
|
|
const { folderid, ...folderData } = req.body[0]; // 解构赋值,排除folderid
|
|
const response = await client.collections.update({
|
|
const response = await client.collections.update({
|
|
id: folderid,
|
|
id: folderid,
|
|
|
|
+ name: decodeURIComponent(req.body[0].n),
|
|
description: decodeURIComponent(req.body[0].d)
|
|
description: decodeURIComponent(req.body[0].d)
|
|
});
|
|
});
|
|
|
|
|
|
p = Object.values(folderData); // 获取剩余属性的键
|
|
p = Object.values(folderData); // 获取剩余属性的键
|
|
|
|
|
|
- p.unshift(_mysqlLabor[0], _mysqlLabor[1], "updateFolder");
|
|
|
|
|
|
+ p.unshift(_mysqlLabor[0], _mysqlLabor[1], "updateFolder2");
|
|
mysql.usselect(p, async function(ret) {
|
|
mysql.usselect(p, async function(ret) {
|
|
res.end(JSON.stringify(ret));
|
|
res.end(JSON.stringify(ret));
|
|
});
|
|
});
|
|
@@ -436,6 +437,30 @@ router.route("/addFile").all((req,res,next)=>{
|
|
getmysql2(req, res, "add_file", req.body.n, req.body.did, req.body.uid, req.body.fid, req.body.mofid);
|
|
getmysql2(req, res, "add_file", req.body.n, req.body.did, req.body.uid, req.body.fid, req.body.mofid);
|
|
})
|
|
})
|
|
|
|
|
|
|
|
+//获取文件详情
|
|
|
|
+router.route("/getFileDetail").all(async (req, res, next) => {
|
|
|
|
+ if (req.body[0]) {
|
|
|
|
+ p = Object.values(req.body[0]);
|
|
|
|
+ p.unshift(_mysqlLabor[0], _mysqlLabor[1], "getFileDetail");
|
|
|
|
+ mysql.usselect(p, async function(ret) {
|
|
|
|
+ let data = ret[0][0];
|
|
|
|
+ // const array = data.map(item => item.documentid);
|
|
|
|
+ try {
|
|
|
|
+ const response = await client.documents.list({ ids: [req.body[0].documentId] });
|
|
|
|
+ // console.log(response);
|
|
|
|
+ let data2 = response.results[0]
|
|
|
|
+
|
|
|
|
+ // 合并data和data2,根据documentid
|
|
|
|
+ const mergedData = { ...data, ...data2 };
|
|
|
|
+
|
|
|
|
+ res.status(200).json({ result: mergedData });
|
|
|
|
+ } catch (error) {
|
|
|
|
+ res.status(500).json({ error: error instanceof Error ? error.message : "An error occurred" });
|
|
|
|
+ }
|
|
|
|
+ });
|
|
|
|
+ }
|
|
|
|
+});
|
|
|
|
+
|
|
function generateAPIKey(username) {
|
|
function generateAPIKey(username) {
|
|
let timeStamp = new Date().getTime();
|
|
let timeStamp = new Date().getTime();
|
|
|
|
|