|
@@ -100,7 +100,7 @@ module.exports = class ProductsController extends shopController {
|
|
|
offset: 0, limit: 100,
|
|
|
where: { is_home: 1, product_stock: { [seq.Op.gte]: 1 }, is_sale: 1, category_id: { [seq.Op.in]: cate } },
|
|
|
attributes: [ 'product_id', 'category_id', 'product_name', 'product_image', 'shop_price', 'market_price', 'is_new', 'is_hot' ],
|
|
|
- order: [[ 'is_hot', 'desc' ], [ 'is_new', 'desc' ], [ 'sale_count', 'desc' ]],
|
|
|
+ order: [[ 'is_top', 'desc' ], [ 'is_hot', 'desc' ], [ 'is_new', 'desc' ], [ 'sale_count', 'desc' ]],
|
|
|
});
|
|
|
return that.ctx.appJson(that.app.szjcomo.appResult('SUCCESS', result, false));
|
|
|
} catch (err) {
|
|
@@ -130,7 +130,7 @@ module.exports = class ProductsController extends shopController {
|
|
|
offset: 0, limit: 100,
|
|
|
where: { is_home: 1, product_stock: { [seq.Op.gte]: 1 }, is_sale: 1, category_id: { [seq.Op.in]: cate } },
|
|
|
attributes: [ 'product_id', 'category_id', 'product_name', 'product_image', 'shop_price', 'market_price', 'is_new', 'is_hot' ],
|
|
|
- order: [[ 'is_hot', 'desc' ], [ 'is_new', 'desc' ], [ 'sale_count', 'desc' ], [ 'product_stock', 'desc' ], [ 'category_id', 'asc' ]],
|
|
|
+ order: [[ 'is_top', 'desc' ], [ 'is_hot', 'desc' ], [ 'is_new', 'desc' ], [ 'sale_count', 'desc' ], [ 'product_stock', 'desc' ], [ 'category_id', 'asc' ]],
|
|
|
});
|
|
|
return that.ctx.appJson(that.app.szjcomo.appResult('SUCCESS', result, false));
|
|
|
} catch (err) {
|
|
@@ -148,7 +148,9 @@ module.exports = class ProductsController extends shopController {
|
|
|
try {
|
|
|
const data = await that.ctx.validate(that.searchValidate, await that.ctx.getParse());
|
|
|
const result = await that.useModel.findAll({
|
|
|
- offset: 0, limit: 100, order: [[ 'product_id', 'desc' ]],
|
|
|
+ offset: 0,
|
|
|
+ limit: 100,
|
|
|
+ order: [[ 'is_top', 'desc' ], [ 'is_hot', 'desc' ], [ 'is_new', 'desc' ], [ 'product_id', 'desc' ]],
|
|
|
where: { product_name: { [that.app.Sequelize.Op.regexp]: data.keyword }, is_sale: 1 },
|
|
|
attributes: [ 'product_id', 'category_id', 'product_name', 'product_image', 'shop_price', 'market_price', 'is_new', 'is_hot' ],
|
|
|
});
|