|
@@ -4,12 +4,20 @@ const { BusinessError, ErrorCode } = require('naf-core').Error;
|
|
|
const _ = require('lodash');
|
|
|
const assert = require('assert');
|
|
|
|
|
|
-//
|
|
|
+//
|
|
|
class GoodsService extends CrudService {
|
|
|
constructor(ctx) {
|
|
|
super(ctx, 'goods');
|
|
|
this.model = this.ctx.model.Shop.Goods;
|
|
|
}
|
|
|
+ // 标签查询
|
|
|
+ async beforeQuery(filter) {
|
|
|
+ const { tags } = filter;
|
|
|
+ if (tags) {
|
|
|
+ filter.tags = { $elemMatch: { $elemMatch: { $eq: tags } } };
|
|
|
+ }
|
|
|
+ return filter;
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
module.exports = GoodsService;
|