|
@@ -7,21 +7,22 @@ class CatalogueService extends Service {
|
|
|
super(ctx);
|
|
|
this.model = this.ctx.model.Catalogue;
|
|
|
}
|
|
|
- async create({ content, name, describe, status, url, date, column }) {
|
|
|
+ async create({ content, name, describe, status, url, date, column, bind }) {
|
|
|
assert(name, '名称不存在');
|
|
|
assert(date, '发布时间不存在');
|
|
|
assert(status, '状态不存在');
|
|
|
+ assert(bind, '绑定ID不存在');
|
|
|
try {
|
|
|
- const res = await this.model.create({ content, name, describe, status, url, date, column });
|
|
|
+ const res = await this.model.create({ content, name, describe, status, url, date, column, bind });
|
|
|
return { errcode: 0, errmsg: 'ok', data: res };
|
|
|
} catch (error) {
|
|
|
throw error;
|
|
|
}
|
|
|
}
|
|
|
- async update({ id, content, name, describe, status, url, date, column }) {
|
|
|
+ async update({ id, content, name, describe, status, url, date, column, bind }) {
|
|
|
assert(id, 'id不存在');
|
|
|
try {
|
|
|
- await this.model.updateOne({ _id: id }, { content, name, describe, status, url, date, column });
|
|
|
+ await this.model.updateOne({ _id: id }, { content, name, describe, status, url, date, column, bind });
|
|
|
return { errcode: 0, errmsg: 'ok', data: '' };
|
|
|
} catch (error) {
|
|
|
throw error;
|
|
@@ -36,9 +37,9 @@ class CatalogueService extends Service {
|
|
|
throw error;
|
|
|
}
|
|
|
}
|
|
|
- async query({ skip, limit, name, status, date, column }) {
|
|
|
+ async query({ skip, limit, name, status, date, column, bind }) {
|
|
|
const filter = {};
|
|
|
- const arr = { name, status, date, column };
|
|
|
+ const arr = { name, status, date, column, bind };
|
|
|
for (const e in arr) {
|
|
|
const data = `{ "${e}": { "$regex": "${arr[e]}" } }`;
|
|
|
if (arr[e]) {
|