|
@@ -12,9 +12,10 @@ class NewsService extends CrudService {
|
|
this.model = this.ctx.model.News;
|
|
this.model = this.ctx.model.News;
|
|
}
|
|
}
|
|
|
|
|
|
- async create({ column }, { title, content, picurl, top, tags, attachment, issuer }) {
|
|
|
|
|
|
+ async create({ column, site }, { title, content, picurl, top, tags, attachment, issuer }) {
|
|
// 检查数据
|
|
// 检查数据
|
|
assert(_.isString(column), 'column不能为空');
|
|
assert(_.isString(column), 'column不能为空');
|
|
|
|
+ assert(_.isString(site), 'site不能为空');
|
|
assert(_.isString(title), 'title不能为空');
|
|
assert(_.isString(title), 'title不能为空');
|
|
assert(_.isString(content), 'content不能为空');
|
|
assert(_.isString(content), 'content不能为空');
|
|
assert(!picurl || _.isString(picurl), 'picurl必须为字符串');
|
|
assert(!picurl || _.isString(picurl), 'picurl必须为字符串');
|
|
@@ -29,7 +30,7 @@ class NewsService extends CrudService {
|
|
|
|
|
|
// TODO:保存数据
|
|
// TODO:保存数据
|
|
const data = {
|
|
const data = {
|
|
- column, title, content, picurl, top, tags, attachment, issuer,
|
|
|
|
|
|
+ site,column, title, content, picurl, top, tags, attachment, issuer,
|
|
meta: { createdBy: userid },
|
|
meta: { createdBy: userid },
|
|
};
|
|
};
|
|
|
|
|
|
@@ -42,6 +43,7 @@ class NewsService extends CrudService {
|
|
const { title, content, picurl, top, tags, attachment, issuer } = payload;
|
|
const { title, content, picurl, top, tags, attachment, issuer } = payload;
|
|
assert(id, 'id不能为空');
|
|
assert(id, 'id不能为空');
|
|
assert(!title || _.isString(title), 'title必须为字符串');
|
|
assert(!title || _.isString(title), 'title必须为字符串');
|
|
|
|
+ // assert(_.isString(site), 'site不能为空');
|
|
assert(!content || _.isString(content), 'content必须为字符串');
|
|
assert(!content || _.isString(content), 'content必须为字符串');
|
|
assert(!picurl || _.isString(picurl), 'picurl必须为字符串');
|
|
assert(!picurl || _.isString(picurl), 'picurl必须为字符串');
|
|
assert(_.isUndefined(top) || _.isNumber(top), 'top必须为数字');
|
|
assert(_.isUndefined(top) || _.isNumber(top), 'top必须为数字');
|