Kaynağa Gözat

京东转链接接口

hefei 1 yıl önce
ebeveyn
işleme
9d7111ed25
2 değiştirilmiş dosya ile 33 ekleme ve 10 silme
  1. 32 10
      app/controller/api/store/product/Jt.php
  2. 1 0
      route/api.php

+ 32 - 10
app/controller/api/store/product/Jt.php

@@ -447,6 +447,27 @@ class Jt extends BaseController
447 447
         return app("json")->success("获取详情成功-aabb,用户{$userId}", $return);
448 448
     }
449 449
 
450
+    /**
451
+     * 商品详情转链
452
+     * @return mixed
453
+     */
454
+    public function changLinkApi()
455
+    {
456
+        $discount_link = $this->request->param('discount_link');
457
+        $skuId = $this->request->param('skuId');
458
+        $userId = $this->request->uid();
459
+        $url = '';
460
+        if($userId != ''){
461
+            $clparams = [
462
+                'positionid' => pow(10, 5) + $userId,
463
+                'gid' => $skuId,
464
+                'coupon_url' => $discount_link ?? '',
465
+            ];
466
+            $url = $this->changLink($clparams);
467
+        }
468
+        return app("json")->success(['url' => $url]);
469
+    }
470
+
450 471
 
451 472
     //实际执行活动经推推商品详情方法
452 473
     public function doGetJtDetail($goodsId, $userId)
@@ -578,6 +599,7 @@ class Jt extends BaseController
578 599
                 'yanglaojin' => $yanglaojin,
579 600
                 'gongxian' => $gongxian,
580 601
                 'jifen' => $jifen,
602
+                'discount_link' => $detail['couponInfo']['couponList'][0]['discount_link']
581 603
 
582 604
                 // 'yanglao' => $yanglao,
583 605
                 // 'yanglao_' => $commissionMoney,
@@ -587,16 +609,16 @@ class Jt extends BaseController
587 609
             $formatData['gongxian']=round($gongxian,2);
588 610
             $formatData['jifen']=round($jifen,2);
589 611
 
590
-            $formatData['materialUrl'] = '';
591
-            if($userId!=''){
592
-                //加入转链地址 此步骤可优化 分两个步骤
593
-                $clparams = [
594
-                    'positionid' => pow(10, 5) + $userId,
595
-                    'gid' => $goodsId,
596
-                    'coupon_url' => $detail['couponInfo']['couponList'][0]['discount_link'] ?? '',
597
-                ];
598
-                $formatData['materialUrl'] = $this->changLink($clparams);
599
-            }
612
+//            $formatData['materialUrl'] = '';
613
+//            if($userId!=''){
614
+//                //加入转链地址 此步骤可优化 分两个步骤
615
+//                $clparams = [
616
+//                    'positionid' => pow(10, 5) + $userId,
617
+//                    'gid' => $goodsId,
618
+//                    'coupon_url' => $detail['couponInfo']['couponList'][0]['discount_link'] ?? '',
619
+//                ];
620
+//                $formatData['materialUrl'] = $this->changLink($clparams);
621
+//            }
600 622
 
601 623
             $return[] = $formatData;
602 624
         }

+ 1 - 0
route/api.php

@@ -380,6 +380,7 @@ Route::group('api/', function () {
380 380
         }else{
381 381
             /*京东商品详情*/
382 382
             Route::get('jd/detail', 'api.store.product.Jt/goodsDetail')->middleware(\app\common\middleware\UserTokenMiddleware::class, false);//京推推
383
+            Route::get('jd/chang_link', 'api.store.product.Jt/changLinkApi')->middleware(\app\common\middleware\UserTokenMiddleware::class, false);//京推推
383 384
             Route::get('jd/search', 'api.store.product.Jt/search');//京推推
384 385
         }
385 386