|
@@ -9,7 +9,7 @@ class ContentService extends Service {
|
|
|
this.model = this.ctx.model.Content;
|
|
|
this.menuModel = this.ctx.model.Menu;
|
|
|
}
|
|
|
- async create({ title, describe, source, content, bind, istop, date, thumbnail, recommend, annex, keywords, svip, isShow, status, curtTitle, author }) {
|
|
|
+ async create({ title, describe, source, content, bind, istop, date, thumbnail, recommend, annex, keywords, svip, isShow, status, curtTitle, author, twoTitle }) {
|
|
|
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, author, source, content, bind, istop, date, thumbnail, recommend, annex, createAt, updateAt, keywords, svip, isShow, status, curtTitle });
|
|
|
+ const item = await this.model.create({ title, twoTitle, describe, author, source, 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, author, source, content, bind, istop, date, thumbnail, recommend, annex, keywords, svip, isShow, status, curtTitle }) {
|
|
|
+ async update({ id, title, describe, author, source, content, bind, istop, date, thumbnail, recommend, annex, keywords, svip, isShow, status, curtTitle, twoTitle }) {
|
|
|
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, author, source, content, bind, istop, date, thumbnail, recommend, annex, updateAt, keywords, svip, isShow, status, curtTitle });
|
|
|
+ await this.model.updateOne({ _id: id }, { title, twoTitle, describe, author, source, content, bind, istop, date, thumbnail, recommend, annex, updateAt, keywords, svip, isShow, status, curtTitle });
|
|
|
return { errcode: 0, errmsg: '', data: 'update' };
|
|
|
} catch (error) {
|
|
|
throw error;
|
|
@@ -46,7 +46,7 @@ class ContentService extends Service {
|
|
|
throw error;
|
|
|
}
|
|
|
}
|
|
|
- async query({ skip, limit, title, date, bind, keywords, svip, isShow, status, istop, parentCode, recommend }) {
|
|
|
+ async query({ skip, limit, title, date, bind, keywords, svip, isShow, status, istop, parentCode, recommend, twoTitle }) {
|
|
|
if (parentCode) {
|
|
|
const menus = await this.service.menu.menuList({ code: parentCode });
|
|
|
const filter = { bind: { $in: menus } };
|
|
@@ -59,7 +59,7 @@ class ContentService extends Service {
|
|
|
}
|
|
|
|
|
|
const filter = {};
|
|
|
- const arr = { title, date, keywords, svip, isShow, status, istop };
|
|
|
+ const arr = { title, date, keywords, svip, isShow, status, istop, twoTitle };
|
|
|
for (const e in arr) {
|
|
|
let datas;
|
|
|
if (e === 'keywords') {
|