| 
					
				 | 
			
			
				@@ -80,16 +80,55 @@ module.exports = class ProductsController extends shopController { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				   } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				   /** 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-   * [homeProduct 获取首页商品] 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+   * [homeProduct 获取家用家具首页商品] 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    * @return {[type]} [description] 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    */ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				   async homeProduct() { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     const that = this; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     try { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				       const seq = that.app.Sequelize; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+      // 2023/9/19 查询家具分类 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+      const categoryResult = await that.app.model.ProductCategory.findAll({ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        where: { pid: 4 }, // 2023/9/19 家用家具 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+      }); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+      const categorys = JSON.parse(JSON.stringify(categoryResult)); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+      const cate = []; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+      for (const category of categorys) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        cate.push(category.category_id); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+      } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+      const result = await that.useModel.findAll({ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        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' ]], 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+      }); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+      return that.ctx.appJson(that.app.szjcomo.appResult('SUCCESS', result, false)); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    } catch (err) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+      return that.ctx.appJson(that.app.szjcomo.appResult(err.message)); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+  } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+  /** 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+   * [homeProduct 获取办公家具首页商品] 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+   * @return {[type]} [description] 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+   * http://192.168.18.188:8106/oneshop/api/officeHomeProducts 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+   */ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+  async officeHomeProducts() { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    const that = this; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    try { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+      const seq = that.app.Sequelize; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+      // 2023/9/19 查询家具分类 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+      const categoryResult = await that.app.model.ProductCategory.findAll({ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        where: { pid: 1 }, // 2023/9/19 办公家具 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+      }); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+      const categorys = JSON.parse(JSON.stringify(categoryResult)); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+      const cate = []; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+      for (const category of categorys) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        cate.push(category.category_id); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+      } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				       const result = await that.useModel.findAll({ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         offset: 0, limit: 100, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        where: { is_home: 1, product_stock: { [seq.Op.gte]: 1 }, is_sale: 1 }, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        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' ]], 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				       }); 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -99,6 +138,7 @@ module.exports = class ProductsController extends shopController { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				   } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				   /** 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    * [search 商品搜索] 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    * @return {[type]} [description] 
			 |