Bladeren bron

打开图片失败

john 8 maanden geleden
bovenliggende
commit
62cf4bd65f

BIN
.DS_Store


+ 0 - 1
frontEndMobile/src/views/AccountLogPage.vue

@@ -56,7 +56,6 @@ watch(userDate, () => {
 const getAllRecordyDateFn = async () => {
   const res = await getAllRecordyDate(commonStore.bookInfo.id, userDate.value)
   let totalFee = 0
-  console.log(59, res.data)
   if (Array.isArray(res.data) && res.data.length > 0) {
     res.data.forEach((element) => {
       totalFee += Number(element.total_fee)

+ 1 - 1
frontEndMobile/src/views/AddAccountLogPage.vue

@@ -196,7 +196,7 @@ async function editPageInit() {
   if (res.data?.files?.length > 0) {
     files.value = res.data?.files.map((imgStr) => ({
       url: imgStr,
-      file_id: imgStr.replace(/.*files\//, ''),
+      file_id: imgStr.replace(/.*api_files_/, ''),
       isImage: true
     }))
   }

+ 1 - 1
node_expores/Dockerfile

@@ -5,4 +5,4 @@ RUN npm install
 COPY . .
 EXPOSE 3000
 VOLUME /app/base_files
-CMD ["node", "app.js"]
+# CMD ["node", "app.js"]

+ 19 - 13
node_expores/app.js

@@ -30,36 +30,42 @@ app.use(bodyParser.urlencoded({ extended: false }));
 // Helper function to validate referer
 function isValidReferer(referer) {
   return (
-    referer.indexOf("zs_interval") > -1 && referer.indexOf("/api/v1/files") > -1
+    referer.indexOf("zs_interval") > -1 && referer.indexOf("/api/v1/files") > -1 || referer.indexOf('api_files_') > -1
   );
 }
 
 // Helper function to extract `file_id` from referer
 function extractFileId(referer) {
-  const match = referer.match(/\/api\/v1\/files\/([^/]+)/); // 正则匹配 `file_id`
+  const match = referer.match(/api_files_([^/]+)/); // 正则匹配 `file_id`
   return match ? match[1] : null;
 }
 
 // middleware that is specific to this router
-app.use(async function timeLog(req, res, next) {
-  console.log(45, req.url);
+// app.use(async function timeLog(req, res, next) {
+//   if (isValidReferer(req.url)) {
+//     const fileId = extractFileId(req.url);
+//     if (fileId) {
+//       return res.redirect(`/api/v1/files/${fileId}`);
+//     } else {
+//       console.error("File ID not found in referer");
+//     }
+//   }
+//   next();
+// });
+
+// 静态文件目录,添加前缀路径 /static
+app.use("/static", express.static("public"));
+
+app.get("/", (req, res) => {
   if (isValidReferer(req.url)) {
     const fileId = extractFileId(req.url);
-    console.log(47, fileId);
     if (fileId) {
       return res.redirect(`/api/v1/files/${fileId}`);
     } else {
       console.error("File ID not found in referer");
     }
   }
-  next();
-});
-
-// 静态文件目录,添加前缀路径 /static
-app.use("/static", express.static("public"));
-
-app.get("/", (req, res) => {
-  res.send("Hello World!");
+  res.send("Hello World! " + req.url);
 });
 
 app.use("/api/v1/login", authors);

+ 2 - 3
node_expores/router/record/index.js

@@ -121,12 +121,12 @@ router.get("/:record_id", async function (req, res) {
     const host = req.headers['host']; // 主机名 + 端口
     const origin = req.headers["referer"]; // 请求的来源域(适用于跨域)
     if (`${origin}`.indexOf("3032") > -1 || `${host}`.indexOf('3000') > -1) {
-      return "http://localhost:3000" + `/api/v1/files/${elm.file_id}`;
+      return "http://localhost:3000" + `/api_files_${elm.file_id}`;
     }
     if (`${origin}`.indexOf("zs_interval") > -1) {
       return `http://${origin.replace('/static/', '')}/api/v1/files/${elm.file_id}`;
     }
-    return `${origin}api/v1/files/${elm.file_id}`;
+    return `${origin}api_files_${elm.file_id}`;
   }
   res.json({
     code: 200,
@@ -156,7 +156,6 @@ router.put("/:record_id", async function (req, res) {
 
   const getAllfiles = await getFileByRecordId(record_id);
   const getAllfilesIds = getAllfiles.map((elm) => elm.file_id);
-  console.log(159, getAllfiles);
 
   const dellFilesInRecordFiles = getAllfiles.filter(
     (elm) => files.indexOf(elm.file_id) < 0