john 8 ماه پیش
والد
کامیت
1273a41284

+ 16 - 16
epub_node/app.js

@@ -3,13 +3,13 @@ import fileUpload from "express-fileupload";
 import bodyParser from "body-parser";
 import cors from "cors";
 
-import authors from "./router/authors/index.js";
-import authorsLogin from "./router/authors/login.js";
-import books from "./router/books/index.js";
-import files from "./router/files/index.js";
-import record from "./router/record/index.js";
-import moreRecord from "./router/record/more.js";
-import types from "./router/types/index.js";
+// import authors from "./router/authors/index.js";
+// import authorsLogin from "./router/authors/login.js";
+// import books from "./router/books/index.js";
+// import files from "./router/files/index.js";
+// import record from "./router/record/index.js";
+// import moreRecord from "./router/record/more.js";
+// import types from "./router/types/index.js";
 import epub from "./router/epub/index.js";
 
 import { generateToken, verifyToken } from "#utils";
@@ -56,23 +56,23 @@ app.use(async function timeLog(req, res, next) {
 });
 
 // 静态文件目录,添加前缀路径 /static
-app.use("/static", express.static("public"));
+// app.use("/static", express.static("public"));
 
 app.get("/", (req, res) => {
   res.send("Hello World! " + req.url);
 });
 
-app.use("/api/v1/login", authors);
-app.use("/api/v1/files", files);
+// app.use("/api/v1/login", authors);
+// app.use("/api/v1/files", files);
 app.use("/api/v1/epub", epub);
 
-app.use("/api/v1/*", verifyToken); // 注册token验证中间件
+// app.use("/api/v1/*", verifyToken); // 注册token验证中间件
 
