Ver código fonte

Merge remote-tracking branch 'origin/dev' into dev

Xpy 6 meses atrás
pai
commit
fcec5f6459

+ 252 - 31
app/command/WiwibaoProductSync.php

@@ -3,8 +3,10 @@ declare (strict_types=1);
3
 
3
 
4
 namespace app\command;
4
 namespace app\command;
5
 
5
 
6
+use app\common\enum\CommonEnum;
6
 use app\common\enum\douhuomall\DouhuomallEnum;
7
 use app\common\enum\douhuomall\DouhuomallEnum;
7
 use app\common\enum\store\ProductEnum;
8
 use app\common\enum\store\ProductEnum;
9
+use app\common\repositories\store\product\ProductRepository;
8
 use app\traits\GongApiRequest;
10
 use app\traits\GongApiRequest;
9
 use think\console\Command;
11
 use think\console\Command;
10
 use think\console\Input;
12
 use think\console\Input;
@@ -25,6 +27,7 @@ class WiwibaoProductSync extends Command
25
         'page_size' => 100,      // 每页拉取数量
27
         'page_size' => 100,      // 每页拉取数量
26
         'max_pages' => 0,       // 最大页数限制
28
         'max_pages' => 0,       // 最大页数限制
27
         'price_change_rate' => 0.0, // 价格变动比率阈值(10%)
29
         'price_change_rate' => 0.0, // 价格变动比率阈值(10%)
30
+        'mer_id' => CommonEnum::DESIGN_MERCHANT_ID['WonderfulLiving']['code']
28
     ];
31
     ];
29
 
32
 
30
     protected function configure()
33
     protected function configure()
@@ -60,13 +63,22 @@ class WiwibaoProductSync extends Command
60
             }
63
             }
61
 
64
 
62
             // 2. 获取本地所有SPU ID
65
             // 2. 获取本地所有SPU ID
63
-            $localSpuIds = Db::name('douhuomall')->column('spu_id');
66
+            $douhuomallDataMap = [];
67
+            $localSpuIds = [];
68
+            $douhuomallDataList = Db::name('douhuomall')
69
+                ->select()
70
+                ->toArray();
71
+            if (!empty($douhuomallDataList)) {
72
+                $douhuomallDataMap = array_column($douhuomallDataList, null, 'spu_id');
73
+                $localSpuIds = array_keys($douhuomallDataMap);
74
+            }
75
+
64
             $syncedSpuIds = [];
76
             $syncedSpuIds = [];
65
 
77
 
66
             // 3. 批量处理商品数据
78
             // 3. 批量处理商品数据
