ruifeng_liu 3 anos atrás
pai
commit
3c19fba9f4

+ 2 - 1
app/router/patent/patentassess.js

@@ -8,7 +8,8 @@ module.exports = app => {
   const index = 'patent';
   const target = 'patentassess';
   const metaTime = app.middleware.createTime();
+  const record = app.middleware.patentapplyRecord(`${index}.${target}`);
   router.resources(target, `${profix}${vision}/${index}/${target}`, metaTime, controller[index][target]); // index、create、show、destroy
   router.post(target, `${profix}${vision}/${index}/${target}/check`, controller[index][target].check);
-  router.post(target, `${profix}${vision}/${index}/${target}/update/:id`, controller[index][target].update);
+  router.post(target, `${profix}${vision}/${index}/${target}/update/:id`, record, controller[index][target].update);
 };

+ 5 - 7
app/service/patent/patentassess.js

@@ -92,19 +92,17 @@ class PatentassessService extends CrudService {
         to = user_id;
         break;
       case '1':
-        arr.push({
-          content: `您的提交的专利评估【${patent_name}】通过了管理员的审核`,
-          to: user_id,
-        });
+        content = `您的提交的专利评估【${patent_name}】通过了管理员的审核`;
+        to = user_id;
         break;
       default:
         break;
     }
-    if (code !== '2') {
+    if (arr.length > 0) {
+      await this.notice.insertMany(arr);
+    } else {
       const obj = { to, content };
       await this.notice.create(obj);
-    } else {
-      await this.notice.insertMany(arr);
     }
   }
 }