Browse Source

账单添加失败

john 8 tháng trước cách đây
mục cha
commit
d8471189b3
1 tập tin đã thay đổi với 4 bổ sung4 xóa
  1. 4 4
      node_expores/router/record/index.js

+ 4 - 4
node_expores/router/record/index.js

@@ -24,8 +24,8 @@ router.use(function timeLog(req, res, next) {
 });
 
 async function getTypeInfo({ userInfo, book_id, type }) {
-  if(!type) {
-    return ''
+  if (!type) {
+    return "";
   }
   // type 是否存在重复项,有就返回id,没有就新增 再返回id
   const isAddType = await isType({
@@ -64,10 +64,10 @@ router.post("/", async function (req, res) {
     files = [],
     userInfo = {},
   } = req.body;
-
+  const type_id = await getTypeInfo({ userInfo, book_id, type });
   const insertId = await record_insert({
     book_id,
-    type_id: getTypeInfo({ userInfo, book_id, type }),
+    type_id: type_id,
     author_id: userInfo.user_id,
     total_fee,
     remark,