|
@@ -21,14 +21,14 @@ class ContentService extends Service {
|
|
|
throw new Error({ errcode: -2001, errmsg: '添加失败' });
|
|
|
}
|
|
|
}
|
|
|
- async update({ title, thumbnail, annex, content, istop, columns, _id, year, datte, annexname }) {
|
|
|
+ async update({ title, thumbnail, annex, content, istop, columns, _id, year, date, annexname }) {
|
|
|
assert(_id, 'id不存在');
|
|
|
const { Content: model } = this.ctx.model;
|
|
|
let text = content.replace(new RegExp('</?[^>]+>', 'gm'), '');
|
|
|
text = text.replace('\\s*|\t|\r|\n', '');
|
|
|
const slug = text.substring(0, 200);
|
|
|
try {
|
|
|
- await model.findById(_id).update({ title, slug, thumbnail, annex, content, istop, columns, year, datte, annexname });
|
|
|
+ await model.findById(_id).update({ title, slug, thumbnail, annex, content, istop, columns, year, date, annexname });
|
|
|
return { errmsg: '', errcode: 0 };
|
|
|
} catch (error) {
|
|
|
throw new Error({ errcode: -2001, errmsg: '修改失败' });
|
|
@@ -62,7 +62,7 @@ class ContentService extends Service {
|
|
|
async query({ skip, limit, title, columns }) {
|
|
|
const { Content: model } = this.ctx.model;
|
|
|
const filter = {};
|
|
|
- if (title) filter.title = { $regex: title };
|
|
|
+ if (title) filter.title = title;
|
|
|
if (columns) filter.columns = columns;
|
|
|
let total = 0;
|
|
|
try {
|