|
@@ -14,7 +14,7 @@ class PageService extends Service {
|
|
|
let text = content.replace(new RegExp('</?[^>]+>', 'gm'), '');
|
|
|
text = text.replace('\\s*|\t|\r|\n', '');
|
|
|
const slug = text.substring(0, 200);
|
|
|
- const menus = await model.find(menu);
|
|
|
+ const menus = await model.find({ menu });
|
|
|
if (menus.length > 0) return { errmsg: '不能重复绑定菜单', errcode: -2001 };
|
|
|
await model.create({ title, slug, date, annex, content, istop, menu, createAt, annexname });
|
|
|
return { errmsg: '', errcode: 0 };
|
|
@@ -29,7 +29,7 @@ class PageService extends Service {
|
|
|
let text = content.replace(new RegExp('</?[^>]+>', 'gm'), '');
|
|
|
text = text.replace('\\s*|\t|\r|\n', '');
|
|
|
const slug = text.substring(0, 200);
|
|
|
- const menus = await model.find(menu);
|
|
|
+ const menus = await model.find({ menu });
|
|
|
if (menus.length > 0 && menus[0]._id !== _id) return { errmsg: '不能重复绑定菜单', errcode: -2001 };
|
|
|
await model.findById(_id).update({ title, date, slug, annex, content, istop, menu, annexname });
|
|
|
return { errmsg: '', errcode: 0 };
|