reloaded hace 5 años
padre
commit
8e139a0574
Se han modificado 5 ficheros con 14 adiciones y 20 borrados
  1. 1 1
      app/controller/.column.js
  2. 8 11
      app/controller/.news.js
  3. 1 2
      app/model/column.js
  4. 0 2
      app/model/news.js
  5. 4 4
      app/router.js

+ 1 - 1
app/controller/.column.js

@@ -12,7 +12,7 @@ module.exports = {
   update: {
     params: ['!id'],
     requestBody: [
-      '!name',
+      'name',
       'site'
     ]
   },

+ 8 - 11
app/controller/.news.js

@@ -1,7 +1,6 @@
 module.exports = {
   create: {
     requestBody: [
-      '!column_name',
       '!column_id',
       '!title',
       '!orgin',
@@ -16,11 +15,10 @@ module.exports = {
   update: {
     params: ['!id'],
     requestBody: [
-      '!column_name',
-      '!column_id',
-      '!title',
-      '!orgin',
-      '!content',
+      'column_id',
+      'title',
+      'orgin',
+      'content',
       'picture'
     ]
   },
@@ -33,11 +31,10 @@ module.exports = {
   index: {
     parameters: {
       query: {
-        column_name : '!column_name',
-        column_id : '!column_id',
-        title : '!title',
-        orgin : '!orgin',
-        content : '!content',
+        column_id : 'column_id',
+        title : 'title',
+        orgin : 'orgin',
+        content : 'content',
         picture : 'picture'
       }
     },

+ 1 - 2
app/model/column.js

@@ -1,7 +1,6 @@
 'use strict';
 const Schema = require('mongoose').Schema;
 const metaPlugin = require('naf-framework-mongoose/lib/model/meta-plugin');
-const { Secret } = require('naf-framework-mongoose/lib/model/schema');
 
 // 栏目表
 const ColumnSchema = {
@@ -17,4 +16,4 @@ schema.plugin(metaPlugin);
 module.exports = app => {
   const { mongoose } = app;
   return mongoose.model('Column', schema, 'serve_column');
-};
+};

+ 0 - 2
app/model/news.js

@@ -1,11 +1,9 @@
 'use strict';
 const Schema = require('mongoose').Schema;
 const metaPlugin = require('naf-framework-mongoose/lib/model/meta-plugin');
-const { Secret } = require('naf-framework-mongoose/lib/model/schema');
 
 // 信息表
 const NewsSchema = {
-  column_name: { type: String, required: true, maxLength: 500 }, // 栏目名称
   column_id: { type: String, required: true, maxLength: 500 }, // 栏目id
   title: { type: String, required: true, maxLength: 500 }, // 标题
   orgin: { type: String, required: true, maxLength: 500 }, // 来源

+ 4 - 4
app/router.js

@@ -8,10 +8,10 @@ module.exports = app => {
   router.get('/', controller.home.index);
 
   // 栏目表设置路由
-  router.resources('column', '/api/column', controller.column); // index、create、show、destroy
-  router.post('column', '/api/column/update/:id', controller.column.update);
+  router.resources('column', '/api/serve/column', controller.column); // index、create、show、destroy
+  router.post('column', '/api/serve/column/update/:id', controller.column.update);
 
   // 信息表设置路由
-  router.resources('news', '/api/news', controller.news); // index、create、show、destroy
-  router.post('news', '/api/news/update/:id', controller.news.update);
+  router.resources('news', '/api/serve/news', controller.news); // index、create、show、destroy
+  router.post('news', '/api/serve/news/update/:id', controller.news.update);
 };