Procházet zdrojové kódy

增加商贸区接口

hefei před 1 rokem
rodič
revize
ca60c1a42f
2 změnil soubory, kde provedl 48 přidání a 0 odebrání
  1. 47 0
      app/controller/api/store/merchant/Merchant.php
  2. 1 0
      route/api.php

+ 47 - 0
app/controller/api/store/merchant/Merchant.php

@@ -142,6 +142,53 @@ class Merchant extends BaseController
142 142
     }
143 143
 
144 144
     /**
145
+     * 商贸区店铺商品列表
146
+     * @return mixed
147
+     * @throws \think\db\exception\DataNotFoundException
148
+     * @throws \think\db\exception\DbException
149
+     * @throws \think\db\exception\ModelNotFoundException
150
+     */
151
+    public function commerceProductList()
152
+    {
153
+        $params= $this->request->params(['pageNum','pageSize']);
154
+        $mer_id_unset = [496,486,439,148,491];
155
+        $domain = $this->request->domain();
156
+        if(strpos($domain, 'test.hebeiyhc.com') !== false) {
157
+            // 域名中包含 "test.hebeiyhc.com'" 字符串
158
+            array_push($mer_id_unset, 486);
159
+        }else{
160
+            array_push($mer_id_unset, 497);
161
+        }
162
+
163
+        $is_commercetrade = 1;
164
+        [$page, $limit] = $this->getPage();
165
+        if($params['pageNum']!=''){
166
+            $page=$params['pageNum'];
167
+        }
168
+        if($params['pageSize']!=''){
169
+            $limit=$params['pageSize'];
170
+        }
171
+        $mer_list = Db::name('merchant')->where(['category_id' => 32,'status' => 1,'is_del' => 0])->page($page)->limit($limit)->select();
172
+        $where['is_gift_bag'] = 0;
173
+        $where['is_used'] = 1;
174
+        $where['product_type'] = 0;
175
+        $where['is_hide'] = 0;
176
+        $return_list = [];
177
+        if($mer_list) {
178
+            $mer_list = $mer_list->toArray();
179
+            foreach ($mer_list as $mer) {
180
+                if(in_array($mer['mer_id'],$mer_id_unset)) continue;
181
+                $goods = $this->repository->productList($mer['mer_id'],$where, 1, 3,$this->userInfo,false,$is_commercetrade);
182
+                if(empty($goods['list'])) continue;
183
+                $mer['goods_list'] = $goods['list'];
184
+                $return_list[] = $mer;
185
+            }
186
+        }
187
+        return app('json')->success(['list'=>$return_list]);
188
+
189
+    }
190
+
191
+    /**
145 192
      * 查询代理人商品
146 193
      * @param $type
147 194
      * @return mixed

+ 1 - 0
route/api.php

@@ -730,6 +730,7 @@ Route::group('api/', function () {
730 730
             Route::get('listindex', 'Merchant/listindex');
731 731
             Route::get('/product/lst/:id', 'Merchant/productList');
732 732
             Route::get('/product/type_lst', 'Merchant/productTypeList');//特殊-根据商户查询商品
733
+            Route::get('/product/commerce_list', 'Merchant/commerceProductList');//特殊-根据商户查询商品
733 734
             Route::get('/areaProduct/lst', 'Merchant/areaProductList');
734 735
             Route::get('/category/lst/:id', 'Merchant/categoryList');
735 736
             Route::get('/detail/:id', 'Merchant/detail');