-app.use("/api/v1/auth", authorsLogin);
-app.use("/api/v1/books", books);
-app.use("/api/v1/record", record);
-app.use("/api/v1/more_record", moreRecord);
-app.use("/api/v1/types", types);
+// app.use("/api/v1/auth", authorsLogin);
+// app.use("/api/v1/books", books);
+// app.use("/api/v1/record", record);
+// app.use("/api/v1/more_record", moreRecord);
+// app.use("/api/v1/types", types);
 
 app.listen(port, () => {
   console.log(`Example app listening on port ${port}`);

+ 0 - 2
epub_node/db/DB.sql

@@ -81,7 +81,6 @@ CREATE TABLE `chapter` (
 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci;
 
 
--- epub_manage.files definition
 -- epub_manage.files table definition
 CREATE TABLE `files` (
   `id` INT NOT NULL AUTO_INCREMENT,
@@ -98,7 +97,6 @@ CREATE TABLE `files` (
 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci;
 
 
--- epub_manage.record_files definition
 -- epub_manage.book_link_file table definition
 CREATE TABLE `book_link_file` (
   `id` INT NOT NULL AUTO_INCREMENT,

+ 0 - 91
epub_node/db/auth.js

@@ -1,91 +0,0 @@
-import connection from "./base.js";
-
-export async function auth_insert({
-  name = "",
-  user_id = "",
-  account = "",
-  password = "",
-  create_time = "",
-  update_time = "",
-}) {
-  return new Promise(async (resolve, reject) => {
-    try {
-      const sql = `
-        INSERT INTO authors (name, user_id, account, password, create_time, update_time)
-        VALUES (?, ?, ?, ?, ?, ?)
-      `;
-      const values = [
-        name,
-        user_id,
-        account,
-        password,
-        create_time,
-        update_time,
-      ];
-      // 直接接收 execute 返回的内容
-      connection.execute(sql, values, (result, fields) => {
-        return resolve(fields);
-      });
-    } catch (err) {
-      console.error("Error inserting data:", err);
-      return resolve(false);
-    }
-  });
-}
-
-// 是否存在重复的数据
-export function isHaveUserByUserId({ user_id = "", account = ""}) {
-  return new Promise((resolve, reject) => {
-    connection.query(
-      `SELECT * FROM authors WHERE user_id = ? OR account = ?`,
-      [user_id, account],
-      (err, rows) => {
-        if (err) {
-          // reject(err);
-          resolve(false); // 如果存在记录,则返回 true,否则返回 false
-        } else {
-          resolve(rows.length > 0); // 如果存在记录,则返回 true,否则返回 false
-        }
-      },
-    );
-  });
-}
-
-// 获取用户详情
-export function getUserInfoByuserId(user_id) {
-  return new Promise((resolve, reject) => {
-    connection.query(
-      `SELECT * FROM authors WHERE user_id = ?`,
-      [user_id],
-      (err, rows) => {
-        if (err) {
-          // reject(err);
-          resolve(false); // 如果存在记录,则返回 true,否则返回 false
-        } else {
-          resolve(rows.length > 0 ? rows[0] : false); // 如果存在记录,则返回 true,否则返回 false
-        }
-      },
-    );
-  });
-}
-
-// 用户是否已经注册
-export function isLoginUserByUserId({
-  account = "",
-  password = "",
-}) {
-  return new Promise((resolve, reject) => {
-    connection.query(
-      `SELECT * FROM authors WHERE password = ? AND account = ?`,
-      [password, account],
-      (err, rows) => {
-        if (err) {
-          // reject(err);
-          resolve(false); // 如果存在记录,则返回 true,否则返回 false
-        } else {
-          resolve(rows.length > 0 ? rows[0] : false); // 如果存在记录,则返回 true,否则返回 false
-        }
-      },
-    );
-  });
-}

+ 0 - 100
epub_node/db/book.js

@@ -1,100 +0,0 @@
-import connection from "./base.js";
-
-export async function books_insert({
-  book_name = '',
-  author_id = '',
-  create_time = '',
-  update_time = '',
-}) {
-  return new Promise(async (resolve, reject) => {
-    try {
-      const sql = `
-        INSERT INTO book (book_name, author_id, create_time, update_time)
-        VALUES (?, ?, ?, ?)
-      `;
-      const values = [book_name, author_id, create_time, update_time];
-      // 直接接收 execute 返回的内容
-      connection.execute(sql, values, (result, fields) => {
-        return resolve(fields.insertId);
-      });
-    } catch (err) {
-      return resolve(false);
-    }
-  })
-}
-
-// 获取所有账本
-export function getAllBook(author_id) {
-  return new Promise((resolve, reject) => {
-    connection.query(`SELECT * FROM book WHERE author_id = ? AND is_del=0`, [author_id], (err, rows) => {
-      if (err) {
-        resolve(false); // 如果存在记录,则返回 true,否则返回 false
-      } else {
-        resolve(rows); // 如果存在记录,则返回 true,否则返回 false
-      }
-    });
-  });
-}
-
-// 查询账本信息
-export function getBookById(book_id) {
-  return new Promise((resolve, reject) => {
-    connection.query(`SELECT * FROM book WHERE id = ? AND is_del=0`, [book_id], (err, rows) => {
-      if (err) {
-        resolve(false); // 如果存在记录,则返回 true,否则返回 false
-      } else {
-        resolve(rows.length > 0 ?  rows[0]: false); // 如果存在记录,则返回 true,否则返回 false
-      }
-    });
-  });
-}
-
-// 删除账本
-export function delBookById(book_id) {
-  return new Promise((resolve, reject) => {
-    connection.query(`update book SET is_del = 1 WHERE id = ?`, [book_id], (err, rows) => {
-      if (err) {
-        resolve(false); // 如果存在记录,则返回 true,否则返回 false
-      } else {
-        resolve(true); // 如果存在记录,则返回 true,否则返回 false
-      }
-    });
-  });
-}
-
-
-
-// 是否存在重复的账本数据
-export function ishaveBookById({
-  book_name = '',
-  author_id = '',
-}) {
-  return new Promise((resolve, reject) => {
-    connection.query(`SELECT * FROM book WHERE book_name = ? AND author_id = ? AND is_del=0`, [book_name, author_id], (err, rows) => {
-      if (err) {
-        // reject(err);
-        resolve(false); // 如果存在记录,则返回 true,否则返回 false
-      } else {
-        resolve(rows.length > 0); // 如果存在记录,则返回 true,否则返回 false
-      }
-    });
-  });
-}
-
-// 更新账本名称
-export function updateBookName({
-  book_name = '',
-  book_id = '',
-  update_time = '',
-}) {
-  return new Promise((resolve, reject) => {
-    connection.query(`UPDATE book SET book_name = ? , update_time = ? WHERE id = ?`, [book_name, update_time, book_id], (err, rows) => {
-      if (err) {
-        // reject(err);
-        resolve(false); // 如果存在记录,则返回 true,否则返回 false
-      } else {
-        resolve(rows.length > 0); // 如果存在记录,则返回 true,否则返回 false
-      }
-    });
-  });
-}

+ 21 - 109
epub_node/db/files.js

@@ -1,122 +1,34 @@
-import connection from './base.js';
-export async function files_insert({
-  name = '',
-  mimetype = '',
-  size = '',
-  md5 = '',
-  create_time = '',
-  update_time = '',
-}) {
-  return new Promise(async (resolve, reject) => {
-    try {
-      const sql = `
-        INSERT INTO files (name, mimetype, size, md5, create_time, update_time)
-        VALUES (?, ?, ?, ?, ?, ?)
-      `;
-      const values = [name, mimetype, size, md5, create_time, update_time];
-      // 直接接收 execute 返回的内容
-      const result = await connection.execute(sql, values);
-      return resolve(result);
-    } catch (err) {
-      return resolve(false);
-    }
-  })
-}
+import connection from "./base.js";
 
-// 是否存在重复的数据
-export function ishaveFileBymd5(md5Str) {
-  return new Promise((resolve, reject) => {
-    connection.query(`SELECT * FROM files WHERE md5 = ?`, [md5Str], (err, rows) => {
-      if (err) {
-        // reject(err);
-        resolve(false); // 如果存在记录,则返回 true,否则返回 false
-      } else {
-        resolve(rows.length > 0); // 如果存在记录,则返回 true,否则返回 false
-      }
-    });
-  });
-}
-
-// 查询图片信息
-export function getFileBymd5(md5Str) {
-  return new Promise((resolve, reject) => {
-    connection.query(`SELECT * FROM files WHERE md5 = ?`, [md5Str], (err, rows) => {
-      if (err) {
-        resolve(false); // 如果存在记录,则返回 true,否则返回 false
-      } else {
-        resolve(rows[0]); // 如果存在记录,则返回 true,否则返回 false
-      }
-    });
-  });
-}
-
-// 删除图片
-export function delFileBymd5(md5Str) {
-  return new Promise((resolve, reject) => {
-    connection.query(`update files SET is_del = 1 WHERE md5=?`, [md5Str], (err, rows) => {
-      if (err) {
-        resolve(false); // 如果存在记录,则返回 true,否则返回 false
-      } else {
-        resolve(true); // 如果存在记录,则返回 true,否则返回 false
-      }
-    });
-  });
-}
-
-// 映射数据与文件数据
-export function addFileByRecordId({
-  file_id = '',
-  record_id = '',
-  book_id = '',
-  author_id = '',
-  create_time = '',
-  update_time = '',
+/* 
+`file_id` VARCHAR(100) NOT NULL,  -- file_id 长度为 100
+  `md5` VARCHAR(32) NOT NULL,  -- MD5 长度为 32
+  `mimetype` VARCHAR(255) NOT NULL,  -- mimetype 长度为 255
+  `size` INT NOT NULL,
+  `name` VARCHAR(255) DEFAULT NULL,
+  `path` VARCHAR(255) DEFAULT NULL,
+  
+  */
+export async function files_insert({
+  file_id = "",
+  md5 = "",
+  mimetype = "",
+  size = "",
+  name = "",
+  path = "",
 }) {
   return new Promise(async (resolve, reject) => {
     try {
       const sql = `
-        INSERT INTO record_files (file_id, record_id, book_id, author_id, create_time, update_time)
-        VALUES (?, ?, ?, ?, ?, ?)
-      `;
-      const values = [file_id, record_id, book_id, author_id, create_time, update_time];
+          INSERT INTO files (file_id, md5, mimetype, size, name, path)
+          VALUES (?, ?, ?, ?, ?, ?)
+        `;
+      const values = [file_id, md5, mimetype, size, name, path];
       // 直接接收 execute 返回的内容
       const result = await connection.execute(sql, values);
       return resolve(result);
     } catch (err) {
       return resolve(false);
     }
-  })
-}
-
-// 根据id获取files
-export function getFileByRecordId(record_id) {
-  return new Promise((resolve, reject) => {
-    connection.query(`SELECT * FROM record_files WHERE record_id = ?`, [record_id], (err, rows) => {
-      if (err) {
-        resolve(false); // 如果存在记录,则返回 true,否则返回 false
-      } else {
-        resolve(rows); // 如果存在记录,则返回 true,否则返回 false
-      }
-    });
-  });
-}
-
-// 根据id删除映射数据
-export function delFileByRecordId(record_id, file_id) {
-  return new Promise((resolve, reject) => {
-    try {
-      const sql = `DELETE FROM record_files WHERE record_id = ? AND file_id = ?`;
-      connection.query(sql, [record_id, file_id], (err, result) => {
-        if (err) {
-          // 如果执行过程中出现错误,返回 false
-          return resolve(false);
-        }
-        // 删除成功后返回结果
-        return resolve(result);
-      });
-    } catch (err) {
-      // 捕获异常并返回 false
-      return resolve(false);
-    }
   });
 }

+ 2 - 6
epub_node/db/index.js

@@ -1,6 +1,2 @@
-export * from './files.js';
-export * from './auth.js';
-export * from './record.js';
-export * from './more_record.js';
-export * from './type.js';
-export * from './book.js';
+
+export * from './files.js'

+ 0 - 206
epub_node/db/more_record.js

@@ -1,206 +0,0 @@
-import connection from "./base.js";
-import dayjs from "dayjs";
-
-export async function addMoreRecord({
-  more_id = "",
-  name = "",
-  remark = "",
-  total_fee = "",
-  book_id = "",
-  author_id = "",
-  create_time = "",
-  update_time = "",
-  start_time = "",
-  end_time = "",
-  type_id = "",
-  log_day = "",
-}) {
-  return new Promise(async (resolve, reject) => {
-    try {
-      const sql = `
-        INSERT INTO more_record (more_id, name, remark, total_fee, book_id, author_id, create_time, update_time, start_time, end_time, type_id, log_day)
-        VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)
-      `;
-      const values = [
-        more_id,
-        name,
-        remark,
-        total_fee,
-        book_id,
-        author_id,
-        create_time,
-        update_time,
-        start_time,
-        end_time,
-        type_id,
-        log_day,
-      ];
-      // 直接接收 execute 返回的内容
-      connection.execute(sql, values, (result, fields) => {
-        return resolve(fields.insertId);
-      });
-    } catch (err) {
-      return resolve(false);
-    }
-  });
-}
-
-export async function updataMoreRecord(params) {
-  const {
-    more_id = "",
-    type_id = "",
-    name = "",
-    remark = "",
-    total_fee = "",
-    update_time = "",
-    start_time = "",
-    end_time = "",
-    log_day = "",
-  } = params;
-  return new Promise(async (resolve, reject) => {
-    try {
-      const sql = `
-        UPDATE more_record SET type_id = ?, name = ?, total_fee = ?, remark = ?, update_time = ?, start_time= ?, end_time = ? , log_day = ? WHERE more_id = ?;
-      `;
-      const values = [
-        type_id,
-        name,
-        total_fee,
-        remark,
-        update_time,
-        start_time,
-        end_time,
-        log_day,
-        more_id,
-      ];
-      // 执行更新语句
-      connection.execute(sql, values, (err, result) => {
-        if (err) {
-          // 错误处理
-          return resolve(false);
-        }
-        return resolve(result.changedRows > 0);
-      });
-    } catch (err) {
-      return resolve(false);
-    }
-  });
-}
-
-export function delMoreRecord(more_id, author_id) {
-  return new Promise((resolve, reject) => {
-    try {
-      const sql = `DELETE FROM more_record WHERE more_id = ? AND author_id = ?`;
-      connection.query(sql, [more_id, author_id], (err, result) => {
-        if (err) {
-          // 如果执行过程中出现错误,返回 false
-          return resolve(false);
-        }
-        // 删除成功后返回结果
-        return resolve(result);
-      });
-    } catch (err) {
-      // 捕获异常并返回 false
-      return resolve(false);
-    }
-  });
-}
-
-// 根据日期查询记录
-export function getMoreRecordsInfoByTime(time, day, book_id) {
-  return new Promise((resolve, reject) => {
-    connection.query(
-      `SELECT more_record.*, types.name AS type
-        FROM
-            more_record
-        JOIN
-            types
-        ON
-            more_record.type_id = types.id
-        WHERE
-            more_record.start_time <= ? AND
-            more_record.end_time >= ? AND
-            more_record.log_day = ? AND
-            more_record.book_id = ?;`,
-      [
-        `${dayjs(time).endOf("month").format("YYYY-MM-DD")}`,
-        `${dayjs(time).startOf("month").format("YYYY-MM-DD")}`,
-        day,
-        book_id,
-      ],
-      (err, rows) => {
-        if (err) {
-          // reject(err);
-          resolve(false); // 如果存在记录,则返回 true,否则返回 false
-        } else {
-          resolve(rows); // 如果存在记录,则返回 true,否则返回 false
-        }
-      }
-    );
-  });
-}
-
-// 根据月份查询记录
-export function getMoreRecordsInfoByMonth(time, book_id) {
-  return new Promise((resolve, reject) => {
-    connection.query(
-      `SELECT more_record.*, types.name AS type
-        FROM
-            more_record
-        JOIN
-            types
-        ON
-            more_record.type_id = types.id
-        WHERE
-            more_record.start_time <= ? AND
-            more_record.end_time >= ? AND
-            more_record.book_id = ?;`,
-      [
-        `${dayjs(time).endOf("month").format("YYYY-MM-DD")}`,
-        `${time}-01`,
-        book_id,
-      ],
-      (err, rows) => {
-        if (err) {
-          resolve(false);
-        } else {
-          resolve(rows);
-        }
-      }
-    );
-  });
-}
-
-// 查询所有账本信息
-export function getMoreRecordList(book_id, author_id) {
-  return new Promise((resolve, reject) => {
-    connection.query(
-      `SELECT * FROM more_record WHERE book_id = ? AND author_id = ?`,
-      [book_id, author_id],
-      (err, rows) => {
-        if (err) {
-          resolve(false); // 如果存在记录,则返回 true,否则返回 false
-        } else {
-          resolve(rows); // 如果存在记录,则返回 true,否则返回 false
-        }
-      }
-    );
-  });
-}
-
-// 查询账本信息
-export function getMoreRecordByMoreId(more_id, author_id) {
-  return new Promise((resolve, reject) => {
-    connection.query(
-      `SELECT * FROM more_record WHERE more_id = ? AND author_id = ?`,
-      [more_id, author_id],
-      (err, rows) => {
-        if (err) {
-          resolve(false); // 如果存在记录,则返回 true,否则返回 false
-        } else {
-          resolve(rows.length > 0 ? rows[0] : false); // 如果存在记录,则返回 true,否则返回 false
-        }
-      }
-    );
-  });
-}

+ 0 - 230
epub_node/db/record.js

@@ -1,230 +0,0 @@
-import dayjs from "dayjs";
-import connection from "./base.js";
-
-export async function record_insert({
-  book_id = "",
-  type_id = "",
-  author_id = "",
-  total_fee = "",
-  remark = "",
-  time = "",
-  create_time = "",
-  update_time = "",
-}) {
-  return new Promise(async (resolve, reject) => {
-    try {
-      const sql = `
-        INSERT INTO record (book_id, type_id, author_id, total_fee, remark, create_time, update_time, time)
-        VALUES (?, ?, ?, ?, ?, ?, ?, ?)
-      `;
-      const values = [
-        book_id,
-        type_id,
-        author_id,
-        total_fee,
-        remark,
-        create_time,
-        update_time,
-        time,
-      ];
-      // 直接接收 execute 返回的内容
-      connection.execute(sql, values, (result, fields) => {
-        return resolve(fields.insertId);
-      });
-    } catch (err) {
-      return resolve(false);
-    }
-  });
-}
-
-export async function record_update( params ) {
-  const {
-    id = "", // 要更新的记录的唯一标识符
-    type_id = "",
-    author_id = "",
-    total_fee = "",
-    remark = "",
-    time = "",
-    update_time = "",
-  } = params
-  return new Promise(async (resolve, reject) => {
-    try {
-      const sql = `
-        UPDATE record SET type_id = ?, author_id = ?, total_fee = ?, remark = ?, time = ?, update_time = ? WHERE id = ?
-      `;
-      const values = [ type_id, author_id, total_fee, remark, time, update_time, id, ];
-      // 执行更新语句
-      connection.execute(sql, values, (err, result) => {
-        if (err) {
-          // 错误处理
-          return resolve(false);
-        }
-        return resolve(result.changedRows > 0);
-      });
-    } catch (err) {
-      return resolve(false);
-    }
-  });
-}
-
-// 关联 账单 跟 附件的数据
-/*
-`file_id` varchar(300) NOT NULL,
-`record_id` varchar(300) NOT NULL,
-`book_id` varchar(300) NOT NULL,
-`user_id` varchar(300) NOT NULL,
-*/
-export function record_and_files({
-  file_id = "",
-  record_id = "",
-  book_id = "",
-  user_id = "",
-  create_time = "",
-  update_time = "",
-}) {
-  return new Promise(async (resolve, reject) => {
-    try {
-      const sql = `
-        INSERT INTO record_files (file_id, record_id, book_id, user_id, create_time, update_time)
-        VALUES (?, ?, ?, ?, ?, ?)
-      `;
-      const values = [
-        file_id,
-        record_id,
-        book_id,
-        user_id,
-        create_time,
-        update_time,
-      ];
-      // 直接接收 execute 返回的内容
-      const result = await connection.execute(sql, values);
-      return resolve(result);
-    } catch (err) {
-      return resolve(false);
-    }
-  });
-}
-
-export function recordRelation({
-  name = "",
-  record_id = "",
-  book_id = "",
-  user_id = "",
-  create_time = "",
-  update_time = "",
-}) {
-  return new Promise(async (resolve, reject) => {
-    try {
-      const sql = `
-        INSERT INTO record_files (file_id, record_id, book_id, user_id, create_time, update_time)
-        VALUES (?, ?, ?, ?, ?, ?)
-      `;
-      const values = [
-        file_id,
-        record_id,
-        book_id,
-        user_id,
-        create_time,
-        update_time,
-      ];
-      // 直接接收 execute 返回的内容
-      const result = await connection.execute(sql, values);
-      return resolve(result);
-    } catch (err) {
-      return resolve(false);
-    }
-  });
-}
-
-// 获取用户详情
-export function getRecordInfoById(record_id) {
-  return new Promise((resolve, reject) => {
-    connection.query(
-      `SELECT * FROM record WHERE id = ?`,
-      [record_id],
-      (err, rows) => {
-        if (err) {
-          // reject(err);
-          resolve(false); // 如果存在记录,则返回 true,否则返回 false
-        } else {
-          resolve(rows.length > 0 ? rows[0] : false); // 如果存在记录,则返回 true,否则返回 false
-        }
-      }
-    );
-  });
-}
-
-// 根据日期查询记录
-export function getRecordsInfoByTime(time, book_id) {
-  return new Promise((resolve, reject) => {
-    connection.query(
-      `SELECT record.*, types.name AS type
-        FROM
-            record
-        JOIN
-            types
-        ON
-            record.type_id = types.id
-        WHERE
-        record.time = ?
-        AND record.book_id = ?;`,
-      [`${dayjs(time).format('YYYY-MM-DD')} 00:00:00`, book_id],
-      (err, rows) => {
-        if (err) {
-          // reject(err);
-          resolve(false); // 如果存在记录,则返回 true,否则返回 false
-        } else {
-          resolve(rows); // 如果存在记录,则返回 true,否则返回 false
-        }
-      }
-    );
-  });
-}
-// 根据月份查询记录
-export function getRecordsInfoByMonth(time, book_id) {
-  return new Promise((resolve, reject) => {
-    connection.query(
-      // `SELECT * FROM record WHERE DATE_FORMAT(time, '%Y-%m') = ? AND book_id = ?`,
-      `SELECT record.*, types.name AS type
-        FROM
-            record
-        JOIN
-            types
-        ON
-            record.type_id = types.id
-        WHERE
-        DATE_FORMAT(record.time, '%Y-%m') = ?
-        AND record.book_id = ?;`,
-      [time, book_id],
-      (err, rows) => {
-        if (err) {
-          // reject(err);
-          resolve(false); // 如果存在记录,则返回 true,否则返回 false
-        } else {
-          resolve(rows); // 如果存在记录,则返回 true,否则返回 false
-        }
-      }
-    );
-  });
-}
-
-
-// 根据id删除数据
-export function delByRecordId(record_id, author_id) {
-  return new Promise((resolve, reject) => {
-    try {
-      const sql = `DELETE FROM record WHERE id = ? AND author_id = ?`;
-      connection.query(sql, [record_id, author_id], (err, result) => {
-        if (err) {
-          // 如果执行过程中出现错误,返回 false
-          return resolve(false);
-        }
-        // 删除成功后返回结果
-        return resolve(result);
-      });
-    } catch (err) {
-      // 捕获异常并返回 false
-      return resolve(false);
-    }
-  });
-}

+ 0 - 77
epub_node/db/type.js

@@ -1,77 +0,0 @@
-import connection from "./base.js";
-
-// 获取类型详情
-export function getTypesById({ typeId = "", book_id = "", author_id = "" }) {
-  return new Promise((resolve, reject) => {
-    connection.query(
-      `SELECT * FROM types WHERE id = ? AND author_id = ? AND book_id = ?`,
-      [typeId, author_id, book_id],
-      (err, rows) => {
-        if (err) {
-          resolve(false);
-        } else {
-          resolve(rows.length > 0 ? rows[0] : false);
-        }
-      }
-    );
-  });
-}
-
-// 获取用户所有的类型
-export function getTypesByUserId({ book_id = "", author_id = "" }) {
-  return new Promise((resolve, reject) => {
-    connection.query(
-      `SELECT * FROM types WHERE book_id = ? AND author_id = ?`,
-      [book_id, author_id],
-      (err, rows) => {
-        if (err) {
-          resolve(false);
-        } else {
-          resolve(rows);
-        }
-      }
-    );
-  });
-}
-// 用户是否已经注册
-export function isType({ book_id = "", author_id = "", type = "" }) {
-  return new Promise((resolve, reject) => {
-    connection.query(
-      `SELECT * FROM types WHERE book_id = ? AND author_id = ? AND name = ?`,
-      [book_id, author_id, type],
-      (err, rows) => {
-        if (err) {
-          // reject(err);
-          resolve(false); // 如果存在记录,则返回 true,否则返回 false
-        } else {
-          resolve(rows.length > 0 ? rows[0] : false); // 如果存在记录,则返回 true,否则返回 false
-        }
-      }
-    );
-  });
-}
-
-export async function type_insert({
-  book_id = "",
-  author_id = "",
-  type = "",
-  create_time = "",
-  update_time = "",
-}) {
-  return new Promise(async (resolve, reject) => {
-    try {
-      const sql = `
-        INSERT INTO types (name, book_id, author_id, create_time, update_time)
-        VALUES (?, ?, ?, ?, ?)
-      `;
-      const values = [type, book_id, author_id, create_time, update_time];
-      // 直接接收 execute 返回的内容
-      const result = await connection.execute(sql, values);
-      return resolve(result);
-    } catch (err) {
-      console.error("Error inserting data:", err);
-      // throw err;
-      return resolve(false);
-    }
-  });
-}

+ 0 - 33
epub_node/db/update.sql

@@ -1,33 +0,0 @@
-ALTER TABLE cashbook.authors MODIFY COLUMN id int NOT NULL AUTO_INCREMENT;
-
-ALTER TABLE cashbook.authors DROP KEY authors_unique_1;
-ALTER TABLE cashbook.authors DROP COLUMN mobile;
-ALTER TABLE cashbook.authors CHANGE email account varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NOT NULL;
-ALTER TABLE cashbook.authors DROP COLUMN login_type;
-
-
-ALTER TABLE cashbook.record ADD source_id varchar(100) NULL;
-
-
-ALTER TABLE cashbook.record MODIFY COLUMN remark LONGTEXT CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL;
-
-ALTER TABLE cashbook.more_record ADD more_id varchar(300) NOT NULL;
-ALTER TABLE cashbook.more_record ADD CONSTRAINT more_record_unique UNIQUE KEY (more_id);
-ALTER TABLE cashbook.more_record ADD remark LONGTEXT NULL;
-
-ALTER TABLE cashbook.more_record ADD total_fee decimal(15,2) NOT NULL;
-
-ALTER TABLE cashbook.more_record MODIFY COLUMN name varchar(300) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NOT NULL;
-
-
-ALTER TABLE cashbook.more_record ADD start_time TIMESTAMP NOT NULL;
-
-ALTER TABLE cashbook.more_record ADD start_time TIMESTAMP NOT NULL;
-ALTER TABLE cashbook.more_record ADD end_time TIMESTAMP NOT NULL;
-
-ALTER TABLE cashbook.more_record ADD type_id INT NULL;
-
-
-ALTER TABLE cashbook.more_record ADD log_day INT NOT NULL;
-
-

+ 3 - 1
epub_node/package.json

@@ -31,12 +31,14 @@
     "epub2": "^3.0.2",
     "express": "^4.21.1",
     "express-fileupload": "^1.5.1",
+    "fs": "^0.0.1-security",
     "jsonwebtoken": "^9.0.2",
     "mysql": "^2.18.1",
     "mysql2": "^3.11.4",
     "nodemon": "^3.1.7",
     "spark-md5": "^3.0.2",
-    "uuid": "^11.0.2"
+    "uuid": "^11.0.2",
+    "winston": "^3.17.0"
   },
   "volta": {
     "node": "22.12.0"

+ 0 - 78
epub_node/router/authors/index.js

@@ -1,78 +0,0 @@
-// 添加账本
-import express from "express";
-import { generateToken, aes_encrypt, shanghaiTime } from "#utils";
-import { isHaveUserByUserId, auth_insert, isLoginUserByUserId } from "#db";
-const router = express.Router();
-import { v4 as uuidv4 } from "uuid";
-
-// middleware that is specific to this router
-router.use(function timeLog(req, res, next) {
-  console.log("Time: ", Date.now());
-  next();
-});
-
-// 注册
-router.post("/register", async function (req, res) {
-  const { account, name = "", password = "" } = req.body;
-  const user_id = uuidv4();
-  if (await isHaveUserByUserId({ user_id, account,})) {
-    res.send({
-      code: 500,
-      msg: "当前注册信息有重复,请检查之后重新提交!",
-    });
-    return;
-  }
-  // 写入数据
-  await auth_insert({
-    name,
-    account,
-    user_id,
-    password: aes_encrypt(password),
-    create_time: shanghaiTime().format("YYYY-MM-DD HH:mm:ss"),
-    update_time: shanghaiTime().format("YYYY-MM-DD HH:mm:ss"),
-  });
-
-  const token = await getToken(account, password)
-  res.json({
-    code: 200,
-    data: {
-      token
-    }
-  });
-});
-
-async function getToken(account, password) {
-  const islogin = await isLoginUserByUserId({
-    password: aes_encrypt(password),
-    account,
-  });
-  if(!islogin) return false
-  delete islogin.password;
-  delete islogin.login_type;
-  delete islogin.id;
-  return generateToken(islogin);
-}
-
-// 登陆
-router.post("/", async function (req, res) {
-  const { account, password } = req.body;
-
-  const token = await getToken(account, password);
-
-  if (!token) {
-    res.json({
-      code: 404,
-      msg: "登录失败,当前用户不存在",
-      data: {},
-    });
-    return;
-  }
-  res.json({
-    code: 200,
-    msg: "登录成功",
-    data: { token },
-  });
-  // res.send("authors home page");
-});
-
-export default router;

+ 0 - 33
epub_node/router/authors/login.js

@@ -1,33 +0,0 @@
-// 添加账本
-import express from "express";
-
-const router = express.Router();
-
-// 更新密码
-router.put("/", function (req, res) {
-  res.send("authors home page");
-});
-
-// 注销
-router.delete("/", function (req, res) {
-  res.send("authors home page");
-});
-
-// 获取用户详情
-router.post("/user_info", function (req, res) {
-  let userInfo = {
-    name: req.body.userInfo.name,
-    user_id: req.body.userInfo.user_id,
-    create_time: req.body.userInfo.create_time,
-    update_time: req.body.userInfo.update_time,
-    mobile: req.body.userInfo.mobile,
-    email: req.body.userInfo.email
-  }
-  res.json({
-    code: 200,
-    data: userInfo
-  })
-});
-
-
-export default router;

+ 0 - 113
epub_node/router/books/index.js

@@ -1,113 +0,0 @@
-// 添加账本
-import express from "express";
-
-const router = express.Router();
-
-import {
-  getBookById,
-  books_insert,
-  delBookById,
-  ishaveBookById,
-  updateBookName,
-  getAllBook
-} from "#db";
-import {
-  shanghaiTime,
-  shanghaiTimeFormat
-} from '#utils'
-
-// middleware that is specific to this router
-router.use(function timeLog(req, res, next) {
-  console.log("Time: ", Date.now());
-  next();
-});
-
-// 获取所有账本
-router.get("/", async function (req, res) {
-  const { userInfo = {} } = req.body;
-  const bookInfo = await getAllBook(userInfo.user_id);
-  
-  res.json({
-    code: 200,
-    data: bookInfo.map(elm => {
-      return {
-        book_name: elm.book_name,
-        create_time: shanghaiTimeFormat(elm.create_time),
-        id: elm.id,
-        update_time: shanghaiTimeFormat(elm.update_time),
-      }
-    }),
-  });
-});
-
-// 获取账本详情
-router.get("/:book_id", async function (req, res) {
-  const book_id = req.params.book_id; // 获取 fileId 参数
-  const bookInfo = await getBookById(book_id);
-  bookInfo.create_time = shanghaiTimeFormat(bookInfo.create_time)
-  bookInfo.update_time = shanghaiTimeFormat(bookInfo.update_time)
-  delete bookInfo.is_del
-  res.json({
-    code: 200,
-    data: bookInfo,
-  });
-});
-
-// 添加账本数据
-router.post("/", async function (req, res) {
-  const { book_name = "", userInfo = {} } = req.body;
-  // type 是否存在重复项,有就返回id,没有就新增 再返回id
-  const isAddType = await ishaveBookById({
-    book_name,
-    author_id: userInfo.user_id,
-  });
-  if (isAddType) {
-    res.json({
-      code: 500,
-      msg: "已存在重复数据",
-    });
-    return;
-  }
-  const insertId = await books_insert({
-    book_name,
-    author_id: userInfo.user_id,
-    create_time: shanghaiTime().format("YYYY-MM-DD HH:mm:ss"),
-    update_time: shanghaiTime().format("YYYY-MM-DD HH:mm:ss"),
-  });
-
-  res.json({
-    code: 200,
-    data: {
-      book_id: insertId,
-    },
-  });
-});
-
-// 更新bookName
-router.put("/:book_id", async function (req, res) {
-  const book_id = req.params.book_id; // 获取 fileId 参数
-  const { book_name = ""} = req.body;
-  await updateBookName({
-    book_name,
-    book_id,
-    update_time: shanghaiTime().format("YYYY-MM-DD HH:mm:ss"),
-  })
-  res.json({
-    code: 200,
-    msg: "更新成功!",
-  });
-});
-
-// 删除数据
-router.delete("/:book_id", async function (req, res) {
-  delBookById;
-  // getBookById
-  const book_id = req.params.book_id; // 获取 fileId 参数
-  await delBookById(book_id);
-  res.json({
-    code: 200,
-    msg: "删除成功!",
-  });
-});
-
-export default router;

+ 82 - 0
epub_node/router/epub/image.js

@@ -0,0 +1,82 @@
+import crypto from "crypto";
+import fs from "node:fs";
+import { files_insert } from "#db";
+
+export async function saveImgs(epub) {
+  // const res = await Promise.allSettled(imgs.map(elm => {
+  // }))
+  let imgs = epub.listImage();
+  console.log(imgs[0]);
+  console.log(imgs.length);
+  await epub.getImageAsync(imgs[0].id).then(async function ([data, mimeType]) {
+    console.log(`\ngetImage: cover\n`);
+    console.log(data);
+    const img_md5 = await calculateMD5FromBuffer(data);
+    console.log(img_md5);
+    console.log(mimeType);
+    console.log(1616, formatSize(data.length));
+    await files_insert()
+  });
+}
+
+function calculateMD5(filePath) {
+  const hash = crypto.createHash("md5");
+  const stream = fs.createReadStream(filePath);
+
+  stream.on("data", (chunk) => {
+    hash.update(chunk);
+  });
+
+  stream.on("end", () => {
+    console.log("MD5 hash:", hash.digest("hex"));
+  });
+}
+
+export async function calculateMD5FromStream(fileStream) {
+  return new Promise((resolve, reject) => {
+    const hash = crypto.createHash("md5");
+
+    // 错误处理
+    fileStream.on("error", (err) => {
+      console.error("Error reading file stream:", err);
+      reject("生成失败!"); // 使用 reject 传递错误信息
+    });
+
+    // 监听 'data' 事件,更新 MD5 哈希
+    fileStream.on("data", (chunk) => {
+      hash.update(chunk);
+    });
+
+    // 监听 'end' 事件,文件读取完毕后输出 MD5 值
+    fileStream.on("end", () => {
+      const md5 = hash.digest("hex");
+      console.log("MD5 Hash:", md5);
+      resolve(md5); // 正常计算完 MD5 后 resolve
+    });
+  });
+}
+
+export function calculateMD5FromBuffer(buffer) {
+  return new Promise((resolve, reject) => {
+    try {
+      // 使用 crypto 计算 MD5
+      const hash = crypto.createHash("md5");
+      hash.update(buffer); // 直接更新 hash
+
+      const md5 = hash.digest("hex"); // 获取最终的 MD5 值
+      console.log("MD5 Hash:", md5);
+      resolve(md5); // 返回 MD5
+    } catch (err) {
+      console.error("Error calculating MD5:", err);
+      reject("生成失败!");
+    }
+  });
+}
+
+const formatSize = (bytes) => {
+  if (bytes < 1024) return `${bytes} 字节`;
+  else if (bytes < 1024 * 1024) return `${(bytes / 1024).toFixed(2)} KB`;
+  else if (bytes < 1024 * 1024 * 1024)
+    return `${(bytes / (1024 * 1024)).toFixed(2)} MB`;
+  else return `${(bytes / (1024 * 1024 * 1024)).toFixed(2)} GB`;
+};

+ 6 - 20
epub_node/router/epub/index.js

@@ -2,8 +2,9 @@
 import express from "express";
 import { EPub } from "epub2";
 
+import { saveImgs } from "./image.js";
+
 const router = express.Router();
-import { getTypesByUserId } from "#db";
 
 // middleware that is specific to this router
 router.use(function timeLog(req, res, next) {
@@ -11,22 +12,7 @@ router.use(function timeLog(req, res, next) {
 });
 // define the home page route
 router.get("/", async function (req, res) {
-  const { userInfo = {} } = req.body;
-  // getTypesByUserId
-  const { book_id = "" } = req.query;
-
-  const typesRes = await getTypesByUserId({
-    book_id,
-    author_id: userInfo.user_id,
-  });
-
-  res.json({
-    code: 200,
-    data: typesRes.map((elm) => ({
-      name: elm.name,
-      id: elm.id,
-    })),
-  });
+  res.send("epub types");
 });
 // define the about route
 router.get("/about", function (req, res) {
@@ -44,12 +30,12 @@ router.put("/", async function (req, res) {
   sampleFile = req.files.file;
   console.log(4545, sampleFile);
 
-  const file_md5 = sampleFile.md5
+  const file_md5 = sampleFile.md5;
 
   var epub = await EPub.createAsync(sampleFile.data, null, "");
   console.log(4545, epub.metadata);
   // console.log('manifest__', epub.manifest);
-  
+
   // Object.keys(epub.metadata).forEach((objKey) => {
   //   console.log(464646, objKey, epub.metadata[objKey]);
   // });
@@ -66,7 +52,7 @@ router.put("/", async function (req, res) {
     2、替换文件中的图片内容
     3、存储html数据
    */
-
+  await saveImgs(epub);
   res.send("About types");
 });
 

+ 0 - 90
epub_node/router/files/index.js

@@ -1,90 +0,0 @@
-// 附件
-import express from "express";
-import path from "path";
-import fs from "node:fs";
-import { files_insert, ishaveFileBymd5, getFileBymd5 } from "#db";
-import { shanghaiTime, dirExists } from "#utils";
-const router = express.Router();
-
-router.use(function timeLog(req, res, next) {
-  console.log("Time: ", Date.now());
-  next();
-});
-
-router.get("/:fileId", async function (req, res) {
-  const fileId = req.params.fileId; // 获取 fileId 参数
-  const fileRow = await getFileBymd5(fileId);
-
-  if (!fileRow) {
-    return res.status(404).send("文件查询失败");
-  }
-
-  const uploadPath = "./base_files/" + fileId;
-  const filePath = path.resolve(uploadPath);
-
-  // 检查文件是否存在
-  if (!fs.existsSync(filePath)) {
-    return res.status(404).send("服务器中不存在该文件");
-  }
-
-  // 返回文件
-  res.setHeader("Content-Type", fileRow.mimetype);
-  res.sendFile(filePath);
-});
-
-// 上传附件
-router.put("/", async function (req, res) {
-  let sampleFile;
-  let uploadPath;
-
-  if (!req.files || Object.keys(req.files).length === 0) {
-    return res.status(400).send("No files were uploaded.");
-  }
-
-  sampleFile = req.files.sampleFile;
-
-  // const fileMd5 = await computeFileMD5(sampleFile);
-  const fileMd5 = sampleFile.md5;
-  // 如果存在重复的数据, 终止后续的操作
-  if (await ishaveFileBymd5(fileMd5)) {
-    res.send({
-      file_id: fileMd5,
-    });
-    return;
-  }
-
-  const fileInfo = {
-    name: sampleFile.name,
-    mimetype: sampleFile.mimetype,
-    size: sampleFile.size,
-    md5: sampleFile.md5,
-    create_time: shanghaiTime().format("YYYY-MM-DD HH:mm:ss"),
-    update_time: shanghaiTime().format("YYYY-MM-DD HH:mm:ss"),
-  };
-  uploadPath = "./base_files/" + sampleFile.md5;
-  dirExists("./base_files/");
-
-  // 、移动上传文件至指定目录
-  sampleFile.mv(uploadPath, async function (err) {
-    if (err) {
-      return res.status(500).send(err);
-    }
-    const isAdd = await files_insert(fileInfo);
-    if (!isAdd) {
-      res.status(500).send({
-        msg: "添加失败",
-      });
-      return;
-    }
-    res.send({
-      file_id: fileMd5,
-    });
-  });
-});
-
-// define the about route
-router.get("/about", function (req, res) {
-  res.send("About files");
-});
-
-export default router;

+ 0 - 238
epub_node/router/record/index.js

@@ -1,238 +0,0 @@
-// 添加账本
-import express from "express";
-import dayjs from "dayjs";
-const router = express.Router();
-import {
-  record_insert,
-  record_update,
-  isType,
-  type_insert,
-  getRecordInfoById,
-  addFileByRecordId,
-  getFileByRecordId,
-  getRecordsInfoByTime,
-  getRecordsInfoByMonth,
-  getTypesById,
-  delFileByRecordId,
-  delByRecordId,
-  getMoreRecordsInfoByMonth,
-  getMoreRecordsInfoByTime,
-} from "#db";
-import { shanghaiTime, shanghaiTimeFormat } from "#utils";
-import {
-  getTypeInfoFn,
-  setFilesById,
-  setFilesByRecord,
-  getFileUrl,
-} from "./utils.js";
-
-// middleware that is specific to this router
-router.use(function timeLog(req, res, next) {
-  console.log("Time: ", Date.now());
-  next();
-});
-
-// 添加单个账单记录
-router.post("/", async function (req, res) {
-  const {
-    book_id = "",
-    total_fee = 0,
-    type = "",
-    time = "",
-    remark = "",
-    files = [],
-    userInfo = {},
-  } = req.body;
-  const type_id = await getTypeInfoFn({ userInfo, book_id, type });
-  const insertId = await record_insert({
-    book_id,
-    type_id: type_id,
-    author_id: userInfo.user_id,
-    total_fee,
-    remark,
-    time: shanghaiTimeFormat(time),
-    create_time: shanghaiTime().format("YYYY-MM-DD HH:mm:ss"),
-    update_time: shanghaiTime().format("YYYY-MM-DD HH:mm:ss"),
-  });
-
-  await setFilesByRecord({
-    files,
-    insertId,
-    book_id,
-    userInfo,
-  });
-
-  res.json({
-    code: 200,
-    data: {
-      record_id: insertId,
-    },
-  });
-});
-
-// define the home page route
-router.get("/:record_id", async function (req, res) {
-  const record_id = req.params.record_id; // 获取 fileId 参数
-  const recordInfo = await getRecordInfoById(record_id);
-  const files = await getFileByRecordId(record_id);
-
-  const typesRes = await getTypesById({
-    typeId: recordInfo.type_id,
-    book_id: recordInfo.book_id,
-    author_id: recordInfo.author_id,
-  });
-  if (typesRes) {
-    recordInfo.type = typesRes.name;
-  } else {
-    recordInfo.type = "";
-  }
-
-  res.json({
-    code: 200,
-    data: {
-      headers: req.headers,
-      ...recordInfo,
-      time: shanghaiTimeFormat(recordInfo.time, "YYYY-MM-DD"),
-      create_time: shanghaiTimeFormat(recordInfo.create_time),
-      update_time: shanghaiTimeFormat(recordInfo.update_time),
-      files: files.map((elm) => getFileUrl(req, elm)),
-    },
-  });
-});
-
-// 更新账本数据
-router.put("/:record_id", async function (req, res) {
-  const record_id = req.params.record_id; // 获取 fileId 参数
-  const {
-    book_id = "",
-    total_fee = 0,
-    type = "",
-    time = "",
-    remark = "",
-    files = [],
-    userInfo = {},
-  } = req.body;
-
-  // 更新附件信息
-  await setFilesById({
-    record_id,
-    userInfo,
-    book_id,
-    files,
-  });
-
-  // 更新类型
-  const typeId = await getTypeInfoFn({
-    userInfo,
-    book_id,
-    type,
-  });
-
-  const recordInfo = await record_update({
-    id: record_id, // 要更新的记录的唯一标识符
-    type_id: typeId,
-    author_id: userInfo.user_id,
-    total_fee: total_fee,
-    remark: remark,
-    time: time,
-    update_time: shanghaiTime().format("YYYY-MM-DD HH:mm:ss"),
-  });
-  res.json({
-    code: 200,
-    data: recordInfo ? "" : "更新失败",
-  });
-});
-
-// define the about route
-router.get("/about", function (req, res) {
-  res.send("About record");
-});
-
-// 根据日期获取数据
-router.get("/:book_id/:time", async function (req, res) {
-  const time = req.params.time; // 获取 fileId 参数
-  const book_id = req.params.book_id; // 获取 fileId 参数
-  const recordsInfoRes = await getRecordsInfoByTime(time, book_id);
-  const moreRecordsInfoRes = await getMoreRecordsInfoByTime(
-    time,
-    dayjs(time).date(),
-    book_id
-  );
-  res.json({
-    code: 200,
-    data: recordsInfoRes
-      .map((elm) => ({
-        ...elm,
-        time: shanghaiTimeFormat(elm.time, "YYYY-MM-DD"),
-        create_time: shanghaiTimeFormat(elm.create_time),
-        update_time: shanghaiTimeFormat(elm.update_time),
-      }))
-      .concat(
-        moreRecordsInfoRes.map((elm) => {
-          return {
-            ...elm,
-            time: shanghaiTimeFormat(`${time}-${elm.log_day}`, "YYYY-MM-DD"),
-            create_time: shanghaiTimeFormat(elm.create_time),
-            update_time: shanghaiTimeFormat(elm.update_time),
-          };
-        })
-      )
-      .sort(
-        (a, b) => dayjs(b.update_time).unix() - dayjs(a.update_time).unix()
-      ),
-  });
-});
-
-// 根据日期获取数据
-router.get("/:book_id/m/:time", async function (req, res) {
-  const time = req.params.time; // 获取 fileId 参数
-  const book_id = req.params.book_id; // 获取 fileId 参数
-  const recordsInfoRes = await getRecordsInfoByMonth(time, book_id);
-  const moreRecordsInfoRes = await getMoreRecordsInfoByMonth(time, book_id);
-
-  res.json({
-    code: 200,
-    data: recordsInfoRes
-      .map((elm) => ({
-        ...elm,
-        time: shanghaiTimeFormat(elm.time, "YYYY-MM-DD"),
-        create_time: shanghaiTimeFormat(elm.create_time),
-        update_time: shanghaiTimeFormat(elm.update_time),
-      }))
-      .concat(
-        moreRecordsInfoRes.map((elm) => {
-          return {
-            ...elm,
-            time: shanghaiTimeFormat(`${time}-${elm.log_day}`, "YYYY-MM-DD"),
-            create_time: shanghaiTimeFormat(elm.create_time),
-            update_time: shanghaiTimeFormat(elm.update_time),
-          };
-        })
-      )
-      .sort((a, b) => dayjs(a.time).unix() - dayjs(b.time).unix()),
-  });
-});
-
-// 删除指定账单
-router.delete("/:record_id", async function (req, res) {
-  const record_id = req.params.record_id; // 获取 fileId 参数
-  const { userInfo = {} } = req.body;
-  const recordInfo = await getRecordInfoById(record_id);
-
-  // 删除附件映射关系
-  const getAllfiles = await getFileByRecordId(record_id);
-  if (getAllfiles.length) {
-    await Promise.all(
-      getAllfiles.map((elm) => delFileByRecordId(record_id, elm.file_id))
-    );
-  }
-
-  // 删除record数据
-  await delByRecordId(record_id, userInfo.user_id);
-
-  res.json({
-    code: 200,
-    data: "",
-  });
-});
-export default router;

+ 0 - 200
epub_node/router/record/more.js

@@ -1,200 +0,0 @@
-import express from "express";
-
-const router = express.Router();
-import { v4 as uuidv4 } from "uuid";
-import { shanghaiTime, shanghaiTimeFormat } from "#utils";
-import {
-  addMoreRecord,
-  updataMoreRecord,
-  delMoreRecord,
-  record_update,
-  getRecordInfoById,
-  getFileByRecordId,
-  delFileByRecordId,
-  delByRecordId,
-  getMoreRecordList,
-  getMoreRecordByMoreId,
-  getTypesById,
-} from "#db";
-import { getTypeInfoFn, setFilesById, setFilesByRecord, getFileUrl } from "./utils.js";
-
-// 添加多个账单记录
-router.post("/", async function (req, res) {
-  const {
-    name = "",
-    remark = "",
-    book_id = "",
-    start_time = "",
-    end_time = "",
-    total_fee = 0,
-    log_day = '',
-    type = "",
-    files = [],
-    userInfo = {},
-  } = req.body;
-
-  const more_id = `M_${uuidv4()}`;
-
-  const type_id = await getTypeInfoFn({ userInfo, book_id, type });
-
-  await addMoreRecord({
-    more_id,
-    book_id,
-    type_id: type_id,
-    author_id: userInfo.user_id,
-    total_fee,
-    name,
-    remark,
-    log_day,
-    start_time: shanghaiTimeFormat(start_time, "YYYY-MM-DD") + " 00:00:00",
-    end_time: shanghaiTimeFormat(end_time, "YYYY-MM-DD") + " 23:59:59",
-
-    create_time: shanghaiTime().format("YYYY-MM-DD HH:mm:ss"),
-    update_time: shanghaiTime().format("YYYY-MM-DD HH:mm:ss"),
-  });
-
-  await setFilesByRecord({
-    files,
-    book_id,
-    more_id,
-    userInfo,
-  });
-
-  res.json({
-    code: 200,
-    data: {
-      record_id: more_id,
-    },
-  });
-});
-
-// 编辑多个账单记录
-router.put("/:more_id", async function (req, res) {
-  const more_id = req.params.more_id; // 获取 fileId 参数
-  const {
-    name = "",
-    remark = "",
-    book_id = "",
-    start_time = "",
-    end_time = "",
-    total_fee = 0,
-    type = "",
-    log_day = "",
-    files = [],
-    userInfo = {},
-  } = req.body;
-
-  // 更新附件信息
-  await setFilesById({
-    record_id: more_id,
-    userInfo,
-    book_id,
-    files,
-  });
-
-  // 更新类型
-  const typeId = await getTypeInfoFn({
-    userInfo,
-    book_id,
-    type,
-  });
-
-  // 更新数据内容
-  const recordInfo = await updataMoreRecord({
-    name,
-    more_id,
-    type_id: typeId,
-    author_id: userInfo.user_id,
-    total_fee: total_fee,
-    remark: remark,
-    log_day,
-    start_time: shanghaiTimeFormat(start_time, "YYYY-MM-DD") + " 00:00:00",
-    end_time: shanghaiTimeFormat(end_time, "YYYY-MM-DD") + " 23:59:59",
-    update_time: shanghaiTime().format("YYYY-MM-DD HH:mm:ss"),
-  });
-
-  res.json({
-    code: 200,
-    data: recordInfo ? "" : "更新失败",
-  });
-});
-
-// 删除单个账单记录
-router.delete("/:more_id", async function (req, res) {
-  const more_id = req.params.more_id; // 获取 fileId 参数
-  const { userInfo = {} } = req.body;
-  // const recordInfo = await getRecordInfoById(more_id);
-
-  // 删除附件映射关系
-  const getAllFiles = await getFileByRecordId(more_id);
-  if (getAllFiles.length) {
-    await Promise.all(
-      getAllFiles.map((elm) => delFileByRecordId(more_id, elm.file_id))
-    );
-  }
-  // 删除record数据
-  await delMoreRecord(more_id, userInfo.user_id);
-
-  res.json({
-    code: 200,
-    data: "",
-  });
-});
-
-// 获取所有批量账单记录
-router.post("/list/:book_id", async function (req, res) {
-  const book_id = req.params.book_id; // 获取 fileId 参数
-  const { userInfo = {} } = req.body;
-  const moreRecordList = await getMoreRecordList(book_id, userInfo.user_id);
-
-  res.json({
-    code: 200,
-    data: moreRecordList.map((elm) => ({
-      name: elm.name,
-      more_id: elm.more_id,
-      remark: elm.remark,
-      total_fee: elm.total_fee,
-      create_time: shanghaiTimeFormat(elm.create_time),
-      start_time: shanghaiTimeFormat(elm.start_time),
-      end_time: shanghaiTimeFormat(elm.end_time),
-    })),
-  });
-});
-
-// 获取所有批量账单记录
-router.get("/:more_id", async function (req, res) {
-  const more_id = req.params.more_id; // 获取 fileId 参数
-  const { userInfo = {} } = req.body;
-  const files = await getFileByRecordId(more_id);
-  const moreRecordInfo = await getMoreRecordByMoreId(more_id, userInfo.user_id);
-
-  const typesRes = await getTypesById({
-    typeId: moreRecordInfo.type_id,
-    book_id: moreRecordInfo.book_id,
-    author_id: moreRecordInfo.author_id,
-  });
-  if (typesRes) {
-    moreRecordInfo.type = typesRes.name;
-  } else {
-    moreRecordInfo.type = "";
-  }
-
-
-  res.json({
-    code: 200,
-    data: {
-      type: moreRecordInfo.type,
-      name: moreRecordInfo.name,
-      more_id: moreRecordInfo.more_id,
-      remark: moreRecordInfo.remark,
-      total_fee: moreRecordInfo.total_fee,
-      log_day: moreRecordInfo.log_day,
-      create_time: shanghaiTimeFormat(moreRecordInfo.create_time),
-      start_time: shanghaiTimeFormat(moreRecordInfo.start_time),
-      end_time: shanghaiTimeFormat(moreRecordInfo.end_time),
-      files: files.map((elm) => getFileUrl(req, elm)),
-    },
-  });
-});
-
-export default router;

+ 0 - 118
epub_node/router/record/utils.js

@@ -1,118 +0,0 @@
-import {
-  record_insert,
-  record_update,
-  isType,
-  type_insert,
-  getRecordInfoById,
-  addFileByRecordId,
-  getFileByRecordId,
-  getRecordsInfoByTime,
-  getRecordsInfoByMonth,
-  getTypesById,
-  delFileByRecordId,
-  delByRecordId,
-} from "#db";
-
-import { shanghaiTime, shanghaiTimeFormat } from "#utils";
-
-export async function getTypeInfoFn({ userInfo, book_id, type }) {
-  console.log(1919191919, userInfo, book_id, type )
-  if (!type) {
-    return "";
-  }
-  // type 是否存在重复项,有就返回id,没有就新增 再返回id
-  const isAddType = await isType({
-    book_id,
-    author_id: userInfo.user_id,
-    type,
-  });
-
-  let typeInfo = {};
-  if (!isAddType) {
-    await type_insert({
-      book_id,
-      author_id: userInfo.user_id,
-      type,
-      create_time: shanghaiTime().format("YYYY-MM-DD HH:mm:ss"),
-      update_time: shanghaiTime().format("YYYY-MM-DD HH:mm:ss"),
-    });
-    typeInfo = await isType({
-      book_id,
-      author_id: userInfo.user_id,
-      type,
-    });
-  } else {
-    typeInfo = { ...isAddType };
-  }
-  return Promise.resolve(typeInfo.id);
-}
-
-
-
-export async function setFilesByRecord(params) {
-  const {files = [], more_id, userInfo, book_id} = params
-  if(!files.length) return
-  await Promise.all(
-    files.map((file_id) =>
-      addFileByRecordId({
-        file_id,
-        record_id: more_id,
-        book_id,
-        author_id: userInfo.user_id,
-        create_time: shanghaiTime().format("YYYY-MM-DD HH:mm:ss"),
-        update_time: shanghaiTime().format("YYYY-MM-DD HH:mm:ss"),
-      })
-    )
-  );
-}
-
-
-export async function setFilesById(params) {
-  const {record_id, userInfo, book_id, files = []} = params
-  const getAllFiles = await getFileByRecordId(record_id);
-  const getAllFilesIds = getAllFiles.map((elm) => elm.file_id);
-
-  const dellFilesInRecordFiles = getAllFiles.filter(
-    (elm) => files.indexOf(elm.file_id) < 0
-  );
-  const needAddFiles = files.filter(
-    (file_id) => getAllFilesIds.indexOf(file_id) < 0
-  );
-
-  if (dellFilesInRecordFiles.length) {
-    await Promise.all(
-      dellFilesInRecordFiles.map((elm) =>
-        delFileByRecordId(record_id, elm.file_id)
-      )
-    );
-  }
-  if (needAddFiles.length) {
-    // 更新附件信息
-    await Promise.all(
-      needAddFiles.map((file_id) =>
-        addFileByRecordId({
-          file_id,
-          record_id,
-          book_id,
-          author_id: userInfo.user_id,
-          create_time: shanghaiTime().format("YYYY-MM-DD HH:mm:ss"),
-          update_time: shanghaiTime().format("YYYY-MM-DD HH:mm:ss"),
-        })
-      )
-    );
-  }
-}
-
-
-export function getFileUrl(req,elm) {
-  // 获取请求的来源域名
-  const host = req.headers["host"]; // 主机名 + 端口
-  const origin = req.headers["referer"]; // 请求的来源域(适用于跨域)
-  if (`${origin}`.indexOf("3032") > -1 || `${host}`.indexOf("3000") > -1) {
-    return "http://localhost:3000" + `/api_files_${elm.file_id}`;
-  }
-  if (`${origin}`.indexOf("zs_interval") > -1) {
-    return `api_files_${elm.file_id}`;
-  }
-  return `${origin}api_files_${elm.file_id}`;
-}

+ 0 - 35
epub_node/router/types/index.js

@@ -1,35 +0,0 @@
-// 添加账本
-import express from "express";
-
-const router = express.Router();
-import { getTypesByUserId } from "#db";
-
-// middleware that is specific to this router
-router.use(function timeLog(req, res, next) {
-  next();
-});
-// define the home page route
-router.get("/", async function (req, res) {
-  const { userInfo = {} } = req.body;
-  // getTypesByUserId
-  const { book_id = "" } = req.query;
-
-  const typesRes = await getTypesByUserId({
-    book_id,
-    author_id: userInfo.user_id,
-  });
-
-  res.json({
-    code: 200,
-    data: typesRes.map((elm) => ({
-      name: elm.name,
-      id: elm.id,
-    })),
-  });
-});
-// define the about route
-router.get("/about", function (req, res) {
-  res.send("About types");
-});
-
-export default router;

+ 191 - 3
epub_node/yarn.lock

@@ -2,6 +2,20 @@
 # yarn lockfile v1
 
 
+"@colors/colors@1.6.0", "@colors/colors@^1.6.0":
+  version "1.6.0"
+  resolved "https://registry.npmmirror.com/@colors/colors/-/colors-1.6.0.tgz#ec6cd237440700bc23ca23087f513c75508958b0"
+  integrity sha512-Ir+AOibqzrIsL6ajt3Rz3LskB7OiMVHqltZmspbW/TJuTVuyOMirVqAkjfY6JISiLHgyNqicAC8AyHHGzNd/dA==
+
+"@dabh/diagnostics@^2.0.2":
+  version "2.0.3"
+  resolved "https://registry.npmmirror.com/@dabh/diagnostics/-/diagnostics-2.0.3.tgz#7f7e97ee9a725dffc7808d93668cc984e1dc477a"
+  integrity sha512-hrlQOIi7hAfzsMqlGSFyVucrx38O+j6wiGOf//H2ecvIEqYN4ADBSS2iLMh5UFyDunCNniUIPk/q3riFv45xRA==
+  dependencies:
+    colorspace "1.1.x"
+    enabled "2.0.x"
+    kuler "^2.0.0"
+
 "@types/body-parser@*":
   version "1.19.5"
   resolved "https://registry.npmmirror.com/@types/body-parser/-/body-parser-1.19.5.tgz#04ce9a3b677dc8bd681a17da1ab9835dc9d3ede4"
@@ -110,6 +124,11 @@
     "@types/node" "*"
     "@types/send" "*"
 
+"@types/triple-beam@^1.3.2":
+  version "1.3.5"
+  resolved "https://registry.npmmirror.com/@types/triple-beam/-/triple-beam-1.3.5.tgz#74fef9ffbaa198eb8b588be029f38b00299caa2c"
+  integrity sha512-6WaYesThRMCl19iryMYP7/x2OVgCtbIVflDGFpWnb9irXI3UjYE4AzmYuiUKY1AJstGijoY+MgUszMgRxIYTYw==
+
 accepts@~1.3.8:
   version "1.3.8"
   resolved "https://registry.npmmirror.com/accepts/-/accepts-1.3.8.tgz#0bf0be125b67014adcb0b0921e62db7bffe16b2e"
@@ -144,6 +163,11 @@ array-hyper-unique@^2.1.4:
     deep-eql "= 4.0.0"
     lodash "^4.17.21"
 
+async@^3.2.3:
+  version "3.2.6"
+  resolved "https://registry.npmmirror.com/async/-/async-3.2.6.tgz#1b0728e14929d51b85b449b7f06e27c1145e38ce"
+  integrity sha512-htCUDlxyyCLMgaM3xXg0C0LW2xqfuQ6p05pCEIsXuyQ+a1koYKTuBMzRNwmybfLgvJDMd0r1LTn4+E0Ti6C2AA==
+
 aws-ssl-profiles@^1.1.1:
   version "1.1.2"
   resolved "https://registry.npmmirror.com/aws-ssl-profiles/-/aws-ssl-profiles-1.1.2.tgz#157dd77e9f19b1d123678e93f120e6f193022641"
@@ -245,6 +269,47 @@ chokidar@^3.5.2:
   optionalDependencies:
     fsevents "~2.3.2"
 
+color-convert@^1.9.3:
+  version "1.9.3"
+  resolved "https://registry.npmmirror.com/color-convert/-/color-convert-1.9.3.tgz#bb71850690e1f136567de629d2d5471deda4c1e8"
+  integrity sha512-QfAUtd+vFdAtFQcC8CCyYt1fYWxSqAiK2cSD6zDB8N3cpsEBAvRxp9zOGg6G/SHHJYAT88/az/IuDGALsNVbGg==
+  dependencies:
+    color-name "1.1.3"
+
+color-name@1.1.3:
+  version "1.1.3"
+  resolved "https://registry.npmmirror.com/color-name/-/color-name-1.1.3.tgz#a7d0558bd89c42f795dd42328f740831ca53bc25"
+  integrity sha512-72fSenhMw2HZMTVHeCA9KCmpEIbzWiQsjN+BHcBbS9vr1mtt+vJjPdksIBNUmKAW8TFUDPJK5SUU3QhE9NEXDw==
+
+color-name@^1.0.0:
+  version "1.1.4"
+  resolved "https://registry.npmmirror.com/color-name/-/color-name-1.1.4.tgz#c2a09a87acbde69543de6f63fa3995c826c536a2"
+  integrity sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==
+
+color-string@^1.6.0:
+  version "1.9.1"
+  resolved "https://registry.npmmirror.com/color-string/-/color-string-1.9.1.tgz#4467f9146f036f855b764dfb5bf8582bf342c7a4"
+  integrity sha512-shrVawQFojnZv6xM40anx4CkoDP+fZsw/ZerEMsW/pyzsRbElpsL/DBVW7q3ExxwusdNXI3lXpuhEZkzs8p5Eg==
+  dependencies:
+    color-name "^1.0.0"
+    simple-swizzle "^0.2.2"
+
+color@^3.1.3:
+  version "3.2.1"
+  resolved "https://registry.npmmirror.com/color/-/color-3.2.1.tgz#3544dc198caf4490c3ecc9a790b54fe9ff45e164"
+  integrity sha512-aBl7dZI9ENN6fUGC7mWpMTPNHmWUSNan9tuWN6ahh5ZLNk9baLJOnSMlrQkHcrfFgz2/RigjUVAjdx36VcemKA==
+  dependencies:
+    color-convert "^1.9.3"
+    color-string "^1.6.0"
+
+colorspace@1.1.x:
+  version "1.1.4"
+  resolved "https://registry.npmmirror.com/colorspace/-/colorspace-1.1.4.tgz#8d442d1186152f60453bf8070cd66eb364e59243"
+  integrity sha512-BgvKJiuVu1igBUF2kEjRCZXol6wiiGbY5ipL/oVPwm0BL9sIpMIzM8IK7vwuxIIzOXMV3Ey5w+vxhm0rR/TN8w==
+  dependencies:
+    color "^3.1.3"
+    text-hex "1.0.x"
+
 concat-map@0.0.1:
   version "0.0.1"
   resolved "https://registry.npmmirror.com/concat-map/-/concat-map-0.0.1.tgz#d8a96bd77fd68df7793a73036a3ba0d5405d477b"
@@ -359,6 +424,11 @@ ee-first@1.1.1:
   resolved "https://registry.npmmirror.com/ee-first/-/ee-first-1.1.1.tgz#590c61156b0ae2f4f0255732a158b266bc56b21d"
   integrity sha512-WMwm9LhRUo+WUaRN+vRuETqG89IgZphVSNkdFgeb6sS/E4OrDIN7t48CAewSHXc6C8lefD8KKfr5vY61brQlow==
 
+enabled@2.0.x:
+  version "2.0.0"
+  resolved "https://registry.npmmirror.com/enabled/-/enabled-2.0.0.tgz#f9dd92ec2d6f4bbc0d5d1e64e21d61cd4665e7c2"
+  integrity sha512-AKrN98kuwOzMIdAizXGI86UFBoo26CL21UM763y1h/GMSJ4/OHU9k2YlsmBpyScFo/wbLzWQJBMCW4+IO3/+OQ==
+
 encodeurl@~1.0.2:
   version "1.0.2"
   resolved "https://registry.npmmirror.com/encodeurl/-/encodeurl-1.0.2.tgz#ad3ff4c86ec2d029322f5a02c3a9a606c95b3f59"
@@ -447,6 +517,11 @@ express@^4.21.1:
     utils-merge "1.0.1"
     vary "~1.1.2"
 
+fecha@^4.2.0:
+  version "4.2.3"
+  resolved "https://registry.npmmirror.com/fecha/-/fecha-4.2.3.tgz#4d9ccdbc61e8629b259fdca67e65891448d569fd"
+  integrity sha512-OP2IUU6HeYKJi3i0z4A19kHMQoLVs4Hc+DPqqxI2h/DPZHTm/vjsfC6P0b4jCMy14XizLBqvndQ+UilD7707Jw==
+
 fill-range@^7.1.1:
   version "7.1.1"
   resolved "https://registry.npmmirror.com/fill-range/-/fill-range-7.1.1.tgz#44265d3cac07e3ea7dc247516380643754a05292"
@@ -467,6 +542,11 @@ finalhandler@1.3.1:
     statuses "2.0.1"
     unpipe "~1.0.0"
 
+fn.name@1.x.x:
+  version "1.1.0"
+  resolved "https://registry.npmmirror.com/fn.name/-/fn.name-1.1.0.tgz#26cad8017967aea8731bc42961d04a3d5988accc"
+  integrity sha512-GRnmB5gPyJpAhTQdSZTSp9uaPSvl09KoYcMQtsB9rQoOmzs9dH6ffeccH+Z+cv6P68Hu5bC6JjRh4Ah/mHSNRw==
+
 forwarded@0.2.0:
   version "0.2.0"
   resolved "https://registry.npmmirror.com/forwarded/-/forwarded-0.2.0.tgz#2269936428aad4c15c7ebe9779a84bf0b2a81811"
@@ -477,6 +557,11 @@ fresh@0.5.2:
   resolved "https://registry.npmmirror.com/fresh/-/fresh-0.5.2.tgz#3d8cadd90d976569fa835ab1f8e4b23a105605a7"
   integrity sha512-zJ2mQYM18rEFOudeV4GShTGIQ7RbzA7ozbU9I/XBpm7kqgMywgmylMwXHxZJmkVoYkna9d2pVXVXPdYTP9ej8Q==
 
+fs@^0.0.1-security:
+  version "0.0.1-security"
+  resolved "https://registry.npmmirror.com/fs/-/fs-0.0.1-security.tgz#8a7bd37186b6dddf3813f23858b57ecaaf5e41d4"
+  integrity sha512-3XY9e1pP0CVEUCdj5BmfIZxRBTSDycnbqhIOGec9QYtmVH2fbLpj86CFWkrNOkt/Fvty4KZG5lTglL9j/gJ87w==
+
 fsevents@~2.3.2:
   version "2.3.3"
   resolved "https://registry.npmmirror.com/fsevents/-/fsevents-2.3.3.tgz#cac6407785d03675a2a5e1a5305c697b347d90d6"
@@ -578,7 +663,7 @@ ignore-by-default@^1.0.1:
   resolved "https://registry.npmmirror.com/ignore-by-default/-/ignore-by-default-1.0.1.tgz#48ca6d72f6c6a3af00a9ad4ae6876be3889e2b09"
   integrity sha512-Ius2VYcGNk7T90CppJqcIkS5ooHUZyIQK+ClZfMfMNFEF9VSE73Fq+906u/CWu92x4gzZMWOwfFYckPObzdEbA==
 
-inherits@2.0.4, inherits@~2.0.3:
+inherits@2.0.4, inherits@^2.0.3, inherits@~2.0.3:
   version "2.0.4"
   resolved "https://registry.npmmirror.com/inherits/-/inherits-2.0.4.tgz#0fa2c64f932917c3433a0ded55363aae37416b7c"
   integrity sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ==
@@ -588,6 +673,11 @@ ipaddr.js@1.9.1:
   resolved "https://registry.npmmirror.com/ipaddr.js/-/ipaddr.js-1.9.1.tgz#bff38543eeb8984825079ff3a2a8e6cbd46781b3"
   integrity sha512-0KI/607xoxSToH7GjN1FfSbLoU0+btTicjsQSWQlh/hZykN8KpmMf7uYwPW3R+akZ6R/w18ZlXSHBYXiYUPO3g==
 
+is-arrayish@^0.3.1:
+  version "0.3.2"
+  resolved "https://registry.npmmirror.com/is-arrayish/-/is-arrayish-0.3.2.tgz#4574a2ae56f7ab206896fb431eaeed066fdf8f03"
+  integrity sha512-eVRqCvVlZbuw3GrM63ovNSNAeA1K16kaR/LRY/92w0zxQ5/1YzwblUX652i4Xs9RwAGjW9d9y6X88t8OaAJfWQ==
+
 is-binary-path@~2.1.0:
   version "2.1.0"
   resolved "https://registry.npmmirror.com/is-binary-path/-/is-binary-path-2.1.0.tgz#ea1f7f3b80f064236e83470f86c09c254fb45b09"
@@ -617,6 +707,11 @@ is-property@^1.0.2:
   resolved "https://registry.npmmirror.com/is-property/-/is-property-1.0.2.tgz#57fe1c4e48474edd65b09911f26b1cd4095dda84"
   integrity sha512-Ks/IoX00TtClbGQr4TWXemAnktAQvYB7HzcCxDGqEZU6oCmb2INHuOoKxbtR+HFkmYWBKv/dOZtGRiAjDhj92g==
 
+is-stream@^2.0.0:
+  version "2.0.1"
+  resolved "https://registry.npmmirror.com/is-stream/-/is-stream-2.0.1.tgz#fac1e3d53b97ad5a9d0ae9cef2389f5810a5c077"
+  integrity sha512-hFoiJiTl63nn+kstHGBtewWSKnQLpyb155KHheA1l39uvtO9nWIop1p3udqPcUd/xbF1VLMO4n7OI6p7RbngDg==
+
 isarray@~1.0.0:
   version "1.0.0"
   resolved "https://registry.npmmirror.com/isarray/-/isarray-1.0.0.tgz#bb935d48582cba168c06834957a54a3e07124f11"
@@ -655,6 +750,11 @@ jws@^3.2.2:
     jwa "^1.4.1"
     safe-buffer "^5.0.1"
 
+kuler@^2.0.0:
+  version "2.0.0"
+  resolved "https://registry.npmmirror.com/kuler/-/kuler-2.0.0.tgz#e2c570a3800388fb44407e851531c1d670b061b3"
+  integrity sha512-Xq9nH7KlWZmXAtodXDDRE7vs6DU1gTU8zYDHDiWLSip45Egwq3plLHzPn27NgvzL2r1LMPC1vdqh98sQxtqj4A==
+
 lodash.includes@^4.3.0:
   version "4.3.0"
   resolved "https://registry.npmmirror.com/lodash.includes/-/lodash.includes-4.3.0.tgz#60bb98a87cb923c68ca1e51325483314849f553f"
@@ -695,6 +795,18 @@ lodash@^4.17.21:
   resolved "https://registry.npmmirror.com/lodash/-/lodash-4.17.21.tgz#679591c564c3bffaae8454cf0b3df370c3d6911c"
   integrity sha512-v2kDEe57lecTulaDIuNTPy3Ry4gLGJ6Z1O3vE1krgXZNrsQ+LFTGHVxVjcXPs17LhbZVGedAJv8XZ1tvj5FvSg==
 
+logform@^2.7.0:
+  version "2.7.0"
+  resolved "https://registry.npmmirror.com/logform/-/logform-2.7.0.tgz#cfca97528ef290f2e125a08396805002b2d060d1"
+  integrity sha512-TFYA4jnP7PVbmlBIfhlSe+WKxs9dklXMTEGcBCIvLhE/Tn3H6Gk1norupVW7m5Cnd4bLcr08AytbyV/xj7f/kQ==
+  dependencies:
+    "@colors/colors" "1.6.0"
+    "@types/triple-beam" "^1.3.2"
+    fecha "^4.2.0"
+    ms "^2.1.1"
+    safe-stable-stringify "^2.3.1"
+    triple-beam "^1.3.0"
+
 long@^5.2.1:
   version "5.2.3"
   resolved "https://registry.npmmirror.com/long/-/long-5.2.3.tgz#a3ba97f3877cf1d778eccbcb048525ebb77499e1"
@@ -834,6 +946,13 @@ on-finished@2.4.1:
   dependencies:
     ee-first "1.1.1"
 
+one-time@^1.0.0:
+  version "1.0.0"
+  resolved "https://registry.npmmirror.com/one-time/-/one-time-1.0.0.tgz#e06bc174aed214ed58edede573b433bbf827cb45"
+  integrity sha512-5DXOiRKwuSEcQ/l0kGCF6Q3jcADFv5tSmRaJck/OqkVFcOzutB134KRSfF0xDrL39MNnqxbHBbUUcjZIhTgb2g==
+  dependencies:
+    fn.name "1.x.x"
+
 parseurl@~1.3.3:
   version "1.3.3"
   resolved "https://registry.npmmirror.com/parseurl/-/parseurl-1.3.3.tgz#9da19e7bee8d12dff0513ed5b76957793bc2e8d4"
@@ -902,6 +1021,15 @@ readable-stream@2.3.7:
     string_decoder "~1.1.1"
     util-deprecate "~1.0.1"
 
+readable-stream@^3.4.0, readable-stream@^3.6.2:
+  version "3.6.2"
+  resolved "https://registry.npmmirror.com/readable-stream/-/readable-stream-3.6.2.tgz#56a9b36ea965c00c5a93ef31eb111a0f11056967"
+  integrity sha512-9u/sniCrY3D5WdsERHzHE4G2YCXqoG5FTHUiCC4SIbr6XcLZBY05ya9EKjYek9O5xOAwjGq+1JdGBAS7Q9ScoA==
+  dependencies:
+    inherits "^2.0.3"
+    string_decoder "^1.1.1"
+    util-deprecate "^1.0.1"
+
 readdirp@~3.6.0:
   version "3.6.0"
   resolved "https://registry.npmmirror.com/readdirp/-/readdirp-3.6.0.tgz#74a370bd857116e245b29cc97340cd431a02a6c7"
@@ -914,11 +1042,16 @@ safe-buffer@5.1.2, safe-buffer@~5.1.0, safe-buffer@~5.1.1:
   resolved "https://registry.npmmirror.com/safe-buffer/-/safe-buffer-5.1.2.tgz#991ec69d296e0313747d59bdfd2b745c35f8828d"
   integrity sha512-Gd2UZBJDkXlY7GbJxfsE8/nvKkUEU1G38c1siN6QP6a9PT9MmHB8GnpscSmMJSoF8LOIrt8ud/wPtojys4G6+g==
 
-safe-buffer@5.2.1, safe-buffer@^5.0.1:
+safe-buffer@5.2.1, safe-buffer@^5.0.1, safe-buffer@~5.2.0:
   version "5.2.1"
   resolved "https://registry.npmmirror.com/safe-buffer/-/safe-buffer-5.2.1.tgz#1eaf9fa9bdb1fdd4ec75f58f9cdb4e6b7827eec6"
   integrity sha512-rp3So07KcdmmKbGvgaNxQSJr7bGVSVk5S9Eq1F+ppbRo70+YeaDxkw5Dd8NPN+GD6bjnYm2VuPuCXmpuYvmCXQ==
 
+safe-stable-stringify@^2.3.1:
+  version "2.5.0"
+  resolved "https://registry.npmmirror.com/safe-stable-stringify/-/safe-stable-stringify-2.5.0.tgz#4ca2f8e385f2831c432a719b108a3bf7af42a1dd"
+  integrity sha512-b3rppTKm9T+PsVCBEOUR46GWI7fdOs00VKZ1+9c1EWDaDMvjQc6tUwuFyIprgGgTcWoVHSKrU8H31ZHA2e0RHA==
+
 "safer-buffer@>= 2.1.2 < 3", "safer-buffer@>= 2.1.2 < 3.0.0":
   version "2.1.2"
   resolved "https://registry.npmmirror.com/safer-buffer/-/safer-buffer-2.1.2.tgz#44fa161b0187b9549dd84bb91802f9bd8385cd6a"
@@ -995,6 +1128,13 @@ side-channel@^1.0.6:
     get-intrinsic "^1.2.4"
     object-inspect "^1.13.1"
 
+simple-swizzle@^0.2.2:
+  version "0.2.2"
+  resolved "https://registry.npmmirror.com/simple-swizzle/-/simple-swizzle-0.2.2.tgz#a4da6b635ffcccca33f70d17cb92592de95e557a"
+  integrity sha512-JA//kQgZtbuY83m+xT+tXJkmJncGMTFT+C+g2h2R9uxkYIrE2yy9sgmcLhCnw57/WSD+Eh3J97FPEDFnbXnDUg==
+  dependencies:
+    is-arrayish "^0.3.1"
+
 simple-update-notifier@^2.0.0:
   version "2.0.0"
   resolved "https://registry.npmmirror.com/simple-update-notifier/-/simple-update-notifier-2.0.0.tgz#d70b92bdab7d6d90dfd73931195a30b6e3d7cebb"
@@ -1017,6 +1157,11 @@ sqlstring@^2.3.2:
   resolved "https://registry.npmmirror.com/sqlstring/-/sqlstring-2.3.3.tgz#2ddc21f03bce2c387ed60680e739922c65751d0c"
   integrity sha512-qC9iz2FlN7DQl3+wjwn3802RTyjCx7sDvfQEXchwa6CWOx07/WVfh91gBmQ9fahw8snwGEWU3xGzOt4tFyHLxg==
 
+stack-trace@0.0.x:
+  version "0.0.10"
+  resolved "https://registry.npmmirror.com/stack-trace/-/stack-trace-0.0.10.tgz#547c70b347e8d32b4e108ea1a2a159e5fdde19c0"
+  integrity sha512-KGzahc7puUKkzyMt+IqAep+TVNbKP+k2Lmwhub39m1AsTSkaDutx56aDCo+HLDzf/D26BIHTJWNiTG1KAJiQCg==
+
 statuses@2.0.1:
   version "2.0.1"
   resolved "https://registry.npmmirror.com/statuses/-/statuses-2.0.1.tgz#55cb000ccf1d48728bd23c685a063998cf1a1b63"
@@ -1027,6 +1172,13 @@ streamsearch@^1.1.0:
   resolved "https://registry.npmmirror.com/streamsearch/-/streamsearch-1.1.0.tgz#404dd1e2247ca94af554e841a8ef0eaa238da764"
   integrity sha512-Mcc5wHehp9aXz1ax6bZUyY5afg9u2rv5cqQI3mRrYkGC8rW2hM02jWuwjtL++LS5qinSyhj2QfLyNsuc+VsExg==
 
+string_decoder@^1.1.1:
+  version "1.3.0"
+  resolved "https://registry.npmmirror.com/string_decoder/-/string_decoder-1.3.0.tgz#42f114594a46cf1a8e30b0a84f56c78c3edac21e"
+  integrity sha512-hkRX8U1WjJFd8LsDJ2yQ/wWWxaopEsABU1XfkM8A+j0+85JAGppt16cr1Whg6KIbb4okU6Mql6BOj+uup/wKeA==
+  dependencies:
+    safe-buffer "~5.2.0"
+
 string_decoder@~1.1.1:
   version "1.1.1"
   resolved "https://registry.npmmirror.com/string_decoder/-/string_decoder-1.1.1.tgz#9cf1611ba62685d7030ae9e4ba34149c3af03fc8"
@@ -1041,6 +1193,11 @@ supports-color@^5.5.0:
   dependencies:
     has-flag "^3.0.0"
 
+text-hex@1.0.x:
+  version "1.0.0"
+  resolved "https://registry.npmmirror.com/text-hex/-/text-hex-1.0.0.tgz#69dc9c1b17446ee79a92bf5b884bb4b9127506f5"
+  integrity sha512-uuVGNWzgJ4yhRaNSiubPY7OjISw4sw4E5Uv0wbjp+OzcbmVU/rsT8ujgcXJhn9ypzsgr5vlzpPqP+MBBKcGvbg==
+
 to-regex-range@^5.0.1:
   version "5.0.1"
   resolved "https://registry.npmmirror.com/to-regex-range/-/to-regex-range-5.0.1.tgz#1648c44aae7c8d988a326018ed72f5b4dd0392e4"
@@ -1058,6 +1215,11 @@ touch@^3.1.0:
   resolved "https://registry.npmmirror.com/touch/-/touch-3.1.1.tgz#097a23d7b161476435e5c1344a95c0f75b4a5694"
   integrity sha512-r0eojU4bI8MnHr8c5bNo7lJDdI2qXlWWJk6a9EAFG7vbhTjElYhBVS3/miuE0uOuoLdb8Mc/rVfsmm6eo5o9GA==
 
+triple-beam@^1.3.0:
+  version "1.4.1"
+  resolved "https://registry.npmmirror.com/triple-beam/-/triple-beam-1.4.1.tgz#6fde70271dc6e5d73ca0c3b24e2d92afb7441984"
+  integrity sha512-aZbgViZrg1QNcG+LULa7nhZpJTZSLm/mXnHXnbAbjmN5aSa0y7V+wvv6+4WaBtpISJzThKy+PIPxc1Nq1EJ9mg==
+
 ts-type@>=2:
   version "3.0.1"
   resolved "https://registry.npmmirror.com/ts-type/-/ts-type-3.0.1.tgz#b52e7623065e0beb43c77c426347d85cf81dff84"
@@ -1105,7 +1267,7 @@ unpipe@1.0.0, unpipe@~1.0.0:
   resolved "https://registry.npmmirror.com/unpipe/-/unpipe-1.0.0.tgz#b2bf4ee8514aae6165b4817829d21b2ef49904ec"
   integrity sha512-pjy2bYhSsufwWlKwPc+l3cN7+wuJlK6uz0YdJEOlQDbl6jo/YlPi4mb8agUkVC8BF7V8NuzeyPNqRksA3hztKQ==
 
-util-deprecate@~1.0.1:
+util-deprecate@^1.0.1, util-deprecate@~1.0.1:
   version "1.0.2"
   resolved "https://registry.npmmirror.com/util-deprecate/-/util-deprecate-1.0.2.tgz#450d4dc9fa70de732762fbd2d4a28981419a0ccf"
   integrity sha512-EPD5q1uXyFxJpCrLnCc1nHnq3gOa6DZBocAIiI2TaSCA7VCJ1UJDMagCzIkXNsUYfD1daK//LTEQ8xiIbrHtcw==
@@ -1125,6 +1287,32 @@ vary@^1, vary@~1.1.2:
   resolved "https://registry.npmmirror.com/vary/-/vary-1.1.2.tgz#2299f02c6ded30d4a5961b0b9f74524a18f634fc"
   integrity sha512-BNGbWLfd0eUPabhkXUVm0j8uuvREyTh5ovRa/dyow/BqAbZJyC+5fU+IzQOzmAKzYqYRAISoRhdQr3eIZ/PXqg==
 
+winston-transport@^4.9.0:
+  version "4.9.0"
+  resolved "https://registry.npmmirror.com/winston-transport/-/winston-transport-4.9.0.tgz#3bba345de10297654ea6f33519424560003b3bf9"
+  integrity sha512-8drMJ4rkgaPo1Me4zD/3WLfI/zPdA9o2IipKODunnGDcuqbHwjsbB79ylv04LCGGzU0xQ6vTznOMpQGaLhhm6A==
+  dependencies:
+    logform "^2.7.0"
+    readable-stream "^3.6.2"
+    triple-beam "^1.3.0"
+
+winston@^3.17.0:
+  version "3.17.0"
+  resolved "https://registry.npmmirror.com/winston/-/winston-3.17.0.tgz#74b8665ce9b4ea7b29d0922cfccf852a08a11423"
+  integrity sha512-DLiFIXYC5fMPxaRg832S6F5mJYvePtmO5G9v9IgUFPhXm9/GkXarH/TUrBAVzhTCzAj9anE/+GjrgXp/54nOgw==
+  dependencies:
+    "@colors/colors" "^1.6.0"
+    "@dabh/diagnostics" "^2.0.2"
+    async "^3.2.3"
+    is-stream "^2.0.0"
+    logform "^2.7.0"
+    one-time "^1.0.0"
+    readable-stream "^3.4.0"
+    safe-stable-stringify "^2.3.1"
+    stack-trace "0.0.x"
+    triple-beam "^1.3.0"
+    winston-transport "^4.9.0"
+
 xml2js@^0.6.2:
   version "0.6.2"
   resolved "https://registry.npmmirror.com/xml2js/-/xml2js-0.6.2.tgz#dd0b630083aa09c161e25a4d0901e2b2a929b499"