Bläddra i källkod

Merge branch 'master' of http://git.cc-lotus.info/service-platform/service-record

liuyu 5 år sedan
förälder
incheckning
6abe461348
5 ändrade filer med 21 tillägg och 23 borttagningar
  1. 6 3
      app/controller/.column.js
  2. 8 11
      app/controller/.news.js
  3. 2 2
      app/model/column.js
  4. 1 3
      app/model/news.js
  5. 4 4
      app/router.js

+ 6 - 3
app/controller/.column.js

@@ -1,7 +1,8 @@
 module.exports = {
   create: {
     requestBody: [
-      '!name'
+      '!name',
+      'site'
     ]
   },
   destroy: {
@@ -11,7 +12,8 @@ module.exports = {
   update: {
     params: ['!id'],
     requestBody: [
-      '!name'
+      'name',
+      'site'
     ]
   },
   show: {
@@ -23,7 +25,8 @@ module.exports = {
   index: {
     parameters: {
       query: {
-        name: 'name'
+        name: 'name',
+        site:'site'
       }
     },
     service: 'query',

+ 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'
       }
     },

+ 2 - 2
app/model/column.js

@@ -1,11 +1,11 @@
 '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 = {
   name: { type: String, required: true, maxLength: 500 }, // 栏目名称
+  site: { type: String, required: false, maxLength: 500 }, // 栏目位置
 };
 
 
@@ -16,4 +16,4 @@ schema.plugin(metaPlugin);
 module.exports = app => {
   const { mongoose } = app;
   return mongoose.model('Column', schema, 'record_column');
-};
+};

+ 1 - 3
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 }, // 来源
@@ -21,4 +19,4 @@ schema.plugin(metaPlugin);
 module.exports = app => {
   const { mongoose } = app;
   return mongoose.model('News', schema, 'record_news');
-};
+};

+ 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/record/column', controller.column); // index、create、show、destroy
+  router.post('column', '/api/record/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/record/news', controller.news); // index、create、show、destroy
+  router.post('news', '/api/record/news/update/:id', controller.news.update);
 };