|
@@ -12,7 +12,7 @@ class ColumnService extends CrudService {
|
|
this.model = this.ctx.model.Column;
|
|
this.model = this.ctx.model.Column;
|
|
}
|
|
}
|
|
|
|
|
|
- async create({ site }, { title, type, parent_id, parent, is_use, news_type }) {
|
|
|
|
|
|
+ async create({ site }, { title, type, parent_id, parent, is_use, news_type, url, content_id, parent_type}) {
|
|
// 检查数据
|
|
// 检查数据
|
|
assert(_.isString(site), 'site不能为空');
|
|
assert(_.isString(site), 'site不能为空');
|
|
assert(!title || _.isString(title), 'title必须为字符串');
|
|
assert(!title || _.isString(title), 'title必须为字符串');
|
|
@@ -21,13 +21,16 @@ class ColumnService extends CrudService {
|
|
assert(!parent || _.isString(parent), 'parent必须为字符串');
|
|
assert(!parent || _.isString(parent), 'parent必须为字符串');
|
|
assert(!is_use || _.isString(is_use), 'is_use必须为字符串');
|
|
assert(!is_use || _.isString(is_use), 'is_use必须为字符串');
|
|
assert(!news_type || _.isString(news_type), 'news_type必须为字符串');
|
|
assert(!news_type || _.isString(news_type), 'news_type必须为字符串');
|
|
|
|
+ assert(!url || _.isString(url), 'url必须为字符串');
|
|
|
|
+ assert(!content_id || _.isString(content_id), 'content_id必须为字符串');
|
|
|
|
+ assert(!parent_type || _.isString(parent_type), 'parent_type必须为字符串');
|
|
// TODO: 检查用户信息
|
|
// TODO: 检查用户信息
|
|
const userid = this.ctx.userid;
|
|
const userid = this.ctx.userid;
|
|
if (!_.isString(userid)) throw new BusinessError(ErrorCode.NOT_LOGIN);
|
|
if (!_.isString(userid)) throw new BusinessError(ErrorCode.NOT_LOGIN);
|
|
|
|
|
|
// TODO:保存数据
|
|
// TODO:保存数据
|
|
const data = {
|
|
const data = {
|
|
- site, title, type, parent_id, parent, is_use, news_type,
|
|
|
|
|
|
+ site, title, type, parent_id, parent, is_use, news_type, url, content_id, parent_type,
|
|
meta: { createdBy: userid },
|
|
meta: { createdBy: userid },
|
|
};
|
|
};
|
|
|
|
|
|
@@ -37,7 +40,7 @@ class ColumnService extends CrudService {
|
|
|
|
|
|
async update({ id }, payload) {
|
|
async update({ id }, payload) {
|
|
// 检查数据
|
|
// 检查数据
|
|
- const { title, type, parent_id, parent, is_use, news_type } = payload;
|
|
|
|
|
|
+ const { title, type, parent_id, parent, is_use, news_type, url, content_id, parent_type} = payload;
|
|
assert(id, 'id不能为空');
|
|
assert(id, 'id不能为空');
|
|
assert(!title || _.isString(title), 'title必须为字符串');
|
|
assert(!title || _.isString(title), 'title必须为字符串');
|
|
assert(!type || _.isString(type), 'type必须为字符串');
|
|
assert(!type || _.isString(type), 'type必须为字符串');
|
|
@@ -45,6 +48,9 @@ class ColumnService extends CrudService {
|
|
assert(!parent || _.isString(parent), 'parent必须为字符串');
|
|
assert(!parent || _.isString(parent), 'parent必须为字符串');
|
|
assert(!is_use || _.isString(is_use), 'is_use必须为字符串');
|
|
assert(!is_use || _.isString(is_use), 'is_use必须为字符串');
|
|
assert(!news_type || _.isString(news_type), 'news_type必须为字符串');
|
|
assert(!news_type || _.isString(news_type), 'news_type必须为字符串');
|
|
|
|
+ assert(!url || _.isString(url), 'url必须为字符串');
|
|
|
|
+ assert(!content_id || _.isString(content_id), 'content_id必须为字符串');
|
|
|
|
+ assert(!parent_type || _.isString(parent_type), 'parent_type必须为字符串');
|
|
// TODO: 检查用户信息
|
|
// TODO: 检查用户信息
|
|
const userid = this.ctx.userid;
|
|
const userid = this.ctx.userid;
|
|
if (!_.isString(userid)) throw new BusinessError(ErrorCode.NOT_LOGIN);
|
|
if (!_.isString(userid)) throw new BusinessError(ErrorCode.NOT_LOGIN);
|