|
@@ -10,6 +10,13 @@ class GoodsJoinActService extends CrudService {
|
|
|
super(ctx, 'goodsjoinact');
|
|
|
this.model = this.ctx.model.Shop.GoodsJoinAct;
|
|
|
}
|
|
|
+ async beforeCreate(data) {
|
|
|
+ const { goods, shop, platformAct } = data;
|
|
|
+ const num = await this.model.count({ goods, shop, platformAct });
|
|
|
+ if (num > 0) throw new BusinessError(ErrorCode.DATA_EXISTED, '该商品已添加进当前活动中');
|
|
|
+ return data;
|
|
|
+ }
|
|
|
+
|
|
|
async query(filter, { skip = 0, limit, sort, desc, projection } = {}) {
|
|
|
// 处理排序
|
|
|
if (sort && _.isString(sort)) {
|