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