|
@@ -7,23 +7,24 @@ class MarketService extends Service {
|
|
|
super(ctx);
|
|
|
this.model = this.ctx.model.Market;
|
|
|
}
|
|
|
- async create({ name, type, bindId, status, money, integral }) {
|
|
|
+ async create({ name, type, bindId, status, money, integral, thumbnail }) {
|
|
|
assert(name, '商品名称不存在');
|
|
|
assert(type, '商品类型不存在');
|
|
|
assert(bindId, '货品ID不存在');
|
|
|
assert(status, '商品状态不存在');
|
|
|
assert(money, '价格不存在');
|
|
|
+ assert(thumbnail, '图片不存在');
|
|
|
try {
|
|
|
- const res = await this.model.create({ name, type, bindId, status, money, integral });
|
|
|
+ const res = await this.model.create({ name, type, bindId, status, money, integral, thumbnail });
|
|
|
return { errcode: 0, errmsg: 'ok', data: res };
|
|
|
} catch (error) {
|
|
|
throw error;
|
|
|
}
|
|
|
}
|
|
|
- async update({ id, name, type, bindId, status, money, integral }) {
|
|
|
+ async update({ id, name, type, bindId, status, money, integral, thumbnail }) {
|
|
|
assert(id, 'id不存在');
|
|
|
try {
|
|
|
- await this.model.updateOne({ _id: id }, { name, type, bindId, status, money, integral });
|
|
|
+ await this.model.updateOne({ _id: id }, { name, type, bindId, status, money, integral, thumbnail });
|
|
|
return { errcode: 0, errmsg: 'ok', data: '' };
|
|
|
} catch (error) {
|
|
|
throw error;
|