asd123a20 преди 2 години
родител
ревизия
044c1b7c3a
променени са 2 файла, в които са добавени 6 реда и са изтрити 4 реда
  1. 2 0
      service-cms/app/model/content.js
  2. 4 4
      service-cms/app/service/content.js

+ 2 - 0
service-cms/app/model/content.js

@@ -33,6 +33,8 @@ const SchemaDefine = {
   status: { type: String, required: false },
   // 关键词
   keywords: { type: Array, required: false, default: [] },
+  // 副标题
+  curtTitle: { type: String, required: true },
 };
 const schema = new Schema(SchemaDefine);
 module.exports = app => {

+ 4 - 4
service-cms/app/service/content.js

@@ -9,7 +9,7 @@ class ContentService extends Service {
     this.model = this.ctx.model.Content;
     this.menuModel = this.ctx.model.Menu;
   }
-  async create({ title, describe, content, bind, istop, date, thumbnail, recommend, annex, keywords, svip, isShow, status }) {
+  async create({ title, describe, content, bind, istop, date, thumbnail, recommend, annex, keywords, svip, isShow, status, curtTitle }) {
     assert(title, '标题不存在');
     assert(describe, '描述不存在');
     assert(content, '内容不存在');
@@ -17,19 +17,19 @@ class ContentService extends Service {
     try {
       const createAt = moment().format('x');
       const updateAt = moment().format('x');
-      const item = await this.model.create({ title, describe, content, bind, istop, date, thumbnail, recommend, annex, createAt, updateAt, keywords, svip, isShow, status });
+      const item = await this.model.create({ title, describe, content, bind, istop, date, thumbnail, recommend, annex, createAt, updateAt, keywords, svip, isShow, status, curtTitle });
       return { errcode: 0, errmsg: '', data: item };
     } catch (error) {
       throw error;
     }
   }
-  async update({ id, title, describe, content, bind, istop, date, thumbnail, recommend, annex, keywords, svip, isShow, status }) {
+  async update({ id, title, describe, content, bind, istop, date, thumbnail, recommend, annex, keywords, svip, isShow, status, curtTitle }) {
     assert(id, 'id不存在');
     try {
       const res = await this.model.findOne({ _id: id });
       if (!res) return { errcode: -1001, errmsg: '数据不存在', data: '' };
       const updateAt = moment().format('x');
-      await this.model.updateOne({ _id: id }, { title, describe, content, bind, istop, date, thumbnail, recommend, annex, updateAt, keywords, svip, isShow, status });
+      await this.model.updateOne({ _id: id }, { title, describe, content, bind, istop, date, thumbnail, recommend, annex, updateAt, keywords, svip, isShow, status, curtTitle });
       return { errcode: 0, errmsg: '', data: 'update' };
     } catch (error) {
       throw error;