Bladeren bron

1、新增办公家具首页接口;2、区分办公家用;

Lawsun 1 jaar geleden
bovenliggende
commit
1783377ba7

+ 1 - 1
.idea/dataSources/7d802c84-b2d0-49d9-a044-ab91ef765055.xml

@@ -6634,4 +6634,4 @@ access_status</ColNames>
       <UnderlyingIndexName>PRIMARY</UnderlyingIndexName>
       <UnderlyingIndexName>PRIMARY</UnderlyingIndexName>
     </key>
     </key>
   </database-model>
   </database-model>
-</dataSource>
+</dataSource>

+ 16 - 14
.idea/workspace.xml

@@ -1,10 +1,11 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <?xml version="1.0" encoding="UTF-8"?>
 <project version="4">
 <project version="4">
   <component name="ChangeListManager">
   <component name="ChangeListManager">
-    <list default="true" id="08cfebb0-a4a4-47ee-a307-566aa06f29bb" name="Default Changelist" comment="1、补充员工字段;">
+    <list default="true" id="08cfebb0-a4a4-47ee-a307-566aa06f29bb" name="Default Changelist" comment="1、活跃用户列表排除内部员工;">
+      <change beforePath="$PROJECT_DIR$/.idea/dataSources/7d802c84-b2d0-49d9-a044-ab91ef765055.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/dataSources/7d802c84-b2d0-49d9-a044-ab91ef765055.xml" afterDir="false" />
       <change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" />
       <change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" />
-      <change beforePath="$PROJECT_DIR$/app/controller/home/statistic.js" beforeDir="false" afterPath="$PROJECT_DIR$/app/controller/home/statistic.js" afterDir="false" />
-      <change beforePath="$PROJECT_DIR$/node_modules/egg-ts-helper/.tmp/eggInfo.json" beforeDir="false" afterPath="$PROJECT_DIR$/node_modules/egg-ts-helper/.tmp/eggInfo.json" afterDir="false" />
+      <change beforePath="$PROJECT_DIR$/app/controller/home/products.js" beforeDir="false" afterPath="$PROJECT_DIR$/app/controller/home/products.js" afterDir="false" />
+      <change beforePath="$PROJECT_DIR$/app/routers/home/shop.js" beforeDir="false" afterPath="$PROJECT_DIR$/app/routers/home/shop.js" afterDir="false" />
     </list>
     </list>
     <option name="SHOW_DIALOG" value="false" />
     <option name="SHOW_DIALOG" value="false" />
     <option name="HIGHLIGHT_CONFLICTS" value="true" />
     <option name="HIGHLIGHT_CONFLICTS" value="true" />
@@ -274,14 +275,8 @@
       <workItem from="1693448014632" duration="596000" />
       <workItem from="1693448014632" duration="596000" />
       <workItem from="1693618204645" duration="54000" />
       <workItem from="1693618204645" duration="54000" />
       <workItem from="1693965606793" duration="9192000" />
       <workItem from="1693965606793" duration="9192000" />
-      <workItem from="1694742935995" duration="13550000" />
-    </task>
-    <task id="LOCAL-00031" summary="1.订单打印补充商品信息;">
-      <created>1673075312104</created>
-      <option name="number" value="00031" />
-      <option name="presentableId" value="LOCAL-00031" />
-      <option name="project" value="LOCAL" />
-      <updated>1673075312104</updated>
+      <workItem from="1694742935995" duration="13888000" />
+      <workItem from="1695004502767" duration="17969000" />
     </task>
     </task>
     <task id="LOCAL-00032" summary="1.修复下单付款没有扣除库存的问题;">
     <task id="LOCAL-00032" summary="1.修复下单付款没有扣除库存的问题;">
       <created>1673230889699</created>
       <created>1673230889699</created>
@@ -619,7 +614,14 @@
       <option name="project" value="LOCAL" />
       <option name="project" value="LOCAL" />
       <updated>1694764819840</updated>
       <updated>1694764819840</updated>
     </task>
     </task>
-    <option name="localTasksCounter" value="80" />
+    <task id="LOCAL-00080" summary="1、活跃用户列表排除内部员工;">
+      <created>1694768534259</created>
+      <option name="number" value="00080" />
+      <option name="presentableId" value="LOCAL-00080" />
+      <option name="project" value="LOCAL" />
+      <updated>1694768534260</updated>
+    </task>
+    <option name="localTasksCounter" value="81" />
     <servers />
     <servers />
   </component>
   </component>
   <component name="TypeScriptGeneratedFilesManager">
   <component name="TypeScriptGeneratedFilesManager">
@@ -665,7 +667,6 @@
     </option>
     </option>
   </component>
   </component>
   <component name="VcsManagerConfiguration">
   <component name="VcsManagerConfiguration">
-    <MESSAGE value="1.补充限制付款订单才能分发电子餐费;" />
     <MESSAGE value="1.调整限制兑酒红包的使用;" />
     <MESSAGE value="1.调整限制兑酒红包的使用;" />
     <MESSAGE value="1.调整餐店分佣比例;" />
     <MESSAGE value="1.调整餐店分佣比例;" />
     <MESSAGE value="1.修复电子餐费发放失败的bug;" />
     <MESSAGE value="1.修复电子餐费发放失败的bug;" />
@@ -690,7 +691,8 @@
     <MESSAGE value="1、关联查询排序问题;" />
     <MESSAGE value="1、关联查询排序问题;" />
     <MESSAGE value="1、热卖-新品-销量-库存 排序;" />
     <MESSAGE value="1、热卖-新品-销量-库存 排序;" />
     <MESSAGE value="1、补充员工字段;" />
     <MESSAGE value="1、补充员工字段;" />
-    <option name="LAST_COMMIT_MESSAGE" value="1、补充员工字段;" />
+    <MESSAGE value="1、活跃用户列表排除内部员工;" />
+    <option name="LAST_COMMIT_MESSAGE" value="1、活跃用户列表排除内部员工;" />
   </component>
   </component>
   <component name="XDebuggerManager">
   <component name="XDebuggerManager">
     <breakpoint-manager>
     <breakpoint-manager>

+ 42 - 2
app/controller/home/products.js

@@ -80,16 +80,55 @@ module.exports = class ProductsController extends shopController {
   }
   }
 
 
   /**
   /**
-   * [homeProduct 获取首页商品]
+   * [homeProduct 获取家用家具首页商品]
    * @return {[type]} [description]
    * @return {[type]} [description]
    */
    */
   async homeProduct() {
   async homeProduct() {
     const that = this;
     const that = this;
     try {
     try {
       const seq = that.app.Sequelize;
       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({
       const result = await that.useModel.findAll({
         offset: 0, limit: 100,
         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' ],
         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_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 商品搜索]
    * [search 商品搜索]
    * @return {[type]} [description]
    * @return {[type]} [description]

+ 2 - 0
app/routers/home/shop.js

@@ -15,6 +15,8 @@ module.exports = app => {
   subRouter.get('/shop/payConfig', shops.shop.payConfig);
   subRouter.get('/shop/payConfig', shops.shop.payConfig);
   // 首页商品列表
   // 首页商品列表
   subRouter.get('/homeProducts', shops.products.homeProduct);
   subRouter.get('/homeProducts', shops.products.homeProduct);
+  // 首页商品列表
+  subRouter.get('/officeHomeProducts', shops.products.officeHomeProducts);
   // 商品详情
   // 商品详情
   subRouter.get('/detail', shops.products.detail);
   subRouter.get('/detail', shops.products.detail);
   // 商品搜索
   // 商品搜索