67
             foreach ($allProducts as $product) {
79
             foreach ($allProducts as $product) {
68
                 try {
80
                 try {
69
-                    $spuId = $this->processSingleProduct($product);
81
+                    $spuId = $this->processSingleProduct($product, $douhuomallDataMap[$product['goods_id']] ?? []);
70
                     if ($spuId) {
82
                     if ($spuId) {
71
                         $syncedSpuIds[] = $spuId;
83
                         $syncedSpuIds[] = $spuId;
72
                     }
84
                     }
@@ -120,7 +132,7 @@ class WiwibaoProductSync extends Command
120
     /**
132
     /**
121
      * 处理单个商品
133
      * 处理单个商品
122
      */
134
      */
123
-    protected function processSingleProduct($productData)
135
+    protected function processSingleProduct($productData, $douhuomallData)
124
     {
136
     {
125
         $goodsId = $productData['goods_id'];
137
         $goodsId = $productData['goods_id'];
126
 
138
 
@@ -140,7 +152,7 @@ class WiwibaoProductSync extends Command
140
         $saveData = $this->buildSaveData($goodsInfo, $skuInfo, $imageData);
152
         $saveData = $this->buildSaveData($goodsInfo, $skuInfo, $imageData);
141
 
153
 
142
         // 5. 保存到本地(使用原有的add方法逻辑)
154
         // 5. 保存到本地(使用原有的add方法逻辑)
143
-        $spuId = $this->addToDouhuomall($saveData);
155
+        $spuId = $this->addToDouhuomall($saveData, $douhuomallData);
144
 
156
 
145
         // 6. 检查并处理已上架商品的价格变动
157
         // 6. 检查并处理已上架商品的价格变动
146
         $this->checkAndProcessOnlineProduct($spuId, $saveData);
158
         $this->checkAndProcessOnlineProduct($spuId, $saveData);
@@ -244,13 +256,14 @@ class WiwibaoProductSync extends Command
244
     }
256
     }
245
 
257
 
246
     /**
258
     /**
247
-     * 保存到douhuomall表(基于原有add方法)
259
+     * @param $data
260
+     * @param $findData
261
+     * @return mixed
262
+     * @throws DbException
248
      */
263
      */
249
-    protected function addToDouhuomall($data)
264
+    protected function addToDouhuomall($data, $findData)
250
     {
265
     {
251
         try {
266
         try {
252
-            $findData = Db::name('douhuomall')->where('spu_id', $data['spu_id'])->find();
253
-
254
             // 对SKU按成本价排序,获取最低成本价的SKU
267
             // 对SKU按成本价排序,获取最低成本价的SKU
255
             $skuInfo = $this->arrSort($data['skuId_info'], 'cost_price', SORT_ASC);
268
             $skuInfo = $this->arrSort($data['skuId_info'], 'cost_price', SORT_ASC);
256
 
269
 
@@ -291,11 +304,11 @@ class WiwibaoProductSync extends Command
291
                 Db::name('douhuomall')->insert($insertData);
304
                 Db::name('douhuomall')->insert($insertData);
292
             } else {
305
             } else {
293
                 // 更新
306
                 // 更新
294
-                // 检查是否需要恢复已删除商品的上架状态
295
-                $shouldRestore = $this->shouldRestoreProduct($findData, $data);
296
-                if ($shouldRestore) {
297
-                    $this->restoreProduct($data['spu_id']);
298
-                }
307
+                //  无意义 // 检查是否需要恢复已删除商品的上架状态
308
+                // $shouldRestore = $this->shouldRestoreProduct($findData, $data);
309
+                // if ($shouldRestore) {
310
+                //     $this->restoreProduct($data['spu_id']);
311
+                // }
299
                 $updateData = [
312
                 $updateData = [
300
                     'status' => $data['status'],
313
                     'status' => $data['status'],
301
                     'update_time' => $now,
314
                     'update_time' => $now,
@@ -359,7 +372,7 @@ class WiwibaoProductSync extends Command
359
         Db::name('store_product')
372
         Db::name('store_product')
360
             ->where('spu_id', $spuId)
373
             ->where('spu_id', $spuId)
361
             ->update([
374
             ->update([
362
-                'is_show' => ProductEnum::IS_SHOW['No']['code'],
375
+                'is_show' => ProductEnum::IS_SHOW['Yes']['code'],
363
                 'status' => ProductEnum::STATUS['Approved']['code']
376
                 'status' => ProductEnum::STATUS['Approved']['code']
364
             ]);
377
             ]);
365
 
378
 
@@ -374,12 +387,14 @@ class WiwibaoProductSync extends Command
374
         // 检查商品是否已上架
387
         // 检查商品是否已上架
375
         try {
388
         try {
376
             $productList = Db::name('store_product')
389
             $productList = Db::name('store_product')
377
-                ->where('is_show', ProductEnum::IS_SHOW['Yes']['code'])
390
+                // ->where('is_show', ProductEnum::IS_SHOW['Yes']['code'])
378
                 ->where('spu_id', $spuId)
391
                 ->where('spu_id', $spuId)
379
                 ->select()
392
                 ->select()
380
                 ->toArray();
393
                 ->toArray();
381
 
394
 
382
             if (empty($productList)) {
395
             if (empty($productList)) {
396
+                // 如果没有该商品则自动上架
397
+                $this->insert_product($spuId, $this->config['mer_id']);
383
                 return;
398
                 return;
384
             }
399
             }
385
 
400
 
@@ -395,6 +410,12 @@ class WiwibaoProductSync extends Command
395
             }
410
             }
396
 
411
 
397
             foreach ($productList as $product) {
412
             foreach ($productList as $product) {
413
+
414
+                if ($product['is_show'] == ProductEnum::IS_SHOW['No']['code'] && $product['is_status'] == ProductEnum::IS_STATUS['Triggered']['code']) {
415
+                    // 如果商品 属于未上架商品(或是被员工下架了) 则不做任何处理
416
+                    continue;
417
+                }
418
+
398
                 // 获取本地商品价格信息
419
                 // 获取本地商品价格信息
399
                 // 获取SKU价格
420
                 // 获取SKU价格
400
                 $skus = Db::name('store_product_attr_value')
421
                 $skus = Db::name('store_product_attr_value')
@@ -412,9 +433,38 @@ class WiwibaoProductSync extends Command
412
                 // 比较价格,判断是否需要下架
433
                 // 比较价格,判断是否需要下架
413
                 $priceChanged = $this->checkPriceChange($localPrices, $syncPrices);
434
                 $priceChanged = $this->checkPriceChange($localPrices, $syncPrices);
414
 
435
 
415
-                if ($priceChanged) {
436
+                if ($priceChanged['result'] ?? false) {
416
                     // 价格变动超过阈值,下架商品并记录
437
                     // 价格变动超过阈值,下架商品并记录
417
-                    $this->offlineProductWithRecord($product, $syncData, $localPrices, $syncPrices);
438
+                    // $this->offlineProductWithRecord($product, $syncData, $localPrices, $syncPrices);
439
+
440
+                    $changeSkuAttrDataList = [];
441
+                    foreach ($skus as $sku) {
442
+                        $edit_price = bcadd(
443
+                            $sku['price'],
444
+                            $priceChanged['sku_difference_map'][$sku['gong_sku_id']] ?? ($priceChanged['spu_difference'] ?? '0.00'),
445
+                            2
446
+                        );
447
+                        Log::info('商品价格变动:' . json_encode([
448
+                                'product_id' => $product['product_id'],
449
+                                'sku_id' => $sku['gong_sku_id'],
450
+                                'before_price' => $sku['price'],
451
+                                'edit_price' => $edit_price
452
+                            ])
453
+                        );
454
+                        $changeSkuAttrDataList[] = [
455
+                            'sku_id' => $sku['gong_sku_id'],
456
+                            'edit_price' => $edit_price
457
+                        ];
458
+                    }
459
+                    // 新规则 根据价格变动 增减商品售价
460
+                    /** @var ProductRepository $productRepository */
461
+                    $productRepository = app()->make(ProductRepository::class);
462
+                    $productRepository->editPrice($product['product_id'], $changeSkuAttrDataList);
463
+
464
+                    // 如果是系统下架的商品 则对商品重新上架
465
+                    if ($product['is_show'] == ProductEnum::IS_SHOW['No']['code'] && $product['is_status'] == ProductEnum::IS_STATUS['Automatic']['code']) {
466
+                        $this->restoreProduct($product['spu_id']);
467
+                    }
418
                 } else {
468
                 } else {
419
                     // 价格未变动或变动很小,只更新图片
469
                     // 价格未变动或变动很小,只更新图片
420
                     $this->updateProductImages($spuId);
470
                     $this->updateProductImages($spuId);
@@ -430,16 +480,23 @@ class WiwibaoProductSync extends Command
430
      */
480
      */
431
     protected function checkPriceChange($localPrices, $syncPrices)
481
     protected function checkPriceChange($localPrices, $syncPrices)
432
     {
482
     {
483
+        $res = [
484
+            'result' => false,
485
+            'spu_difference' => 0.00,
486
+            'sku_difference_map' => []
487
+        ];
488
+        // 如果成本价不变 则没有必要更新商品信息
433
         // 如果没有SKU,比较商品主价格
489
         // 如果没有SKU,比较商品主价格
434
         if (empty($localPrices['skus'])) {
490
         if (empty($localPrices['skus'])) {
435
-            $localPrice = $localPrices['product_price'];
436
-            $syncPrice = $syncPrices[0]['market_price'] ?? 0;
491
+            $localPrice = $localPrices['product_cost'];
492
+            $syncPrice = $syncPrices[0]['cost_price'] ?? 0;
437
 
493
 
438
             if ($localPrice > 0 && $syncPrice > 0) {
494
             if ($localPrice > 0 && $syncPrice > 0) {
439
                 $changeRate = abs(($syncPrice - $localPrice) / $localPrice);
495
                 $changeRate = abs(($syncPrice - $localPrice) / $localPrice);
440
-                return $changeRate > $this->config['price_change_rate'];
496
+                $res['result'] = $changeRate > $this->config['price_change_rate'];
497
+                $res['spu_difference'] = bcsub((string)$syncPrice, $localPrice, 2);
441
             }
498
             }
442
-            return false;
499
+            return $res;
443
         }
500
         }
444
 
501
 
445
         // 如果有SKU,匹配SKU进行比较
502
         // 如果有SKU,匹配SKU进行比较
@@ -447,20 +504,19 @@ class WiwibaoProductSync extends Command
447
             foreach ($syncPrices as $syncSku) {
504
             foreach ($syncPrices as $syncSku) {
448
                 // 尝试匹配SKU
505
                 // 尝试匹配SKU
449
                 if ($this->matchSku($localSku, $syncSku)) {
506
                 if ($this->matchSku($localSku, $syncSku)) {
450
-                    $localPrice = $localSku['price'] ?? 0;
451
-                    $syncPrice = $syncSku['market_price'] ?? 0;
507
+                    $localPrice = $localSku['cost'] ?? 0;
508
+                    $syncPrice = $syncSku['cost_price'] ?? 0;
452
 
509
 
453
                     if ($localPrice > 0 && $syncPrice > 0) {
510
                     if ($localPrice > 0 && $syncPrice > 0) {
454
                         $changeRate = abs(($syncPrice - $localPrice) / $localPrice);
511
                         $changeRate = abs(($syncPrice - $localPrice) / $localPrice);
455
-                        if ($changeRate > $this->config['price_change_rate']) {
456
-                            return true;
457
-                        }
512
+                        $res['result'] = $changeRate > $this->config['price_change_rate'];
513
+                        $res['sku_difference_map'][$localSku['gong_sku_id']] = bcsub((string)$syncPrice, $localPrice, 2);
458
                     }
514
                     }
459
                 }
515
                 }
460
             }
516
             }
461
         }
517
         }
462
 
518
 
463
-        return false;
519
+        return $res;
464
     }
520
     }
465
 
521
 
466
     /**
522
     /**
@@ -623,11 +679,9 @@ class WiwibaoProductSync extends Command
623
         $products = Db::name('store_product')
679
         $products = Db::name('store_product')
624
             ->where('spu_id', $spuId)
680
             ->where('spu_id', $spuId)
625
             ->select();
681
             ->select();
682
+        $douhuomallData = Db::name('douhuomall')->where('spu_id', $spuId)->select()->toArray();
626
 
683
 
627
         foreach ($products as $product) {
684
         foreach ($products as $product) {
628
-            // 记录下架前数据
629
-            $beforeData = $product;
630
-
631
             // 下架商品
685
             // 下架商品
632
             Db::name('store_product')
686
             Db::name('store_product')
633
                 ->where('product_id', $product['product_id'])
687
                 ->where('product_id', $product['product_id'])
@@ -643,7 +697,7 @@ class WiwibaoProductSync extends Command
643
                 $spuId,
697
                 $spuId,
644
                 'third_party_offline',
698
                 'third_party_offline',
645
                 $reason,
699
                 $reason,
646
-                $beforeData,
700
+                ['product' => $product, 'douhuomallData' => $douhuomallData],
647
                 []
701
                 []
648
             );
702
             );
649
         }
703
         }
@@ -740,4 +794,171 @@ class WiwibaoProductSync extends Command
740
             'time' => date('Y-m-d H:i:s')
794
             'time' => date('Y-m-d H:i:s')
741
         ]);
795
         ]);
742
     }
796
     }
797
+
798
+    // 借用 app\controller\merchant\gong\Goods.php 控制器内方法
799
+
800
+    /**
801
+     * 将 微唯宝商品 选品(加入) 到系统内部商户商品表
802
+     * @param $spu_id
803
+     * @param $mer_id
804
+     * @return bool
805
+     */
806
+    public function insert_product($spu_id, $mer_id)
807
+    {
808
+        try {
809
+            // 1、获取商品信息
810
+            $data = Db::name('douhuomall')->where('spu_id', $spu_id)->find();
811
+
812
+            // 2、是否为多规格
813
+            $sku_data = json_decode($data['skuId_info'], true);
814
+            $spec_type = count($sku_data);
815
+            if ($spec_type > 1) {
816
+                $spec_type = 1;
817
+            } else {
818
+                $spec_type = 0;
819
+            }
820
+
821
+            // 3、商品主图
822
+            $spuId_info = json_decode($data['spuId_info'], true);
823
+            $slider_image = $spuId_info['detail_img_list'] ?? '';
824
+            $image = $spuId_info['cover_url'] ?? '';
825
+            if (empty($slider_image)) {
826
+                $slider_image = $image;
827
+            } else if (is_string($slider_image)) {
828
+                $slider_image = implode(',', json_decode($slider_image, true));
829
+            } else if (is_array($slider_image)) {
830
+                $slider_image = implode(',', $slider_image);
831
+            }
832
+            $yanglaojin_scale = (!empty($data['pension']) && !empty($data['market_price'])) ? bcdiv($data['pension'], $data['market_price'], 2) : 0;
833
+
834
+            // 4、商品入库数据
835
+            $product_insert_data = [
836
+                'mer_id' => $mer_id,
837
+                'image' => $image,
838
+                'slider_image' => $slider_image,
839
+                'store_name' => $data['title'],
840
+                'store_info' => 1,
841
+                'keyword' => mb_substr($data['title'], 0, 3),
842
+                'is_show' => 1,
843
+                'status' => 1,
844
+                'cate_id' => $data['cate_ids'],
845
+                'unit_name' => '个',
846
+                'price' => $data['market_price'],
847
+                'cost' => $data['cost_price'],
848
+                'ot_price' => $data['ot_price'],
849
+                'stock' => '1000',
850
+                'spec_type' => $spec_type,
851
+                'extension_type' => 1,
852
+                'mer_status' => 1,
853
+                'is_used' => 1,
854
+                'old_product_id' => $data['id'],
855
+                'volunteer' => 0,
856
+                'type' => 1,
857
+                'pension' => '0.00',
858
+                'commission' => 5,
859
+                'spu_id' => $data['spu_id'],
860
+                'temp_id' => 105,
861
+                'plate_mer_profit' => $data['mer_profit'],
862
+                'concession_pri' => $data['mer_profit'],
863
+                'yanglaojin_scale' => $yanglaojin_scale
864
+            ];
865
+            $insert_id = Db::name('store_product')->insertGetId($product_insert_data);
866
+
867
+            // 5、更新商品详情表
868
+            $detail = $spuId_info['detail'];
869
+            if (!is_null(json_decode($detail))) {
870
+                $detail_list = json_decode($detail);
871
+                $detail = '';
872
+                foreach ($detail_list as $value) {
873
+                    $detail .= '<img src="' . $value . '"></img>';
874
+                }
875
+            }
876
+            Db::name('store_product_content')->insert(['content' => $detail, 'product_id' => $insert_id]);
877
+
878
+            // 6、
879
+            $this->insert_sku($insert_id, $sku_data);
880
+            return true;
881
+        } catch (\Exception $e) {
882
+            Log::error($spu_id . "加入选品失败:" . $e->getMessage());
883
+            return false;
884
+        }
885
+    }
886
+
887
+    // 借用 app\controller\merchant\gong\Goods.php 控制器内方法
888
+    public function insert_sku($id, $data)
889
+    {
890
+        // 1、获取 所有SKU的 规格属性值
891
+        $sku_attr_data = array_column($data, 'attribute_json');
892
+        $name = '';
893
+
894
+        // 2、写入 商品属性表
895
+        /** @var ProductRepository $ProductRepository */
896
+        $ProductRepository = app()->make(ProductRepository::class);
897
+        if (empty($sku_attr_data[0][0])) {
898
+            // 写入商品属性表
899
+            Db::name('store_product_attr')->insert(['product_id' => $id, 'attr_name' => '规格', 'attr_values' => $name]);
900
+            $key = '';
901
+            $num = 1;
902
+            // 写入 SKU 商品属性值表
903
+            foreach ($data as $k => $v) {
904
+                Db::name('store_product_attr_value')->insert([
905
+                    'product_id' => $id,
906
+                    'detail' => json_encode(['规格' => $key]),
907
+                    'sku' => $key,
908
+                    'image' => $v['img_url'],
909
+                    'cost' => $v['cost_price'],
910
+                    'ot_price' => $v['retail_price'],
911
+                    'price' => $v['market_price'],
912
+                    'unique' => $ProductRepository->setUnique($id, $v['sku_id'], 0),
913
+                    'stock' => 100,
914
+                    'cost_price' => $v['cost_price'],
915
+                    'extension_one' => 5,
916
+                    'gong_sku_id' => $v['sku_id'],
917
+                    'gong_mer_profit' => $v['mer_profit'],
918
+                    'gong_pension' => $v['yanglaojin'],
919
+                    'gong_market_price' => $v['market_price'],
920
+                    'plate_mer_profit' => $v['mer_profit']
921
+                ]);
922
+                $key = '';
923
+                $num++;
924
+            }
925
+        } else {
926
+            foreach ($sku_attr_data as $kk => $vv) {
927
+                foreach ($vv as $k1 => $v1) {
928
+                    $name .= $v1['val'];
929
+                }
930
+                $name .= '-!-';
931
+            }
932
+            $name = rtrim($name, '-!-');
933
+            Db::name('store_product_attr')->insert(['product_id' => $id, 'attr_name' => '规格', 'attr_values' => $name]);
934
+            $key = '';
935
+            $num = 1;
936
+            foreach ($data as $k => $v) {
937
+                foreach ($v['attribute_json'] as $k2 => $v2) {
938
+                    $key .= $v2['val'];
939
+                }
940
+
941
+                Db::name('store_product_attr_value')->insert([
942
+                    'product_id' => $id,
943
+                    'detail' => json_encode(['规格' => $key]),
944
+                    'sku' => $key,
945
+                    'image' => $v['img_url'],
946
+                    'cost' => $v['cost_price'],
947
+                    'ot_price' => $v['retail_price'],
948
+                    'price' => $v['market_price'],
949
+                    'unique' => $ProductRepository->setUnique($id, $v['sku_id'], 0),
950
+                    'stock' => 100,
951
+                    'cost_price' => $v['cost_price'],
952
+                    'extension_one' => 5,
953
+                    'gong_sku_id' => $v['sku_id'],
954
+                    'gong_mer_profit' => $v['mer_profit'],
955
+                    'gong_pension' => $v['yanglaojin'],
956
+                    'gong_market_price' => $v['market_price'],
957
+                    'plate_mer_profit' => $v['mer_profit']
958
+                ]);
959
+                $key = '';
960
+                $num++;
961
+            }
962
+        }
963
+    }
743
 }
964
 }

+ 5 - 5
app/controller/api/store/product/TaoKe.php

@@ -412,10 +412,10 @@ class TaoKe extends BaseController
412
             $uid=0;
412
             $uid=0;
413
         }
413
         }
414
 
414
 
415
-        log::info("===doGetPinDetail==={$goodsId}+======{$uid}");
415
+        // log::info("===doGetPinDetail==={$goodsId}+======{$uid}");
416
         //获取商品详情
416
         //获取商品详情
417
         $result = $this->doGetPinDetail($goodsId, $uid);
417
         $result = $this->doGetPinDetail($goodsId, $uid);
418
-        log::info("===doGetPinDetail=={$uid}");
418
+        // log::info("===doGetPinDetail=={$uid}");
419
 //        log::info($result);
419
 //        log::info($result);
420
         $log = [
420
         $log = [
421
             'flag' => '拼多多详情',
421
             'flag' => '拼多多详情',
@@ -450,7 +450,7 @@ class TaoKe extends BaseController
450
 
450
 
451
         $apiName = 'pdd.ddk.goods.detail';
451
         $apiName = 'pdd.ddk.goods.detail';
452
         $result = $this->getUrlResult($apiName, $params);
452
         $result = $this->getUrlResult($apiName, $params);
453
-        Log::info($result);
453
+        // Log::info($result);
454
         if(isset($result['error_response']['error_code']) && $result['error_response']['error_code']==50001)
454
         if(isset($result['error_response']['error_code']) && $result['error_response']['error_code']==50001)
455
             return ['code' => 2, 'data' => '该商品已下架或不存在~'];
455
             return ['code' => 2, 'data' => '该商品已下架或不存在~'];
456
         $response = $result['goods_detail_response']['goods_details'] ?? [];
456
         $response = $result['goods_detail_response']['goods_details'] ?? [];
@@ -462,14 +462,14 @@ class TaoKe extends BaseController
462
         // $detail['yanglao'] = app()->make(ProductRepository::class)
462
         // $detail['yanglao'] = app()->make(ProductRepository::class)
463
         //     ->thirdYanglaojin(0, sprintf('%.2f', $commission));
463
         //     ->thirdYanglaojin(0, sprintf('%.2f', $commission));
464
 
464
 
465
-        log::info("commission==={$commission}");
465
+        // log::info("commission==={$commission}");
466
         $systemvalueObj= $goods_obj = Db::name('system_config_value')
466
         $systemvalueObj= $goods_obj = Db::name('system_config_value')
467
             -> where('config_key','sanfangfenpei')->find();;
467
             -> where('config_key','sanfangfenpei')->find();;
468
         $sanfangfenpei=json_decode($systemvalueObj['value'],true);
468
         $sanfangfenpei=json_decode($systemvalueObj['value'],true);
469
         $ppv=$commission*$sanfangfenpei['pv'];
469
         $ppv=$commission*$sanfangfenpei['pv'];
470
         $pv3=round($ppv,3);  //PV
470
         $pv3=round($ppv,3);  //PV
471
         $pv=round($ppv,2);  //PV
471
         $pv=round($ppv,2);  //PV
472
-        log::info("pv==={$pv}===========ppv3={$pv3}");
472
+        // log::info("pv==={$pv}===========ppv3={$pv3}");
473
         $yanglaojin=round($commission*$sanfangfenpei['yanglaojin'],2); //新的养老金
473
         $yanglaojin=round($commission*$sanfangfenpei['yanglaojin'],2); //新的养老金
474
 
474
 
475
 
475
 

+ 1 - 1
app/controller/api/store/product/Vip.php

@@ -545,7 +545,7 @@ class Vip extends BaseController
545
             'realCall' => 'true',
545
             'realCall' => 'true',
546
         ];
546
         ];
547
 
547
 
548
-        log::info($requestIn);
548
+        // log::info($requestIn);
549
         $params['request'] = $requestIn;
549
         $params['request'] = $requestIn;
550
         $result = $this->getUrlResult($apiName, "getByGoodsIds", $params);
550
         $result = $this->getUrlResult($apiName, "getByGoodsIds", $params);
551
 //        log::info($result);
551
 //        log::info($result);

+ 7 - 7
app/controller/api/user/User.php

@@ -200,14 +200,14 @@ class User extends BaseController
200
 
200
 
201
     // 红包
201
     // 红包
202
     public function  hongbao_info(){
202
     public function  hongbao_info(){
203
-        log::info("============hongbao");
203
+        // log::info("============hongbao");
204
         $user = $this->request->userInfo();
204
         $user = $this->request->userInfo();
205
         if($user->uid>0){
205
         if($user->uid>0){
206
             // 已经入账红包
206
             // 已经入账红包
207
             $data['total_source']=$user->hongbao;
207
             $data['total_source']=$user->hongbao;
208
             // 为生效红包
208
             // 为生效红包
209
             $data['no_total_source']=Db::name('user_sign_hongbao')->where('status', -1)->where('uid', $user->uid)->sum('number');;
209
             $data['no_total_source']=Db::name('user_sign_hongbao')->where('status', -1)->where('uid', $user->uid)->sum('number');;
210
-            log::info("====spread_info_yhc=={$data['total_source']}======={$data['no_total_source']}");
210
+            // log::info("====spread_info_yhc=={$data['total_source']}======={$data['no_total_source']}");
211
             return app('json')->success($data);
211
             return app('json')->success($data);
212
 
212
 
213
         }
213
         }
@@ -408,7 +408,7 @@ class User extends BaseController
408
 
408
 
409
             // 未生效贡献值
409
             // 未生效贡献值
410
             $data['no_total_source']=Db::name('user_sign_gongxian')->where('status', -1)->where('uid', $user->uid)->sum('number');
410
             $data['no_total_source']=Db::name('user_sign_gongxian')->where('status', -1)->where('uid', $user->uid)->sum('number');
411
-            log::info("====spread_info_yhc=={$data['total_source']}======={$data['no_total_source']}");
411
+            // log::info("====spread_info_yhc=={$data['total_source']}======={$data['no_total_source']}");
412
             return app('json')->success($data);
412
             return app('json')->success($data);
413
         }
413
         }
414
 
414
 
@@ -481,7 +481,7 @@ class User extends BaseController
481
             $data['total_source'] = $user->jingdou;// 临时使用
481
             $data['total_source'] = $user->jingdou;// 临时使用
482
             // 为生效京豆
482
             // 为生效京豆
483
             $data['no_total_source']=Db::name('user_sign_jingdou')->where('status', -1)->where('uid', $user->uid)->sum('number');;
483
             $data['no_total_source']=Db::name('user_sign_jingdou')->where('status', -1)->where('uid', $user->uid)->sum('number');;
484
-            log::info("====spread_info_yhc=={$data['total_source']}======={$data['no_total_source']}");
484
+            // log::info("====spread_info_yhc=={$data['total_source']}======={$data['no_total_source']}");
485
 
485
 
486
             return app('json')->success($data);
486
             return app('json')->success($data);
487
 
487
 
@@ -530,7 +530,7 @@ class User extends BaseController
530
             $data['total_source']=$user->fugou;
530
             $data['total_source']=$user->fugou;
531
             // 为生效京豆
531
             // 为生效京豆
532
             $data['no_total_source']=Db::name('user_sign_fugou')->where('status', -1)->where('uid', $user->uid)->sum('number');;
532
             $data['no_total_source']=Db::name('user_sign_fugou')->where('status', -1)->where('uid', $user->uid)->sum('number');;
533
-            log::info("====spread_info_yhc=={$data['total_source']}======={$data['no_total_source']}");
533
+            // log::info("====spread_info_yhc=={$data['total_source']}======={$data['no_total_source']}");
534
             return app('json')->success($data);
534
             return app('json')->success($data);
535
 
535
 
536
         }
536
         }
@@ -577,7 +577,7 @@ class User extends BaseController
577
             // 为生效京豆
577
             // 为生效京豆
578
             $data['no_total_source']=0;
578
             $data['no_total_source']=0;
579
             //$data['no_total_source']=Db::name('user_sign_vr')->where('status', -1)->where('uid', $user->uid)->sum('number');;
579
             //$data['no_total_source']=Db::name('user_sign_vr')->where('status', -1)->where('uid', $user->uid)->sum('number');;
580
-            log::info("====spread_info_yhc=={$data['total_source']}======={$data['no_total_source']}");
580
+            // log::info("====spread_info_yhc=={$data['total_source']}======={$data['no_total_source']}");
581
             return app('json')->success($data);
581
             return app('json')->success($data);
582
 
582
 
583
         }
583
         }
@@ -618,7 +618,7 @@ class User extends BaseController
618
             $data['total_source']=$user->score;
618
             $data['total_source']=$user->score;
619
             // 为生效积分
619
             // 为生效积分
620
             $data['no_total_source']=Db::name('user_sign_score')->where('status', -1)->where('uid', $user->uid)->sum('reward_socre');;
620
             $data['no_total_source']=Db::name('user_sign_score')->where('status', -1)->where('uid', $user->uid)->sum('reward_socre');;
621
-            log::info("====spread_info_yhc=={$data['total_source']}======={$data['no_total_source']}");
621
+            // log::info("====spread_info_yhc=={$data['total_source']}======={$data['no_total_source']}");
622
             return app('json')->success($data);
622
             return app('json')->success($data);
623
 
623
 
624
         }
624
         }