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

客户端-京东服务商从京推推换成官方

sunxbiao месяцев назад: 11
Родитель
Сommit
970b190447
1 измененных файлов с 8 добавлено и 5 удалено
  1. 8 5
      app/controller/api/store/product/Jd.php

+ 8 - 5
app/controller/api/store/product/Jd.php

@@ -380,20 +380,21 @@ class Jd extends BaseController
380
         if (empty($skuId)) {
380
         if (empty($skuId)) {
381
             return app('json')->fail('商品下架不存在', null, 401);
381
             return app('json')->fail('商品下架不存在', null, 401);
382
         }
382
         }
383
-        if (empty($this->request->uid())) {
383
+        $uid = $this->request->uid();
384
+        if (empty($uid)) {
384
             return app('json')->fail('请重新登录', null, 401);
385
             return app('json')->fail('请重新登录', null, 401);
385
         }
386
         }
386
-
387
         $third_party_goods_detail = Db::name('third_party_goods')->where('type', '=', 2)->whereLike('json', '%' . $skuId . '%')->find();
387
         $third_party_goods_detail = Db::name('third_party_goods')->where('type', '=', 2)->whereLike('json', '%' . $skuId . '%')->find();
388
         $third_party_goods_json_detail = json_decode($third_party_goods_detail['json'], true);
388
         $third_party_goods_json_detail = json_decode($third_party_goods_detail['json'], true);
389
 
389
 
390
-        $url = $this->linkChange($third_party_goods_json_detail['materialUrl'], $this->request->uid(), $third_party_goods_json_detail['coupon_link'] ?? '');
390
+        $subUnionId = (int)($third_party_goods_json_detail['commission'] * 1000);
391
+        $url = $this->linkChange($third_party_goods_json_detail['materialUrl'], $uid, $third_party_goods_json_detail['coupon_link'] ?? '', $subUnionId);
391
 
392
 
392
         return app("json")->success(['url' => $url]);
393
         return app("json")->success(['url' => $url]);
393
     }
394
     }
394
 
395
 
395
     /*转链*/
396
     /*转链*/
396
-    public function linkChange($url, $uid,$couponUrl)
397
+    public function linkChange($url, $uid,$couponUrl, $subUnionId)
397
     {
398
     {
398
 
399
 
399
         if (!$uid) {
400
         if (!$uid) {
@@ -413,7 +414,8 @@ class Jd extends BaseController
413
                 'siteId'     => $this->appid,
414
                 'siteId'     => $this->appid,
414
                 'positionId' => $uid, //自定义,和订单关联
415
                 'positionId' => $uid, //自定义,和订单关联
415
                 'couponUrl'  => $couponUrl,
416
                 'couponUrl'  => $couponUrl,
416
-                'sceneId' => 1
417
+                'sceneId' => 1,
418
+                'subUnionId' => $subUnionId
417
             ],
419
             ],
418
         ];
420
         ];
419
         $result = $this->getUrlResult($apiName, $params);
421
         $result = $this->getUrlResult($apiName, $params);
@@ -581,6 +583,7 @@ class Jd extends BaseController
581
 
583
 
582
             // 券后佣金,(促销价-优惠券面额)*佣金比例
584
             // 券后佣金,(促销价-优惠券面额)*佣金比例
583
             $commissionMoney = bcmul($purchasePrice, bcdiv($goods['commissionInfo']['commissionShare'] ?? 0.00, 100, 5), 2);
585
             $commissionMoney = bcmul($purchasePrice, bcdiv($goods['commissionInfo']['commissionShare'] ?? 0.00, 100, 5), 2);
586
+            $commissionMoney = bcsub($commissionMoney, 0.8, 2);
584
 
587
 
585
             $formatList = [
588
             $formatList = [
586
                 'type' => 6,//京东商品
589
                 'type' => 6,//京东商品