Просмотр исходного кода

Merge remote-tracking branch 'origin/master'

橙汁先生 1 год назад
Родитель
Сommit
9ebcadf12c

+ 2 - 2
app/controller/api/store/merchant/Merchant.php

@@ -120,14 +120,14 @@ class Merchant extends BaseController
120 120
         if($params['pageSize']!=''){
121 121
             $limit=$params['pageSize'];
122 122
         }
123
-        $where = $this->request->params(['keyword','order','mer_cate_id','price_on', 'price_off','brand_id']);
123
+        $where = $this->request->params(['keyword','order','mer_cate_id', 'cate_id','price_on', 'price_off','brand_id']);
124 124
         $where['is_gift_bag'] = 0;
125 125
         $where['is_used'] = 1;
126 126
         $where['product_type'] = 0;
127 127
         $where['is_hide'] = 0;
128 128
         log::info("====={$params['mer_cate_id']}===");
129 129
         if($params['mer_cate_id']){
130
-            $where['cate_id'] =$params['mer_cate_id'];
130
+            $where['cate_id'] = $params['mer_cate_id'];
131 131
         }
132 132
 
133 133
         return app('json')->success($this->repository->productList($id,$where, $page, $limit,$this->userInfo,$type439));

+ 22 - 0
app/controller/api/store/product/DaTaoKe.php

@@ -574,6 +574,28 @@ class DaTaoKe
574 574
         return ['code' => 1, 'data' => $goodsList, 'raw' => $pddGoodsList];
575 575
     }
576 576
 
577
+
578
+
579
+    //拼多多商品搜索_第三方大淘客
580
+    public static function pddCatList($parentId = 0)
581
+    {
582
+        $queryData = [
583
+            'appKey' => self::$appKey,
584
+            'version' => 'v2.0.0',
585
+            'parentId' => $parentId,
586
+        ];
587
+        $url = 'https://openapi.dataoke.com/api/dels/pdd/category/search';
588
+        $queryData['sign'] = self::makeSign($queryData, self::$appSecret);
589
+        $fullUrl = "{$url}?" . http_build_query($queryData);
590
+        $response = self::sendCurl($fullUrl);
591
+        if ($response['code'] != 0)//运行出错
592
+            return ['code' => 0, 'data' => $response];
593
+       
594
+        return ['code' => 1, 'data' => $response];
595
+    }
596
+
597
+
598
+
577 599
     // 拼多多定时获取列表
578 600
     public function pdd_cron()
579 601
     {

+ 2 - 1
app/controller/api/store/product/Su.php

@@ -400,7 +400,8 @@ class Su extends BaseController
400 400
         $_cid = $this->request->param('cid');
401 401
         // dd($_cid);
402 402
         $userId = $this->request->uid();
403
-        TaoKe::set_third_history($userId,$keyword['keyword']);
403
+        TaoKe::set_third_history($userId,$keyword);
404
+        
404 405
 
405 406
         $goods_obj = Db::name('third_party_goods')
406 407
             ->where('type', 4);

+ 24 - 2
app/controller/api/store/product/TaoKe.php

@@ -130,6 +130,7 @@ class TaoKe extends BaseController
130 130
     public function pdd_list()
131 131
     {
132 132
         $keyword=input('keyword','');
133
+        $cat_id = input('cat_id','');
133 134
         $token = trim($this->request->header('X-Token'));
134 135
 
135 136
 
@@ -177,6 +178,8 @@ class TaoKe extends BaseController
177 178
             return app('json')->success('未查询到商品', []);
178 179
         }
179 180
 
181
+        $params['cat_id'] = $cat_id;
182
+
180 183
         Log::info($params);
181 184
 
182 185
         $apiName = 'pdd.ddk.goods.search';
@@ -252,7 +255,8 @@ class TaoKe extends BaseController
252 255
                     'price' => set_price_rtrim(sprintf('%.2f', $groupPrice - $couponMoney)),
253 256
     
254 257
                     'shopName'=>$goods['mall_name'], //店铺名称
255
-                    'monthSales'=>$goods['sales_tip']>0?$goods['sales_tip']:mt_rand(100,10000) //月销量
258
+                    'monthSales'=>$goods['sales_tip']>0?$goods['sales_tip']:mt_rand(100,10000), //月销量
259
+                    'cat_ids'=>$goods['cat_ids']
256 260
                 ];
257 261
                 Log::info($current_goods);
258 262
                 $goodsList[] =$current_goods;
@@ -370,9 +374,27 @@ class TaoKe extends BaseController
370 374
         return app('json')->success('获取拼多多商品列表成功', $result['data']);
371 375
     }
372 376
 
377
+
378
+    /**
379
+     * 获取拼多多分类
380
+     * @return mixed
381
+     * @author daoheng
382
+     */
383
+    public function pdd_cat()
384
+    {
385
+        $parentId = $this->request->param('parentId') ?? 0;
386
+        $result = DaTaoKe::pddCatList($parentId);
387
+        if ($result['code'] == 0) {
388
+            return app('json')->fail('运行出错', $result['data']);
389
+        }
390
+        return app('json')->success('获取拼多多商品分类成功', $result['data']);
391
+    }
392
+
393
+
394
+
373 395
     //获取多多进宝商品详情
374 396
     public function pdd_detail()
375
-    {
397
+    {       
376 398
         $goodsId = $this->request->param('goodsId');
377 399
         try{
378 400
             $uid = $this->request->uid();

+ 2 - 0
route/api.php

@@ -832,6 +832,8 @@ Route::group('api/', function () {
832 832
 
833 833
     })->middleware(\app\common\middleware\UserTokenMiddleware::class, false);
834 834
 
835
+    //获取拼多多分类
836
+    Route::get('pdd/cat', 'api.store.product.TaoKe/pdd_cat')->middleware(\app\common\middleware\UserTokenMiddleware::class, false);
835 837
     //获取拼多多商品详情
836 838
     Route::get('pdd/detail', 'api.store.product.TaoKe/pdd_detail')->middleware(\app\common\middleware\UserTokenMiddleware::class, false);
837 839
     //唯品会商品详情