ruifeng_liu 3 年 前
コミット
c9e6871459
1 ファイル変更9 行追加10 行削除
  1. 9 10
      app/service/patent/patentapply.js

+ 9 - 10
app/service/patent/patentapply.js

@@ -26,7 +26,6 @@ class PatentapplyService extends CrudService {
    */
   async check({ id, status, remark }) {
     const data = { status };
-    if (status === '4') data['meta.state'] = 1;
     await this.model.updateOne({ _id: ObjectId(id) }, data);
     // 换成对应的状态码,record在下面
     return await this.record({ id, method: status, remark });
@@ -85,7 +84,7 @@ class PatentapplyService extends CrudService {
         content = `${apply_name}提交了专利申请书【${name}】的申报,请及时前往申请管理进行处理`;
         if (status === '0') {
           to = mechanism_id;
-        } else {
+        } else if (status === '1') {
           to = admin_id;
         }
         break;
@@ -93,7 +92,7 @@ class PatentapplyService extends CrudService {
         content = `${apply_name}重新提交了专利申请书【${name}】的申报,请及时前往申请管理进行处理`;
         if (status === '0') {
           to = mechanism_id;
-        } else {
+        } else if (status === '1') {
           to = admin_id;
         }
         break;
@@ -101,10 +100,6 @@ class PatentapplyService extends CrudService {
         content = `您的专利申请书【${name}】未通过机构的审核,请您及时修改,重新申请`;
         to = user_id;
         break;
-      case '-2':
-        content = `您的专利申请书【${name}】未通过管理员的审核,请您及时修改,重新申请`;
-        to = user_id;
-        break;
       case '1':
         arr.push({
           content: `您的专利申请书【${name}】已通过机构的审核,请您耐心等待管理员审核`,
@@ -115,6 +110,10 @@ class PatentapplyService extends CrudService {
           to: admin_id,
         });
         break;
+      case '-2':
+        content = `您的专利申请书【${name}】未通过管理员的审核,请您及时修改,重新申请`;
+        to = user_id;
+        break;
       case '2':
         content = `您的专利申请书【${name}】已通过管理员的审核,请及时查看审核结果`;
         to = user_id;
@@ -122,11 +121,11 @@ class PatentapplyService extends CrudService {
       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);
     }
   }
 }