lrf402788946 4 лет назад
Родитель
Сommit
a9d942f3de
3 измененных файлов с 15 добавлено и 0 удалено
  1. 9 0
      app/controller/.remark.js
  2. 1 0
      app/router.js
  3. 5 0
      app/service/remark.js

+ 9 - 0
app/controller/.remark.js

@@ -37,4 +37,13 @@ module.exports = {
       count: true,
       count: true,
     },
     },
   },
   },
+  get: {
+    parameters: {
+      query: {
+        remarkid: "remarkid",
+        benoteid: "benoteid",
+      },
+    },
+    service: 'getRemark'
+  },
 };
 };

+ 1 - 0
app/router.js

@@ -82,6 +82,7 @@ module.exports = app => {
   router.resources('article', '/api/visit/article', controller.article); // index、create、show、destroy
   router.resources('article', '/api/visit/article', controller.article); // index、create、show、destroy
   router.post('/api/visit/article/update/:id', controller.article.update);
   router.post('/api/visit/article/update/:id', controller.article.update);
   // 备注
   // 备注
+  router.get('/api/visit/remark/user', controller.remark.get);
   router.resources('remark', '/api/visit/remark', controller.remark); // index、create、show、destroy
   router.resources('remark', '/api/visit/remark', controller.remark); // index、create、show、destroy
   router.post('/api/visit/remark/update/:id', controller.remark.update);
   router.post('/api/visit/remark/update/:id', controller.remark.update);
 };
 };

+ 5 - 0
app/service/remark.js

@@ -10,6 +10,11 @@ class RemarkService extends CrudService {
     super(ctx, 'remark');
     super(ctx, 'remark');
     this.model = this.ctx.model.Remark;
     this.model = this.ctx.model.Remark;
   }
   }
+
+  async getRemark(query) {
+    const res = await this.model.findOne(query);
+    return res;
+  }
 }
 }
 
 
 module.exports = RemarkService;
 module.exports = RemarkService;