Browse Source

1、丰富商品筛选条件;

Lawsun_M 1 year ago
parent
commit
49876b85fa
1 changed files with 6 additions and 3 deletions
  1. 6 3
      app/controller/manager/shops/products.js

+ 6 - 3
app/controller/manager/shops/products.js

@@ -100,7 +100,7 @@ module.exports = class ProductsController extends ManagerController {
         .number(),
       is_hot: that.ctx.rules.default(0)
         .number(),
-      is_best: that.ctx.rules.default(0)
+      is_home: that.ctx.rules.default(0)
         .number(),
       content_id: that.ctx.rules.default(0)
         .required()
@@ -177,6 +177,8 @@ module.exports = class ProductsController extends ManagerController {
         .number(),
       product_name: that.ctx.rules.default('')
         .required(),
+      product_sn: that.ctx.rules.default('')
+        .required(),
       supplier_id: that.ctx.rules.default(0)
         .number(),
       is_new: that.ctx.rules.default('')
@@ -185,7 +187,7 @@ module.exports = class ProductsController extends ManagerController {
         .required(),
       is_hot: that.ctx.rules.default('')
         .required(),
-      is_best: that.ctx.rules.default('')
+      is_home: that.ctx.rules.default('')
         .required(),
       category_id: that.ctx.rules.default(0)
         .number(),
@@ -383,10 +385,11 @@ module.exports = class ProductsController extends ManagerController {
       }
       if (data.carousel_id) options.where.carousel_id = data.carousel_id;
       if (data.product_name) options.where.product_name = { [seq.Op.regexp]: data.product_name };
+      if (data.product_sn) options.where.product_sn = { [seq.Op.regexp]: data.product_sn };
       if (data.is_hot !== '') options.where.is_hot = Number(data.is_hot);
       if (data.is_top !== '') options.where.is_top = Number(data.is_top);
       if (data.is_new !== '') options.where.is_new = Number(data.is_new);
-      if (data.is_best !== '') options.where.is_best = Number(data.is_best);
+      if (data.is_home !== '') options.where.is_home = Number(data.is_home);
       if (data.is_sale !== '') options.where.is_sale = Number(data.is_sale);
       if (data.product_type) options.where.product_type = data.product_type;
       if (data.supplier_id) options.where.supplier_id = data.supplier_id;