Sfoglia il codice sorgente

Merge branch 'master' into huangfamily

family 1 anno fa
parent
commit
3396633f05

+ 209 - 203
app/common/repositories/store/order/StoreOrderRepository.php

@@ -694,7 +694,7 @@ class StoreOrderRepository extends BaseRepository
694 694
 //                         $mer_money += $moneys - $total_extension_one - $souxufees;
695 695
 //                         if ($cartInfo['mer_id'] == 290) {
696 696
 //                             $moneys = bcsub($moneys, $souxufees, 3);
697
-//                             $moneys = round($moneys, 2);
697
+//                             $moneys = round($moneys, 2); 
698 698
 //                             $total_extension_one = bcmul($moneys, '0.52', 3);
699 699
 //                             $total_extension_one = round($total_extension_one, 2);
700 700
 //                             $mer_money = bcmul($moneys, '0.40', 3);
@@ -1025,7 +1025,7 @@ class StoreOrderRepository extends BaseRepository
1025 1025
                                 $le_yw_amount = 600;
1026 1026
                             }
1027 1027
 
1028
-                            $ylj_pri = round($pv * 0.035, 2);
1028
+                            $ylj_pri = bcmul($pv, 0.035, 2);
1029 1029
                             //$pv = round($pv * 0.35,2);
1030 1030
 
1031 1031
                             //分配养老金给消费者
@@ -2233,7 +2233,7 @@ class StoreOrderRepository extends BaseRepository
2233 2233
 
2234 2234
             if ($store_product_datas['mer_id'] == 496) {
2235 2235
 
2236
-                $yanglao = round($num_yl * 0.035, 2);//给预下订单中的商品展示 养老金 显示作用
2236
+                $yanglao = bcmul($num_yl, 0.035, 2);//给预下订单中的商品展示 养老金 显示作用
2237 2237
                 $cartInfo['list'][$_k]['yanglao'] = $yanglao;
2238 2238
                 $pv = $num_yl;
2239 2239
                 //$v['vr']=$v['price'];
@@ -2241,7 +2241,7 @@ class StoreOrderRepository extends BaseRepository
2241 2241
 
2242 2242
 
2243 2243
                 //throw new ValidateException($user_datas['vr']);
2244
-                if ($uid == 7 || $uid == 669 || $uid == 670 || $uid == 783 || $uid == 873 || $uid == 766 || $uid == 17 || $uid == 26) {
2244
+                // if ($uid == 7 || $uid == 669 || $uid == 670 || $uid == 783 || $uid == 873 || $uid == 766 || $uid == 17 || $uid == 26) {
2245 2245
                     //如果选择组合支付,查询当前用户名下的VR
2246 2246
                     $user_datas = Db::name('user')->where('uid', $uid)->find();
2247 2247
 
@@ -2273,38 +2273,38 @@ class StoreOrderRepository extends BaseRepository
2273 2273
                     }
2274 2274
 
2275 2275
 
2276
-                } else {
2277
-                    $cartInfo['list'][$_k]['fzone_paytype'] = [
2276
+                // } else {
2277
+                //     $cartInfo['list'][$_k]['fzone_paytype'] = [
2278 2278
 
2279
-                        ['type' => 'a1', 'price' => $orderpri, 'other' => 0, 'note' => "VR"],//VR支付
2280
-                        ['type' => 'a2', 'price' => $orderpri, 'other' => 0, 'note' => "现金"],//现金支付
2281
-                        // ['type'=>'a3','price'=>$orderpri,'other'=>0,'note'=>"现金+VR"],//现金支付
2282
-                    ];
2283
-                }
2279
+                //         ['type' => 'a1', 'price' => $orderpri, 'other' => 0, 'note' => "VR"],//VR支付
2280
+                //         ['type' => 'a2', 'price' => $orderpri, 'other' => 0, 'note' => "现金"],//现金支付
2281
+                //         // ['type'=>'a3','price'=>$orderpri,'other'=>0,'note'=>"现金+VR"],//现金支付
2282
+                //     ];
2283
+                // }
2284 2284
 
2285 2285
 
2286 2286
             } else if ($store_product_datas['mer_id'] == 439) {
2287 2287
 
2288 2288
 
2289 2289
                 //精彩生活和商贸区
2290
-                $jf = $orderpri - round($store_product_datas['concession_pri'] * 0.3, 2) . ' + ' . round($store_product_datas['concession_pri'] * 0.3, 2);
2291
-                $jd = $orderpri - round($store_product_datas['concession_pri'] * 0.35, 2) . ' + ' . round($store_product_datas['concession_pri'] * 0.35, 2);
2290
+                $jf = $orderpri - bcmul($store_product_datas['concession_pri'], 0.3, 2) . ' + ' . bcmul($store_product_datas['concession_pri'], 0.3, 2);
2291
+                $jd = $orderpri - bcmul($store_product_datas['concession_pri'], 0.35, 2) . ' + ' . bcmul($store_product_datas['concession_pri'], 0.35, 2);
2292 2292
                 if ($store_product_datas['concession_pri'] != null || $store_product_datas['concession_pri'] != 0) {
2293
-                    $yanglao = round($store_product_datas['concession_pri'] * 0.3, 2);
2294
-                    $pv = round($store_product_datas['concession_pri'] * 0.35, 2);
2293
+                    $yanglao = bcmul($store_product_datas['concession_pri'], 0.3, 2);
2294
+                    $pv = bcmul($store_product_datas['concession_pri'], 0.35, 2);
2295 2295
                     $srtArry['jfduihuan'] = $jf;
2296 2296
                     $srtArry['jdduihuan'] = $jd;
2297
-                    $jifen = round($store_product_datas['concession_pri'] * 0.35, 2);
2298
-                    $gongxian = round($store_product_datas['concession_pri'] * 0.35, 2);
2299
-
2300
-                    $jcvr = round($orderpri - round($store_product_datas['concession_pri'] * 0.3, 2), 2);
2301
-                    $jcjf = round($store_product_datas['concession_pri'] * 0.3, 2);
2302
-                    $jcprice = round($orderpri - round($store_product_datas['concession_pri'] * 0.3, 2), 2);
2303
-                    $jcjf1 = round($store_product_datas['concession_pri'] * 0.3, 2);
2304
-                    $jcvr1 = round($orderpri - round($store_product_datas['concession_pri'] * 0.35, 2), 2);
2305
-                    $jcjd = round($store_product_datas['concession_pri'] * 0.35, 2);
2306
-                    $jcprice1 = round($orderpri - round($store_product_datas['concession_pri'] * 0.35, 2), 2);
2307
-                    $jcjd1 = round($store_product_datas['concession_pri'] * 0.35, 2);
2297
+                    $jifen = bcmul($store_product_datas['concession_pri'], 0.35, 2);
2298
+                    $gongxian = bcmul($store_product_datas['concession_pri'], 0.35, 2);
2299
+
2300
+                    $jcvr = bcsub($orderpri, bcmul($store_product_datas['concession_pri'], 0.3, 2), 2);
2301
+                    $jcjf = bcmul($store_product_datas['concession_pri'], 0.3, 2);
2302
+                    $jcprice = bcsub($orderpri, bcmul($store_product_datas['concession_pri'], 0.3, 2), 2);
2303
+                    $jcjf1 = bcmul($store_product_datas['concession_pri'], 0.3, 2);
2304
+                    $jcvr1 = bcsub($orderpri, bcmul($store_product_datas['concession_pri'], 0.35, 2), 2);
2305
+                    $jcjd = bcmul($store_product_datas['concession_pri'], 0.35, 2);
2306
+                    $jcprice1 = bcsub($orderpri, bcmul($store_product_datas['concession_pri'], 0.35, 2), 2);
2307
+                    $jcjd1 = bcmul($store_product_datas['concession_pri'], 0.35, 2);
2308 2308
 
2309 2309
                     //var_dump($cartInfo['list'][$_k]);
2310 2310
                     //支付组合
@@ -2346,8 +2346,8 @@ class StoreOrderRepository extends BaseRepository
2346 2346
 //                $productSku = Db::name('store_product_attr_value')->where('product_id', $good_id)->order('price asc')->find();
2347 2347
 //                $pv = $productSku['plate_mer_profit']??0.00;
2348 2348
                 //复购区
2349
-                $pv = round($orderpri * 0.3, 2);
2350
-                $yanglao = round($pv * 0.5, 2);//给预下订单中的商品展示 养老金 显示作用
2349
+                $pv = bcmul($orderpri, 0.3, 2);
2350
+                $yanglao = bcmul($pv, 0.5, 2);//给预下订单中的商品展示 养老金 显示作用
2351 2351
                 $cartInfo['list'][$_k]['pv'] = $pv;
2352 2352
                 $cartInfo['list'][$_k]['yanglao'] = $yanglao;
2353 2353
 
@@ -2362,24 +2362,24 @@ class StoreOrderRepository extends BaseRepository
2362 2362
                 $tmpMerchantInfo = $merchant->get($store_product_datas['mer_id']);
2363 2363
                 // 1企业2个体3个人
2364 2364
                 if ($tmpMerchantInfo && in_array($tmpMerchantInfo['type'], [2, 3])) {
2365
-                    $jf = $orderpri - round($store_product_datas['concession_pri'] * 0.3, 2) . ' + ' . round($store_product_datas['concession_pri'] * 0.3, 2);
2366
-                    $jd = $orderpri - round($store_product_datas['concession_pri'] * 0.35, 2) . ' + ' . round($store_product_datas['concession_pri'] * 0.35, 2);
2365
+                    $jf = $orderpri - bcmul($store_product_datas['concession_pri'], 0.3, 2) . ' + ' . bcmul($store_product_datas['concession_pri'], 0.3, 2);
2366
+                    $jd = $orderpri - bcmul($store_product_datas['concession_pri'], 0.35, 2) . ' + ' . bcmul($store_product_datas['concession_pri'], 0.35, 2);
2367 2367
                     if ($store_product_datas['concession_pri'] != null || $store_product_datas['concession_pri'] != 0) {
2368
-                        $yanglao = round($store_product_datas['concession_pri'] * 0.3, 2);
2369
-                        $pv = round($store_product_datas['concession_pri'] * 0.35, 2);
2368
+                        $yanglao = bcmul($store_product_datas['concession_pri'], 0.3, 2);
2369
+                        $pv = bcmul($store_product_datas['concession_pri'], 0.35, 2);
2370 2370
                         $srtArry['jfduihuan'] = $jf;
2371 2371
                         $srtArry['jdduihuan'] = $jd;
2372
-                        $jifen = round($store_product_datas['concession_pri'] * 0.35, 2);
2373
-                        $gongxian = round($store_product_datas['concession_pri'] * 0.35, 2);
2374
-
2375
-                        $jcvr = round($orderpri - round($store_product_datas['concession_pri'] * 0.3, 2), 2);
2376
-                        $jcjf = round($store_product_datas['concession_pri'] * 0.3, 2);
2377
-                        $jcprice = round($orderpri - round($store_product_datas['concession_pri'] * 0.3, 2), 2);
2378
-                        $jcjf1 = round($store_product_datas['concession_pri'] * 0.3, 2);
2379
-                        $jcvr1 = round($orderpri - round($store_product_datas['concession_pri'] * 0.35, 2), 2);
2380
-                        $jcjd = round($store_product_datas['concession_pri'] * 0.35, 2);
2381
-                        $jcprice1 = round($orderpri - round($store_product_datas['concession_pri'] * 0.35, 2), 2);
2382
-                        $jcjd1 = round($store_product_datas['concession_pri'] * 0.35, 2);
2372
+                        $jifen = bcmul($store_product_datas['concession_pri'], 0.35, 2);
2373
+                        $gongxian = bcmul($store_product_datas['concession_pri'], 0.35, 2);
2374
+
2375
+                        $jcvr = bcsub($orderpri, bcmul($store_product_datas['concession_pri'], 0.3, 2), 2);
2376
+                        $jcjf = bcmul($store_product_datas['concession_pri'], 0.3, 2);
2377
+                        $jcprice = bcsub($orderpri, bcmul($store_product_datas['concession_pri'], 0.3, 2), 2);
2378
+                        $jcjf1 = bcmul($store_product_datas['concession_pri'], 0.3, 2);
2379
+                        $jcvr1 = bcsub($orderpri, bcmul($store_product_datas['concession_pri'], 0.35, 2), 2);
2380
+                        $jcjd = bcmul($store_product_datas['concession_pri'], 0.35, 2);
2381
+                        $jcprice1 = bcsub($orderpri, bcmul($store_product_datas['concession_pri'], 0.35, 2), 2);
2382
+                        $jcjd1 = bcmul($store_product_datas['concession_pri'], 0.35, 2);
2383 2383
 
2384 2384
                         //var_dump($cartInfo['list'][$_k]);
2385 2385
                         //支付组合
@@ -3725,7 +3725,7 @@ class StoreOrderRepository extends BaseRepository
3725 3725
 
3726 3726
         $sanfangfenpei = json_decode($systemvalueObj['value'], true);
3727 3727
 
3728
-        $oldagefee = round($order['total_price'] * $sanfangfenpei['yanglaojin'], 2);
3728
+        $oldagefee = bcmul($order['total_price'], $sanfangfenpei['yanglaojin'], 2);
3729 3729
         log::info("++{$order['total_price']}+返回佣金===={$oldagefee}");
3730 3730
         //当前已扣会费总额
3731 3731
 //            $oldagefee = $oldagefee-$dues;
@@ -3745,7 +3745,7 @@ class StoreOrderRepository extends BaseRepository
3745 3745
         // 添加推荐奖励
3746 3746
         log::info("推荐佣金kaishi");
3747 3747
         //推荐养老金添加
3748
-        $pvfee = round($order['total_price'] * $sanfangfenpei['pv'], 2);
3748
+        $pvfee = bcmul($order['total_price'], $sanfangfenpei['pv'], 2);
3749 3749
         $zijiUser = Db::name("user")->where('uid', $order["uid"])->find();
3750 3750
         $sprerdUser = Db::name("user")->where('uid', $zijiUser['spread_uid'])->find();
3751 3751
         //不为空的时候进行添加推荐奖励
@@ -3756,7 +3756,7 @@ class StoreOrderRepository extends BaseRepository
3756 3756
             if ($sprerdUser["user_group"] > 1) {
3757 3757
                 //奖励推荐者养老金
3758 3758
                 //养老金比例是pv佣金的5%
3759
-                $tuiguanyanglaojin = round($pvfee * 0.05, 2);
3759
+                $tuiguanyanglaojin = bcmul($pvfee, 0.05, 2);
3760 3760
                 $tuimark = "推荐消费获得养老金" . $tuiguanyanglaojin;
3761 3761
 
3762 3762
                 //end会费
@@ -3804,7 +3804,7 @@ class StoreOrderRepository extends BaseRepository
3804 3804
                 $yongjinbili = 17;
3805 3805
             }
3806 3806
 
3807
-            $tuiguanyongjin = round($pvfee * $yongjinbili / 100, 2);
3807
+            $tuiguanyongjin = bcmul($pvfee, $yongjinbili / 100, 2);
3808 3808
 
3809 3809
 
3810 3810
             $tuiYongmark = "推荐消费获得佣金" . $tuiguanyongjin;
@@ -3863,7 +3863,7 @@ class StoreOrderRepository extends BaseRepository
3863 3863
         $sanfangfenpei = json_decode($systemvalueObj['value'], true);
3864 3864
 
3865 3865
         // @todo 消费者本人获得复购PV
3866
-        $consumerRepurchaseareaestimateannuity = round($order['total_price'] * $sanfangfenpei['yanglaojin'], 2);
3866
+        $consumerRepurchaseareaestimateannuity = bcmul($order['total_price'], $sanfangfenpei['yanglaojin'], 2);
3867 3867
         log::info("++{$order['total_price']}+返回佣金===={$consumerRepurchaseareaestimateannuity}");
3868 3868
         if ($consumerRepurchaseareaestimateannuity >= 0.01) {
3869 3869
             $this->add_bill(
@@ -3879,7 +3879,7 @@ class StoreOrderRepository extends BaseRepository
3879 3879
         $directThrustUserinfo = User::where('uid', $userinfo["spread_uid"])->find();
3880 3880
         if (!empty($directThrustUserinfo)) {
3881 3881
             // 直推养老金
3882
-            $directThrustEstimateannuity = round($order['total_price'] * $sanfangfenpei['direct_thrust_ratio'], 2);
3882
+            $directThrustEstimateannuity = bcmul($order['total_price'], $sanfangfenpei['direct_thrust_ratio'], 2);
3883 3883
             if ($directThrustEstimateannuity >= 0.01) {
3884 3884
                 $this->add_bill(
3885 3885
                     '养老金', $directThrustEstimateannuity, $directThrustUserinfo["uid"], "复购-直接推广者获得养老金" . $directThrustEstimateannuity,
@@ -3895,7 +3895,7 @@ class StoreOrderRepository extends BaseRepository
3895 3895
             $indirectThrustUserinfo = User::where('uid', $directThrustUserinfo["spread_uid"])->find();
3896 3896
             if (!empty($indirectThrustUserinfo)) {
3897 3897
                 // 间推养老金
3898
-                $indirectThrustEstimateannuity = round($order['total_price'] * $sanfangfenpei['indirect_thrust_ratio'], 2);
3898
+                $indirectThrustEstimateannuity = bcmul($order['total_price'], $sanfangfenpei['indirect_thrust_ratio'], 2);
3899 3899
                 if ($indirectThrustEstimateannuity >= 0.01) {
3900 3900
                     $this->add_bill(
3901 3901
                         '养老金', $indirectThrustEstimateannuity, $indirectThrustUserinfo["uid"], "复购-间接推广者获得养老金" . $indirectThrustEstimateannuity,
@@ -6698,25 +6698,29 @@ class StoreOrderRepository extends BaseRepository
6698 6698
                     }
6699 6699
                     $details = GongApiRequest::order_details($value['douhuomall_order_no']);
6700 6700
                     if (!$details) continue;
6701
-                    $data['supply_type'] = $details['supply_type'];
6701
+
6702
+                    $track = GongApiRequest::order_track($value['douhuomall_order_no']);
6703
+
6704
+                    $data['supply_type'] = $details['supply_type'] ?? 0;
6702 6705
                     $data['delivery_type'] = 1;
6703
-                    $data['delivery_name'] = $details['logistics_company'] ?? '';
6704
-                    $data['delivery_id'] = $details['logistics_number'][0] ?? '';
6706
+                    $data['delivery_name'] = $track['logistics'][0]['logistics_name'] ?? '';
6707
+                    $data['delivery_id'] = $track['logistics'][0]['logistics_code'] ?? '';
6705 6708
                     $data['douhuomall_status'] = $details['status'];
6706 6709
                     if ($data['douhuomall_status'] == 3 && $value['status'] < 2) {
6707 6710
 //                        Db::name('log')->insert(['data'=>'微唯宝订单信息确认收货'.$value['order_id'].json_encode($order)]);
6708 6711
                         $data['status'] = 1;
6712
+
6709 6713
                     } elseif ($data['douhuomall_status'] == 4 && ($value['status'] != 3 || $value['status'] != 4 || $value['status'] != 5)) {
6710 6714
                         //微唯宝订单状态已完成,并且平台状态不是已完成,申请退款,已退款
6711 6715
                         $data['status'] = 2;
6712 6716
                     } else {
6713 6717
                         $data['status'] = $value['status'];
6714
-                    }
6718
+                    }  
6715 6719
                     Db::name('store_order')->where('order_sn', $value['order_sn'])->update($data);
6716 6720
                     $s = [
6717 6721
                         'order_id' => $value['order_id'],
6718 6722
                         'douhuomall_order_no' => $value['douhuomall_order_no'],
6719
-                        'supply_type' => $details['supply_type'],
6723
+                        'supply_type' => $details['supply_type'] ?? 0,
6720 6724
                         'douhuomall_status' => $details['status']
6721 6725
                     ];
6722 6726
                     $this->douhuomall_order_s($value['douhuomall_order_no'], $s);
@@ -6754,9 +6758,10 @@ class StoreOrderRepository extends BaseRepository
6754 6758
 //            }
6755 6759
 //            $this -> dou_dc();
6756 6760
             Db::name('log')->insert(['data' => '微唯宝订单信息查询执行成功' . $i]);
6757
-
6761
+            echo '微唯宝订单信息查询执行成功';
6758 6762
         } catch (Exception $e) {
6759 6763
             Db::name('log')->insert(['data' => '供应链订单信息:' . $e->getFile() . ':' . $e->getLine() . '【' . $e->getMessage() . '】']);
6764
+            echo $e->getFile() . ':' . $e->getLine() . '【' . $e->getMessage() . '】';
6760 6765
         }
6761 6766
     }
6762 6767
 
@@ -9225,7 +9230,7 @@ class StoreOrderRepository extends BaseRepository
9225 9230
 
9226 9231
 
9227 9232
     //添加贡献值日志
9228
-    public function con_log($uid, $num, $order_id, $order_type, $mark, $status = -1)
9233
+    public function con_log($uid, $num, $order_id, $order_type, $mark, $status = -1, $pv = 0)
9229 9234
     {
9230 9235
 
9231 9236
         $con_data = Db::name('user')->where("uid", $uid)->find();
@@ -9233,7 +9238,7 @@ class StoreOrderRepository extends BaseRepository
9233 9238
         if ($status == 1) {
9234 9239
             //$con_data_gongxian = Db::name('user')->where("uid", $uid)->update(['contribute' => $con_data['contribute'] + $num]);
9235 9240
             //如果当前用户是业务经理之前的等级,那么需要将当前用户的直推用户贡献值加到自己贡献值中去
9236
-            if ($con_data['user_group'] <= 2) {
9241
+            // if ($con_data['user_group'] <= 2) {
9237 9242
 
9238 9243
                 $spread_data = Db::name('user')->where("spread_uid", $uid)->select();
9239 9244
 
@@ -9283,24 +9288,25 @@ class StoreOrderRepository extends BaseRepository
9283 9288
 
9284 9289
                 // }
9285 9290
 
9286
-            } else {
9291
+            // } else {
9287 9292
 
9288
-                // 检查是否包含“推广”
9289
-                // if (strpos($mark, "推广") !== false) {
9290
-                //     echo "字符串1包含'推广'\n";
9291
-                // }
9293
+            //     // 检查是否包含“推广”
9294
+            //     // if (strpos($mark, "推广") !== false) {
9295
+            //     //     echo "字符串1包含'推广'\n";
9296
+            //     // }
9292 9297
 
9293
-                // 检查是否包含“购买”
9294
-                if (strpos($mark, "购买") !== false) {
9295
-                    Db::name('user')->where("uid", $uid)->update(['contribute' => $con_data['contribute'] + $num]);
9296
-                }
9298
+            //     // 检查是否包含“购买”
9299
+            //     if (strpos($mark, "购买") !== false) {
9300
+            //         Db::name('user')->where("uid", $uid)->update(['contribute' => $con_data['contribute'] + $num]);
9301
+            //     }
9297 9302
 
9298 9303
 
9299
-            }
9304
+            // }
9300 9305
         }
9301 9306
 
9302 9307
         $con = [
9303 9308
             'uid' => $uid,
9309
+            'pv' => $pv,
9304 9310
             'number' => $num,//赠送数量
9305 9311
             'status' => $status,//红包状态
9306 9312
             'mark' => $mark,//备注
@@ -9535,8 +9541,8 @@ class StoreOrderRepository extends BaseRepository
9535 9541
                 $job_par = json_decode($store_order_data['fzone_paytype'], true);
9536 9542
                 //if($job_par['note'] == "现金"){
9537 9543
                 //普通消费者
9538
-                $ylj_pri = round($concession_pri * 0.3, 2);
9539
-                $pv = round($concession_pri * 0.35, 2);
9544
+                $ylj_pri = bcmul($concession_pri, 0.3, 2);
9545
+                $pv = bcmul($concession_pri, 0.35, 2);
9540 9546
 
9541 9547
                 //分配养老金给消费者
9542 9548
                 $ylj_amount_mine = $user_data['annuity'] + $ylj_pri;
@@ -9565,18 +9571,18 @@ class StoreOrderRepository extends BaseRepository
9565 9571
 
9566 9572
                         // //给推广者分配佣金
9567 9573
                         $yj_amount = 0;
9568
-                        $ylj_amount = $spread_data['annuity'] + round($pv * 0.05, 2);
9574
+                        $ylj_amount = $spread_data['annuity'] + bcmul($pv, 0.05, 2);
9569 9575
                         $ssf = 0;//变量
9570 9576
                         $yj_amount_90 = 0;//90%的佣金
9571 9577
 
9572 9578
                         if ($spread_data['user_group'] == 2) {
9573
-                            $ssf = round($pv * $rate, 2);
9574
-                            $con = $spread_data['contribute'] + round($pv * $rate, 2);
9575
-                            $score = $spread_data['score'] + round($pv * $rate, 2);
9579
+                            $ssf = bcmul($pv, $rate, 2);
9580
+                            $con = $spread_data['contribute'] + bcmul($pv, $rate, 2);
9581
+                            $score = $spread_data['score'] + bcmul($pv, $rate, 2);
9576 9582
 
9577 9583
 
9578
-                            $yj_amount_90 = round($pv * $rate, 2) * 0.9;
9579
-                            $fgj_amount_10 = round($pv * $rate, 2) * 0.1;//推广者的佣金抽10%到个人复购金
9584
+                            $yj_amount_90 = bcmul($pv, $rate, 2) * 0.9;
9585
+                            $fgj_amount_10 = bcmul($pv, $rate, 2) * 0.1;//推广者的佣金抽10%到个人复购金
9580 9586
 
9581 9587
                             $yj_amount = $spread_data['brokerage_price'] + $yj_amount_90;
9582 9588
                             $fgj_amount = $spread_data['fugou'] + $fgj_amount_10;
@@ -9585,12 +9591,12 @@ class StoreOrderRepository extends BaseRepository
9585 9591
 
9586 9592
                             // Db::name('user')->where('uid',$spread_data['uid'])->update(['contribute'=> $con,'score'=> $score,'brokerage_price'=> $yj_amount,'annuity'=>$ylj_amount,'fugou'=>$fgj_amount]);
9587 9593
                         } else if ($spread_data['user_group'] == 3) {
9588
-                            $ssf = round($pv * $rate, 2);
9589
-                            $con = $spread_data['contribute'] + round($pv * $rate, 2);
9590
-                            $score = $spread_data['score'] + round($pv * $rate, 2);
9594
+                            $ssf = bcmul($pv, $rate, 2);
9595
+                            $con = $spread_data['contribute'] + bcmul($pv, $rate, 2);
9596
+                            $score = $spread_data['score'] + bcmul($pv, $rate, 2);
9591 9597
 
9592
-                            $yj_amount_90 = round($pv * $rate, 2) * 0.9;
9593
-                            $fgj_amount_10 = round($pv * $rate, 2) * 0.1;//推广者的佣金抽10%到个人复购金
9598
+                            $yj_amount_90 = bcmul($pv, $rate, 2) * 0.9;
9599
+                            $fgj_amount_10 = bcmul($pv, $rate, 2) * 0.1;//推广者的佣金抽10%到个人复购金
9594 9600
 
9595 9601
                             $yj_amount = $spread_data['brokerage_price'] + $yj_amount_90;
9596 9602
                             $fgj_amount = $spread_data['fugou'] + $fgj_amount_10;
@@ -9598,12 +9604,12 @@ class StoreOrderRepository extends BaseRepository
9598 9604
 
9599 9605
                             // Db::name('user')->where('uid',$spread_data['uid'])->update(['contribute'=> $con,'score'=> $score,'brokerage_price'=> $yj_amount,'annuity'=>$ylj_amount,'fugou'=>$fgj_amount]);
9600 9606
                         } else if ($spread_data['user_group'] == 4) {
9601
-                            $ssf = round($pv * $rate, 2);
9602
-                            $con = $spread_data['contribute'] + round($pv * $rate, 2);
9603
-                            $score = $spread_data['score'] + round($pv * $rate, 2);
9607
+                            $ssf = bcmul($pv, $rate, 2);
9608
+                            $con = $spread_data['contribute'] + bcmul($pv, $rate, 2);
9609
+                            $score = $spread_data['score'] + bcmul($pv, $rate, 2);
9604 9610
 
9605
-                            $yj_amount_90 = round($pv * $rate, 2) * 0.9;
9606
-                            $fgj_amount_10 = round($pv * $rate, 2) * 0.1;//推广者的佣金抽10%到个人复购金
9611
+                            $yj_amount_90 = bcmul($pv, $rate, 2) * 0.9;
9612
+                            $fgj_amount_10 = bcmul($pv, $rate, 2) * 0.1;//推广者的佣金抽10%到个人复购金
9607 9613
 
9608 9614
                             $yj_amount = $spread_data['brokerage_price'] + $yj_amount_90;
9609 9615
                             $fgj_amount = $spread_data['fugou'] + $fgj_amount_10;
@@ -9611,13 +9617,13 @@ class StoreOrderRepository extends BaseRepository
9611 9617
 
9612 9618
                             //Db::name('user')->where('uid',$spread_data['uid'])->update(['contribute'=> $con,'score'=> $score,'brokerage_price'=> $yj_amount,'annuity'=>$ylj_amount,'fugou'=>$fgj_amount]);
9613 9619
                         } else if ($spread_data['user_group'] == 5) {
9614
-                            $ssf = round($pv * $rate, 2);
9615
-                            $con = $spread_data['contribute'] + round($pv * $rate, 2);
9616
-                            $score = $spread_data['score'] + round($pv * $rate, 2);
9620
+                            $ssf = bcmul($pv, $rate, 2);
9621
+                            $con = $spread_data['contribute'] + bcmul($pv, $rate, 2);
9622
+                            $score = $spread_data['score'] + bcmul($pv, $rate, 2);
9617 9623
                             // $yj_amount = $spread_data['brokerage_price'] + round($pv * $rate,2);
9618 9624
 
9619
-                            $yj_amount_90 = round($pv * $rate, 2) * 0.9;
9620
-                            $fgj_amount_10 = round($pv * $rate, 2) * 0.1;//推广者的佣金抽10%到个人复购金
9625
+                            $yj_amount_90 = bcmul($pv, $rate, 2) * 0.9;
9626
+                            $fgj_amount_10 = bcmul($pv, $rate, 2) * 0.1;//推广者的佣金抽10%到个人复购金
9621 9627
 
9622 9628
                             $yj_amount = $spread_data['brokerage_price'] + $yj_amount_90;
9623 9629
                             $fgj_amount = $spread_data['fugou'] + $fgj_amount_10;
@@ -9625,12 +9631,12 @@ class StoreOrderRepository extends BaseRepository
9625 9631
 
9626 9632
                             // Db::name('user')->where('uid',$spread_data['uid'])->update(['contribute'=> $con,'score'=> $score,'brokerage_price'=> $yj_amount,'annuity'=>$ylj_amount,'fugou'=>$fgj_amount]);
9627 9633
                         } else if ($spread_data['user_group'] == 6) {
9628
-                            $ssf = round($pv * $rate, 2);
9629
-                            $con = $spread_data['contribute'] + round($pv * $rate, 2);
9630
-                            $score = $spread_data['score'] + round($pv * $rate, 2);
9634
+                            $ssf = bcmul($pv, $rate, 2);
9635
+                            $con = $spread_data['contribute'] + bcmul($pv, $rate, 2);
9636
+                            $score = $spread_data['score'] + bcmul($pv, $rate, 2);
9631 9637
 
9632
-                            $yj_amount_90 = round($pv * $rate, 2) * 0.9;
9633
-                            $fgj_amount_10 = round($pv * $rate, 2) * 0.1;//推广者的佣金抽10%到个人复购金
9638
+                            $yj_amount_90 = bcmul($pv, $rate, 2) * 0.9;
9639
+                            $fgj_amount_10 = bcmul($pv, $rate, 2) * 0.1;//推广者的佣金抽10%到个人复购金
9634 9640
 
9635 9641
                             $yj_amount = $spread_data['brokerage_price'] + $yj_amount_90;
9636 9642
                             $fgj_amount = $spread_data['fugou'] + $fgj_amount_10;
@@ -9638,13 +9644,13 @@ class StoreOrderRepository extends BaseRepository
9638 9644
 
9639 9645
                             // Db::name('user')->where('uid',$spread_data['uid'])->update(['contribute'=> $con,'score'=> $score,'brokerage_price'=> $yj_amount,'annuity'=>$ylj_amount,'fugou'=>$fgj_amount]);
9640 9646
                         } else if ($spread_data['user_group'] == 7) {
9641
-                            $ssf = round($pv * $rate, 2);
9642
-                            $con = $spread_data['contribute'] + round($pv * $rate, 2);
9643
-                            $score = $spread_data['score'] + round($pv * $rate, 2);
9647
+                            $ssf = bcmul($pv, $rate, 2);
9648
+                            $con = $spread_data['contribute'] + bcmul($pv, $rate, 2);
9649
+                            $score = $spread_data['score'] + bcmul($pv, $rate, 2);
9644 9650
 
9645 9651
 
9646
-                            $yj_amount_90 = round($pv * $rate, 2) * 0.9;
9647
-                            $fgj_amount_10 = round($pv * $rate, 2) * 0.1;//推广者的佣金抽10%到个人复购金
9652
+                            $yj_amount_90 = bcmul($pv, $rate, 2) * 0.9;
9653
+                            $fgj_amount_10 = bcmul($pv, $rate, 2) * 0.1;//推广者的佣金抽10%到个人复购金
9648 9654
 
9649 9655
                             $yj_amount = $spread_data['brokerage_price'] + $yj_amount_90;
9650 9656
                             $fgj_amount = $spread_data['fugou'] + $fgj_amount_10;
@@ -9658,17 +9664,17 @@ class StoreOrderRepository extends BaseRepository
9658 9664
                         //积分
9659 9665
                         $this->score_log($spread_data['uid'], $ssf, $store_order_data['order_id'], 11, "精彩生活区商品赠送积分");
9660 9666
                         // //推广佣金
9661
-                        $this->bill_user_log($spread_data['uid'], $yj_amount_90, $store_order_data['order_id'], 3, $store_order_data['order_sn'], '推广获得金' . $yj_amount_90, $store_order_data['mer_id'], 0);
9667
+                        $this->bill_user_log($spread_data['uid'], $yj_amount_90, $store_order_data['order_id'], 3, $store_order_data['order_sn'], '推广获得金' . $yj_amount_90, $store_order_data['mer_id'], 0);
9662 9668
                         //养老金
9663
-                        $this->bill_user_log($spread_data['uid'], round($pv * 0.05, 2), $store_order_data['order_id'], 5, $store_order_data['order_sn'], '推广获得养老金' . round($pv * 0.05, 2), $store_order_data['mer_id'], 0);
9669
+                        $this->bill_user_log($spread_data['uid'], bcmul($pv, 0.05, 2), $store_order_data['order_id'], 5, $store_order_data['order_sn'], '推广获得养老金' . bcmul($pv, 0.05, 2), $store_order_data['mer_id'], 0);
9664 9670
                     }
9665 9671
 
9666 9672
                     //普通用户推广人
9667 9673
                     if ($spread_data['user_group'] == 1) {
9668 9674
                         //给推广者分配佣金
9669 9675
 
9670
-                        $yj_amount_90 = round($pv * $rate, 2) * 0.9;
9671
-                        $fgj_amount_10 = round($pv * $rate, 2) * 0.1;//推广者的佣金抽10%到个人复购金
9676
+                        $yj_amount_90 = bcmul($pv, $rate, 2) * 0.9;
9677
+                        $fgj_amount_10 = bcmul($pv, $rate, 2) * 0.1;//推广者的佣金抽10%到个人复购金
9672 9678
 
9673 9679
                         $yj_amount = $spread_data['brokerage_price'] + $yj_amount_90;
9674 9680
                         $fgj_amount = $spread_data['fugou'] + $fgj_amount_10;
@@ -9676,19 +9682,19 @@ class StoreOrderRepository extends BaseRepository
9676 9682
 
9677 9683
                         //Db::name('user')->where('uid',$spread_data['uid'])->update(['brokerage_price'=>$yj_amount,'fugou'=>$fgj_amount]);
9678 9684
 
9679
-                        $con = $spread_data['contribute'] + round($pv * $rate, 2);
9680
-                        $score = $spread_data['score'] + round($pv * $rate, 2);
9685
+                        $con = $spread_data['contribute'] + bcmul($pv, $rate, 2);
9686
+                        $score = $spread_data['score'] + bcmul($pv, $rate, 2);
9681 9687
 
9682 9688
                         //贡献值和积分
9683 9689
                         // Db::name('user')->where('uid',$spread_data['uid'])->update(["contribute"=>$con,"score"=>$score]);
9684 9690
 
9685 9691
                         //推广养老金
9686 9692
                         //推广佣金
9687
-                        $this->bill_user_log($spread_data['uid'], $yj_amount_90, $store_order_data['order_id'], 3, $store_order_data['order_sn'], '推广获得金' . $yj_amount_90, $store_order_data['mer_id'], 0);
9693
+                        $this->bill_user_log($spread_data['uid'], $yj_amount_90, $store_order_data['order_id'], 3, $store_order_data['order_sn'], '推广获得金' . $yj_amount_90, $store_order_data['mer_id'], 0);
9688 9694
                         // 贡献值
9689
-                        $this->con_log($spread_data['uid'], $pv, $store_order_data['order_id'], 11, "推广会员专区商品赠送贡献值");
9695
+                        $this->con_log($spread_data['uid'], $pv, $store_order_data['order_id'], 11, "推广会员专区商品赠送贡献值", 1, $pv);
9690 9696
                         //积分
9691
-                        $this->score_log($spread_data['uid'], round($pv * $rate, 2), $store_order_data['order_id'], 11, "推广会员专区商品赠送积分");
9697
+                        $this->score_log($spread_data['uid'], bcmul($pv, $rate, 2), $store_order_data['order_id'], 11, "推广会员专区商品赠送积分");
9692 9698
                     }
9693 9699
                 }
9694 9700
 
@@ -9703,8 +9709,8 @@ class StoreOrderRepository extends BaseRepository
9703 9709
 
9704 9710
                         //给推广者分配佣金
9705 9711
 
9706
-                        $yj_amount_90 = round($pv * 0.05, 2) * 0.9;
9707
-                        $fgj_amount_10 = round($pv * 0.05, 2) * 0.1;//推广者的佣金抽10%到个人复购金
9712
+                        $yj_amount_90 = bcmul($pv, 0.05, 2) * 0.9;
9713
+                        $fgj_amount_10 = bcmul($pv, 0.05, 2) * 0.1;//推广者的佣金抽10%到个人复购金
9708 9714
 
9709 9715
                         // $yj_amount = $merchant_user_data['brokerage_price'] + $yj_amount_90;
9710 9716
                         // $fgj_amount = $merchant_user_data['fugou'] + $fgj_amount_10;
@@ -9713,7 +9719,7 @@ class StoreOrderRepository extends BaseRepository
9713 9719
 
9714 9720
                         // Db::name('user')->where('uid',$merchant_data['uid'])->update(['brokerage_price'=>$yj_amount,'fugou'=>$fgj_amount]);
9715 9721
                         //推广佣金
9716
-                        $this->bill_user_log($merchant_data['uid'], $yj_amount_90, $store_order_data['order_id'], 3, $store_order_data['order_sn'], '推广获得金' . $yj_amount_90, $store_order_data['mer_id'], 0);
9722
+                        $this->bill_user_log($merchant_data['uid'], $yj_amount_90, $store_order_data['order_id'], 3, $store_order_data['order_sn'], '推广获得金' . $yj_amount_90, $store_order_data['mer_id'], 0);
9717 9723
 
9718 9724
                     }
9719 9725
 
@@ -9755,7 +9761,7 @@ class StoreOrderRepository extends BaseRepository
9755 9761
                 $le_yw_amount = 600;
9756 9762
             }
9757 9763
 
9758
-            $ylj_pri = round($pv * 0.035, 2);
9764
+            $ylj_pri = bcmul($pv, 0.035, 2);
9759 9765
             //$pv = round($pv * 0.35,2);
9760 9766
 
9761 9767
             //分配养老金给消费者
@@ -9767,8 +9773,8 @@ class StoreOrderRepository extends BaseRepository
9767 9773
 
9768 9774
             // Db::name('user')->where('uid',$user_data['uid'])->update(['annuity'=>$ylj_amount_mine,'contribute'=> $gxz_amount_mine,'score'=> $jf_amount_mine]);
9769 9775
 
9770
-            $this->bill_user_log($user_data['uid'], round($pv * 0.035, 2), $store_order_data['order_id'], 5, $store_order_data['order_sn'], '消费获得养老金' . round($pv * 0.035, 2), $store_order_data['mer_id']);
9771
-            $this->con_log($user_data['uid'], $gx_jf, $store_order_data['order_id'], 11, "购买会员专区商品赠送贡献值", 1);
9776
+            $this->bill_user_log($user_data['uid'], bcmul($pv, 0.035, 2), $store_order_data['order_id'], 5, $store_order_data['order_sn'], '消费获得养老金' . bcmul($pv, 0.035, 2), $store_order_data['mer_id']);
9777
+            $this->con_log($user_data['uid'], $gx_jf, $store_order_data['order_id'], 11, "购买会员专区商品赠送贡献值", 1, $pv);
9772 9778
             $this->score_log($user_data['uid'], $gx_jf, $store_order_data['order_id'], 11, "购买会员专区商品赠送积分", 1);
9773 9779
 
9774 9780
             //查询下单用户上级身份(2.0新表用户)
@@ -9799,7 +9805,7 @@ class StoreOrderRepository extends BaseRepository
9799 9805
                     $con = 0;//贡献值
9800 9806
                     $score = 0;//积分
9801 9807
                     //养老金
9802
-                    $uer_bill = $spread_data['annuity'] + round($pv * 0.035, 2);
9808
+                    $uer_bill = $spread_data['annuity'] + bcmul($pv, 0.035, 2);
9803 9809
                     //$yongjin = $spread_data['brokerage_price'] + $le_yw_amount;
9804 9810
 
9805 9811
                     $yj_amount_90 = $le_yw_amount * 0.9;
@@ -9811,80 +9817,80 @@ class StoreOrderRepository extends BaseRepository
9811 9817
 
9812 9818
                     if ($spread_data['user_group'] == 2) {
9813 9819
 
9814
-                        $con = $spread_data['contribute'] + round($pv * 0.07, 2);
9815
-                        $score = $spread_data['brokerage_price'] + round($pv * 0.07, 2);
9820
+                        $con = $spread_data['contribute'] + bcmul($pv, 0.07, 2);
9821
+                        $score = $spread_data['brokerage_price'] + bcmul($pv, 0.07, 2);
9816 9822
                         //  Db::name('user')->where('uid',$spread_data['uid'])->update(['contribute'=> $con,'score'=> $score,'brokerage_price'=> $yongjin,'annuity'=>$uer_bill,"fugou"=> $fgj_amount]);
9817 9823
 
9818 9824
                         //贡献值
9819 9825
                         // $this->con_log($spread_data['uid'],round($pv * 0.07,2),$store_order_data['order_id'],11,"推广会员专区商品赠送贡献值",1);
9820 9826
                         //积分
9821
-                        $this->score_log($spread_data['uid'], round($pv * 0.07, 2), $store_order_data['order_id'], 11, "推广会员专区商品赠送积分", 1);
9827
+                        $this->score_log($spread_data['uid'], bcmul($pv, 0.07, 2), $store_order_data['order_id'], 11, "推广会员专区商品赠送积分", 1);
9822 9828
 
9823 9829
                     } else if ($spread_data['user_group'] == 3) {
9824 9830
 
9825 9831
 
9826
-                        $con = $spread_data['contribute'] + round($pv * 0.09, 2);
9827
-                        $score = $spread_data['brokerage_price'] + round($pv * 0.09, 2);
9832
+                        $con = $spread_data['contribute'] + bcmul($pv, 0.09, 2);
9833
+                        $score = $spread_data['brokerage_price'] + bcmul($pv, 0.09, 2);
9828 9834
                         // Db::name('user')->where('uid',$spread_data['uid'])->update(['contribute'=> $con,'score'=> $score,'brokerage_price'=> $yongjin,'annuity'=>$uer_bill,"fugou"=> $fgj_amount]);
9829 9835
 
9830 9836
                         //贡献值
9831 9837
                         // $this->con_log($spread_data['uid'],round($pv * 0.09,2),$store_order_data['order_id'],11,"推广会员专区商品赠送贡献值",1);
9832 9838
                         //积分
9833
-                        $this->score_log($spread_data['uid'], round($pv * 0.09, 2), $store_order_data['order_id'], 11, "推广会员专区商品赠送积分", 1);
9839
+                        $this->score_log($spread_data['uid'], bcmul($pv, 0.09, 2), $store_order_data['order_id'], 11, "推广会员专区商品赠送积分", 1);
9834 9840
 
9835 9841
 
9836 9842
                     } else if ($spread_data['user_group'] == 4) {
9837
-                        $con = $spread_data['contribute'] + round($pv * 0.11, 2);
9838
-                        $score = $spread_data['brokerage_price'] + round($pv * 0.11, 2);
9843
+                        $con = $spread_data['contribute'] + bcmul($pv, 0.11, 2);
9844
+                        $score = $spread_data['brokerage_price'] + bcmul($pv, 0.11, 2);
9839 9845
                         // Db::name('user')->where('uid',$spread_data['uid'])->update(['contribute'=> $con,'score'=> $score,'brokerage_price'=> $yongjin,'annuity'=>$uer_bill,"fugou"=> $fgj_amount]);
9840 9846
 
9841 9847
                         //贡献值
9842 9848
                         //$this->con_log($spread_data['uid'],round($pv * 0.11,2),$store_order_data['order_id'],11,"推广会员专区商品赠送贡献值",1);
9843 9849
                         //积分
9844
-                        $this->score_log($spread_data['uid'], round($pv * 0.11, 2), $store_order_data['order_id'], 11, "推广会员专区商品赠送积分", 1);
9850
+                        $this->score_log($spread_data['uid'], bcmul($pv, 0.11, 2), $store_order_data['order_id'], 11, "推广会员专区商品赠送积分", 1);
9845 9851
 
9846 9852
 
9847 9853
                     } else if ($spread_data['user_group'] == 5) {
9848
-                        $con = $spread_data['contribute'] + round($pv * 0.13, 2);
9849
-                        $score = $spread_data['brokerage_price'] + round($pv * 0.13, 2);
9854
+                        $con = $spread_data['contribute'] + bcmul($pv, 0.13, 2);
9855
+                        $score = $spread_data['brokerage_price'] + bcmul($pv, 0.13, 2);
9850 9856
                         // Db::name('user')->where('uid',$spread_data['uid'])->update(['contribute'=> $con,'score'=> $score,'brokerage_price'=> $yongjin,'annuity'=>$uer_bill,"fugou"=> $fgj_amount]);
9851 9857
 
9852 9858
                         //贡献值
9853 9859
                         // $this->con_log($spread_data['uid'],round($pv * 0.13,2),$store_order_data['order_id'],11,"推广会员专区商品赠送贡献值",1);
9854 9860
                         //积分
9855
-                        $this->score_log($spread_data['uid'], round($pv * 0.13, 2), $store_order_data['order_id'], 11, "推广会员专区商品赠送积分", 1);
9861
+                        $this->score_log($spread_data['uid'], bcmul($pv, 0.13, 2), $store_order_data['order_id'], 11, "推广会员专区商品赠送积分", 1);
9856 9862
 
9857 9863
                     } else if ($spread_data['user_group'] == 6) {
9858
-                        $con = $spread_data['contribute'] + round($pv * 0.15, 2);
9859
-                        $score = $spread_data['brokerage_price'] + round($pv * 0.15, 2);
9864
+                        $con = $spread_data['contribute'] + bcmul($pv, 0.15, 2);
9865
+                        $score = $spread_data['brokerage_price'] + bcmul($pv, 0.15, 2);
9860 9866
                         // Db::name('user')->where('uid',$spread_data['uid'])->update(['contribute'=> $con,'score'=> $score,'brokerage_price'=> $yongjin,'annuity'=>$uer_bill,"fugou"=> $fgj_amount]);
9861 9867
 
9862 9868
                         //贡献值
9863 9869
                         // $this->con_log($spread_data['uid'],round($pv * 0.15,2),$store_order_data['order_id'],11,"推广会员专区商品赠送贡献值",1);
9864 9870
                         //积分
9865
-                        $this->score_log($spread_data['uid'], round($pv * 0.15, 2), $store_order_data['order_id'], 11, "推广会员专区商品赠送积分", 1);
9871
+                        $this->score_log($spread_data['uid'], bcmul($pv, 0.15, 2), $store_order_data['order_id'], 11, "推广会员专区商品赠送积分", 1);
9866 9872
 
9867 9873
 
9868 9874
                     } else if ($spread_data['user_group'] == 7) {
9869
-                        $con = $spread_data['contribute'] + round($pv * 0.17, 2);
9870
-                        $score = $spread_data['brokerage_price'] + round($pv * 0.17, 2);
9875
+                        $con = $spread_data['contribute'] + bcmul($pv, 0.17, 2);
9876
+                        $score = $spread_data['brokerage_price'] + bcmul($pv, 0.17, 2);
9871 9877
                         // Db::name('user')->where('uid',$spread_data['uid'])->update(['contribute'=> $con,'score'=> $score,'brokerage_price'=> $yongjin,'annuity'=>$uer_bill,"fugou"=> $fgj_amount]);
9872 9878
 
9873 9879
                         //贡献值
9874 9880
                         //$this->con_log($spread_data['uid'],round($pv * 0.17,2),$store_order_data['order_id'],11,"推广会员专区商品赠送贡献值",1);
9875 9881
                         //积分
9876
-                        $this->score_log($spread_data['uid'], round($pv * 0.17, 2), $store_order_data['order_id'], 11, "推广会员专区商品赠送积分", 1);
9882
+                        $this->score_log($spread_data['uid'], bcmul($pv, 0.17, 2), $store_order_data['order_id'], 11, "推广会员专区商品赠送积分", 1);
9877 9883
 
9878 9884
 
9879 9885
                     }
9880 9886
                     Db::name('test_log')->insert(['note' => "走到这里4"]);//测试
9881 9887
                     //贡献值
9882
-                    $this->con_log($spread_data['uid'], round($gx_jf, 2), $store_order_data['order_id'], 11, "推广会员专区商品赠送贡献值", 1);
9888
+                    $this->con_log($spread_data['uid'], round($gx_jf, 2), $store_order_data['order_id'], 11, "推广会员专区商品赠送贡献值", 1, $pv);
9883 9889
 
9884 9890
                     //养老金
9885
-                    $this->bill_user_log($spread_data['uid'], round($pv * 0.035, 2), $store_order_data['order_id'], 5, $store_order_data['order_sn'], '消费获得养老金' . round($pv * 0.035, 2), $store_order_data['mer_id']);
9891
+                    $this->bill_user_log($spread_data['uid'], bcmul($pv, 0.035, 2), $store_order_data['order_id'], 5, $store_order_data['order_sn'], '消费获得养老金' . round($pv * 0.035, 2), $store_order_data['mer_id']);
9886 9892
                     //佣金
9887
-                    $this->bill_user_log($spread_data['uid'], $yj_amount_90, $store_order_data['order_id'], 3, $store_order_data['order_sn'], '推广获得金' . $yj_amount_90, $store_order_data['mer_id']);
9893
+                    $this->bill_user_log($spread_data['uid'], $yj_amount_90, $store_order_data['order_id'], 3, $store_order_data['order_sn'], '推广获得金' . $yj_amount_90, $store_order_data['mer_id']);
9888 9894
                     //复购金
9889 9895
                     $this->fugou_user_log($spread_data['uid'], $fgj_amount_10, $store_order_data['order_id'], 1, 1);
9890 9896
 
@@ -9894,11 +9900,11 @@ class StoreOrderRepository extends BaseRepository
9894 9900
                 if ($spread_data['user_group'] == 1) {  
9895 9901
 
9896 9902
                     //获取贡献值和积分和佣金
9897
-                    $gx_jf = $spread_data['contribute'] + round($pv * 0.21, 2);
9903
+                    $gx_jf = $spread_data['contribute'] + bcmul($pv, 0.21, 2);
9898 9904
 
9899 9905
 
9900
-                    $yj_amount_90 = round($yj1 * 0.9, 2);
9901
-                    $fgj_amount_10 = round($yj1 * 0.1, 2);//推广者的佣金抽10%到个人复购金
9906
+                    $yj_amount_90 = bcmul($yj1, 0.9, 2);
9907
+                    $fgj_amount_10 = bcmul($yj1, 0.1, 2);//推广者的佣金抽10%到个人复购金
9902 9908
 
9903 9909
                     $yj_amount = $spread_data['brokerage_price'] + $yj_amount_90;
9904 9910
                     $fgj_amount = $spread_data['fugou'] + $fgj_amount_10;
@@ -9906,10 +9912,10 @@ class StoreOrderRepository extends BaseRepository
9906 9912
 
9907 9913
 
9908 9914
                     //Db::name('user')->where('uid',$spread_data['uid'])->update(['contribute'=> $gx_jf,'score'=> $gx_jf,'brokerage_price'=> $yj_amount,'fugou'=>$fgj_amount]);
9909
-                    $this->con_log($spread_data['uid'], round($pv * 0.21, 2), $store_order_data['order_id'], 11, "推广会员专区商品赠送贡献值", 1);
9910
-                    $this->score_log($spread_data['uid'], round($pv * 0.21, 2), $store_order_data['order_id'], 11, "推广会员专区商品赠送积分", 1);
9915
+                    $this->con_log($spread_data['uid'], bcmul($pv, 0.21, 2), $store_order_data['order_id'], 11, "推广会员专区商品赠送贡献值", 1, $pv);
9916
+                    $this->score_log($spread_data['uid'], bcmul($pv, 0.21, 2), $store_order_data['order_id'], 11, "推广会员专区商品赠送积分", 1);
9911 9917
                     //推广佣金
9912
-                    $this->bill_user_log($spread_data['uid'], $yj_amount_90, $store_order_data['order_id'], 3, $store_order_data['order_sn'], '推广获得金' . $yj_amount_90, $store_order_data['mer_id']);
9918
+                    $this->bill_user_log($spread_data['uid'], $yj_amount_90, $store_order_data['order_id'], 3, $store_order_data['order_sn'], '推广获得金' . $yj_amount_90, $store_order_data['mer_id']);
9913 9919
                 }
9914 9920
 
9915 9921
 
@@ -9919,7 +9925,7 @@ class StoreOrderRepository extends BaseRepository
9919 9925
                 $spread_data = Db::name('user')->where('uid', $spread_data_old['id'])->find();
9920 9926
                 //$spread_data = Db::name('user')->where('uid',473)->find();
9921 9927
                 //养老金
9922
-                $uer_bill = $spread_data['annuity'] + round($pv * 0.035, 2);
9928
+                $uer_bill = $spread_data['annuity'] + bcmul($pv, 0.035, 2);
9923 9929
 
9924 9930
 
9925 9931
                 $yj_amount_90 = $le_yw_amount * 0.9;
@@ -9928,11 +9934,11 @@ class StoreOrderRepository extends BaseRepository
9928 9934
                 $yongjin = $spread_data['brokerage_price'] + $yj_amount_90;
9929 9935
                 $fgj_amount = $spread_data['fugou'] + $fgj_amount_10;
9930 9936
 
9931
-                $this->con_log($spread_data['uid'], round($gx_jf, 2), $store_order_data['order_id'], 11, "推广会员专区商品赠送贡献值", 1);
9937
+                $this->con_log($spread_data['uid'], round($gx_jf, 2), $store_order_data['order_id'], 11, "推广会员专区商品赠送贡献值", 1, $pv);
9932 9938
                 //养老金
9933
-                $this->bill_user_log($spread_data['uid'], round($pv * 0.035, 2), $store_order_data['order_id'], 5, $store_order_data['order_sn'], '消费获得养老金' . round($pv * 0.035, 2), $store_order_data['mer_id']);
9939
+                $this->bill_user_log($spread_data['uid'], bcmul($pv, 0.035, 2), $store_order_data['order_id'], 5, $store_order_data['order_sn'], '消费获得养老金' . bcmul($pv, 0.035, 2), $store_order_data['mer_id']);
9934 9940
                 //佣金
9935
-                $this->bill_user_log($spread_data['uid'], $yj_amount_90, $store_order_data['order_id'], 3, $store_order_data['order_sn'], '推广获得金' . $yj_amount_90, $store_order_data['mer_id']);
9941
+                $this->bill_user_log($spread_data['uid'], $yj_amount_90, $store_order_data['order_id'], 3, $store_order_data['order_sn'], '推广获得金' . $yj_amount_90, $store_order_data['mer_id']);
9936 9942
                 //复购金
9937 9943
                 $this->fugou_user_log($spread_data['uid'], $fgj_amount_10, $store_order_data['order_id'], 1, 1);
9938 9944
 
@@ -10004,8 +10010,8 @@ class StoreOrderRepository extends BaseRepository
10004 10010
                 if (!empty($merchant_data) && !empty($merchant_user_data)) {
10005 10011
 
10006 10012
 
10007
-                    $yj_amount_90 = round($pv * 0.035, 2) * 0.9;
10008
-                    $fgj_amount_10 = round($pv * 0.035, 2) * 0.1;//推广者的佣金抽10%到个人复购金
10013
+                    $yj_amount_90 = bcmul($pv , 0.035, 2) * 0.9;
10014
+                    $fgj_amount_10 = bcmul($pv, 0.035, 2) * 0.1;//推广者的佣金抽10%到个人复购金
10009 10015
 
10010 10016
                     $yj_amount = $merchant_user_data['brokerage_price'] + $yj_amount_90;
10011 10017
                     $fgj_amount = $merchant_user_data['fugou'] + $fgj_amount_10;
@@ -10014,7 +10020,7 @@ class StoreOrderRepository extends BaseRepository
10014 10020
 
10015 10021
                     // Db::name('user')->where('uid',$merchant_data['uid'])->update(['brokerage_price'=>$yj_amount,'fugou'=>$fgj_amount]);
10016 10022
                     //推广佣金
10017
-                    $this->bill_user_log($merchant_data['uid'], round($pv * 0.35, 2), $store_order_data['order_id'], 3, $store_order_data['order_sn'], '推广获得拥金' . round($pv * 0.35, 2), $store_order_data['mer_id']);
10023
+                    $this->bill_user_log($merchant_data['uid'], bcmul($pv, 0.35, 2), $store_order_data['order_id'], 3, $store_order_data['order_sn'], '推广获得佣金' . round($pv * 0.35, 2), $store_order_data['mer_id']);
10018 10024
                 }
10019 10025
 
10020 10026
             }
@@ -10054,8 +10060,8 @@ class StoreOrderRepository extends BaseRepository
10054 10060
             // 1企业2个体3个人
10055 10061
             if ($merchantInfo && !empty($store_order_data) && in_array($merchantInfo['type'], [2, 3])) {
10056 10062
                 //商家让利部分的拆分
10057
-                $ylj_pri = round($concession_pri * 0.3, 2); // 让利部分30%给消费者做养老金
10058
-                $pv = round($concession_pri * 0.35, 2); // 35%做业绩PV分配
10063
+                $ylj_pri = bcmul($concession_pri, 0.3, 2); // 让利部分30%给消费者做养老金
10064
+                $pv = bcmul($concession_pri, 0.35, 2); // 35%做业绩PV分配
10059 10065
 
10060 10066
                 //分配养老金给消费者
10061 10067
                 $ylj_amount_mine = $user_data['annuity'] + $ylj_pri;
@@ -10082,24 +10088,24 @@ class StoreOrderRepository extends BaseRepository
10082 10088
                         $yj_amount_90 = 0;//90%的佣金
10083 10089
                         // 业务员
10084 10090
                         if ($spread_data['user_group'] == 2) {
10085
-                            $ssf = round($pv * $rate, 2);
10086
-                            $con = $spread_data['contribute'] + round($pv * $rate, 2);
10087
-                            $score = $spread_data['score'] + round($pv * $rate, 2);
10091
+                            $ssf = bcmul($pv, $rate, 2);
10092
+                            $con = $spread_data['contribute'] + bcmul($pv, $rate, 2);
10093
+                            $score = $spread_data['score'] + bcmul($pv, $rate, 2);
10088 10094
 
10089 10095
 
10090
-                            $yj_amount_90 = round($pv * $rate, 2) * 0.9;
10091
-                            $fgj_amount_10 = round($pv * $rate, 2) * 0.1;//推广者的佣金抽10%到个人复购金
10096
+                            $yj_amount_90 = bcmul($pv, $rate, 2) * 0.9;
10097
+                            $fgj_amount_10 = bcmul($pv, $rate, 2) * 0.1;//推广者的佣金抽10%到个人复购金
10092 10098
 
10093 10099
                             $yj_amount = $spread_data['brokerage_price'] + $yj_amount_90;
10094 10100
                             $fgj_amount = $spread_data['fugou'] + $fgj_amount_10;
10095 10101
                             $this->fugou_user_log($spread_data['uid'], $fgj_amount_10, $store_order_data['order_id'], 1);
10096 10102
                         } else if ($spread_data['user_group'] == 3) {
10097
-                            $ssf = round($pv * $rate, 2);
10098
-                            $con = $spread_data['contribute'] + round($pv * $rate, 2);
10099
-                            $score = $spread_data['score'] + round($pv * $rate, 2);
10103
+                            $ssf = bcmul($pv, $rate, 2);
10104
+                            $con = $spread_data['contribute'] + bcmul($pv, $rate, 2);
10105
+                            $score = $spread_data['score'] + bcmul($pv, $rate, 2);
10100 10106
 
10101
-                            $yj_amount_90 = round($pv * $rate, 2) * 0.9;
10102
-                            $fgj_amount_10 = round($pv * $rate, 2) * 0.1;//推广者的佣金抽10%到个人复购金
10107
+                            $yj_amount_90 = bcmul($pv, $rate, 2) * 0.9;
10108
+                            $fgj_amount_10 = bcmul($pv, $rate, 2) * 0.1;//推广者的佣金抽10%到个人复购金
10103 10109
 
10104 10110
                             $yj_amount = $spread_data['brokerage_price'] + $yj_amount_90;
10105 10111
                             $fgj_amount = $spread_data['fugou'] + $fgj_amount_10;
@@ -10107,12 +10113,12 @@ class StoreOrderRepository extends BaseRepository
10107 10113
 
10108 10114
                             // Db::name('user')->where('uid',$spread_data['uid'])->update(['contribute'=> $con,'score'=> $score,'brokerage_price'=> $yj_amount,'annuity'=>$ylj_amount,'fugou'=>$fgj_amount]);
10109 10115
                         } else if ($spread_data['user_group'] == 4) {
10110
-                            $ssf = round($pv * $rate, 2);
10111
-                            $con = $spread_data['contribute'] + round($pv * $rate, 2);
10112
-                            $score = $spread_data['score'] + round($pv * $rate, 2);
10116
+                            $ssf = bcmul($pv, $rate, 2);
10117
+                            $con = $spread_data['contribute'] + bcmul($pv, $rate, 2);
10118
+                            $score = $spread_data['score'] + bcmul($pv, $rate, 2);
10113 10119
 
10114
-                            $yj_amount_90 = round($pv * $rate, 2) * 0.9;
10115
-                            $fgj_amount_10 = round($pv * $rate, 2) * 0.1;//推广者的佣金抽10%到个人复购金
10120
+                            $yj_amount_90 = bcmul($pv, $rate, 2) * 0.9;
10121
+                            $fgj_amount_10 = bcmul($pv, $rate, 2) * 0.1;//推广者的佣金抽10%到个人复购金
10116 10122
 
10117 10123
                             $yj_amount = $spread_data['brokerage_price'] + $yj_amount_90;
10118 10124
                             $fgj_amount = $spread_data['fugou'] + $fgj_amount_10;
@@ -10120,13 +10126,13 @@ class StoreOrderRepository extends BaseRepository
10120 10126
 
10121 10127
                             //Db::name('user')->where('uid',$spread_data['uid'])->update(['contribute'=> $con,'score'=> $score,'brokerage_price'=> $yj_amount,'annuity'=>$ylj_amount,'fugou'=>$fgj_amount]);
10122 10128
                         } else if ($spread_data['user_group'] == 5) {
10123
-                            $ssf = round($pv * $rate, 2);
10124
-                            $con = $spread_data['contribute'] + round($pv * $rate, 2);
10125
-                            $score = $spread_data['score'] + round($pv * $rate, 2);
10129
+                            $ssf = bcmul($pv, $rate, 2);
10130
+                            $con = $spread_data['contribute'] + bcmul($pv, $rate, 2);
10131
+                            $score = $spread_data['score'] + bcmul($pv, $rate, 2);
10126 10132
                             // $yj_amount = $spread_data['brokerage_price'] + round($pv * $rate,2);
10127 10133
 
10128
-                            $yj_amount_90 = round($pv * $rate, 2) * 0.9;
10129
-                            $fgj_amount_10 = round($pv * $rate, 2) * 0.1;//推广者的佣金抽10%到个人复购金
10134
+                            $yj_amount_90 = bcmul($pv, $rate, 2) * 0.9;
10135
+                            $fgj_amount_10 = bcmul($pv, $rate, 2) * 0.1;//推广者的佣金抽10%到个人复购金
10130 10136
 
10131 10137
                             $yj_amount = $spread_data['brokerage_price'] + $yj_amount_90;
10132 10138
                             $fgj_amount = $spread_data['fugou'] + $fgj_amount_10;
@@ -10134,12 +10140,12 @@ class StoreOrderRepository extends BaseRepository
10134 10140
 
10135 10141
                             // Db::name('user')->where('uid',$spread_data['uid'])->update(['contribute'=> $con,'score'=> $score,'brokerage_price'=> $yj_amount,'annuity'=>$ylj_amount,'fugou'=>$fgj_amount]);
10136 10142
                         } else if ($spread_data['user_group'] == 6) {
10137
-                            $ssf = round($pv * $rate, 2);
10138
-                            $con = $spread_data['contribute'] + round($pv * $rate, 2);
10139
-                            $score = $spread_data['score'] + round($pv * $rate, 2);
10143
+                            $ssf = bcmul($pv, $rate, 2);
10144
+                            $con = $spread_data['contribute'] + bcmul($pv, $rate, 2);
10145
+                            $score = $spread_data['score'] + bcmul($pv, $rate, 2);
10140 10146
 
10141
-                            $yj_amount_90 = round($pv * $rate, 2) * 0.9;
10142
-                            $fgj_amount_10 = round($pv * $rate, 2) * 0.1;//推广者的佣金抽10%到个人复购金
10147
+                            $yj_amount_90 = bcmul($pv, $rate, 2) * 0.9;
10148
+                            $fgj_amount_10 = bcmul($pv, $rate, 2) * 0.1;//推广者的佣金抽10%到个人复购金
10143 10149
 
10144 10150
                             $yj_amount = $spread_data['brokerage_price'] + $yj_amount_90;
10145 10151
                             $fgj_amount = $spread_data['fugou'] + $fgj_amount_10;
@@ -10147,13 +10153,13 @@ class StoreOrderRepository extends BaseRepository
10147 10153
 
10148 10154
                             // Db::name('user')->where('uid',$spread_data['uid'])->update(['contribute'=> $con,'score'=> $score,'brokerage_price'=> $yj_amount,'annuity'=>$ylj_amount,'fugou'=>$fgj_amount]);
10149 10155
                         } else if ($spread_data['user_group'] == 7) {
10150
-                            $ssf = round($pv * $rate, 2);
10151
-                            $con = $spread_data['contribute'] + round($pv * $rate, 2);
10152
-                            $score = $spread_data['score'] + round($pv * $rate, 2);
10156
+                            $ssf = bcmul($pv, $rate, 2);
10157
+                            $con = $spread_data['contribute'] + bcmul($pv, $rate, 2);
10158
+                            $score = $spread_data['score'] + bcmul($pv, $rate, 2);
10153 10159
 
10154 10160
 
10155
-                            $yj_amount_90 = round($pv * $rate, 2) * 0.9;
10156
-                            $fgj_amount_10 = round($pv * $rate, 2) * 0.1;//推广者的佣金抽10%到个人复购金
10161
+                            $yj_amount_90 = bcmul($pv, $rate, 2) * 0.9;
10162
+                            $fgj_amount_10 = bcmul($pv, $rate, 2) * 0.1;//推广者的佣金抽10%到个人复购金
10157 10163
 
10158 10164
                             $yj_amount = $spread_data['brokerage_price'] + $yj_amount_90;
10159 10165
                             $fgj_amount = $spread_data['fugou'] + $fgj_amount_10;
@@ -10167,17 +10173,17 @@ class StoreOrderRepository extends BaseRepository
10167 10173
                         //积分
10168 10174
                         $this->score_log($spread_data['uid'], $ssf, $store_order_data['order_id'], 12, "商贸区商品赠送积分");
10169 10175
                         //推广佣金
10170
-                        $this->bill_user_log($spread_data['uid'], $yj_amount_90, $store_order_data['order_id'], 3, $group_order['group_order_sn'], '推广获得金' . $yj_amount_90, $store_order_data['mer_id'], 0);
10176
+                        $this->bill_user_log($spread_data['uid'], $yj_amount_90, $store_order_data['order_id'], 3, $group_order['group_order_sn'], '推广获得金' . $yj_amount_90, $store_order_data['mer_id'], 0);
10171 10177
                         //养老金
10172
-                        $this->bill_user_log($spread_data['uid'], round($pv * 0.05, 2), $store_order_data['order_id'], 5, $group_order['group_order_sn'], '推广获得养老金' . round($pv * 0.05, 2), $store_order_data['mer_id'], 0);
10178
+                        $this->bill_user_log($spread_data['uid'], bcmul($pv, 0.05, 2), $store_order_data['order_id'], 5, $group_order['group_order_sn'], '推广获得养老金' . round($pv * 0.05, 2), $store_order_data['mer_id'], 0);
10173 10179
                     }
10174 10180
 
10175 10181
                     //普通用户推广人
10176 10182
                     if ($spread_data['user_group'] == 1) {
10177 10183
                         //给推广者分配佣金
10178 10184
 
10179
-                        $yj_amount_90 = round($pv * $rate, 2) * 0.9;
10180
-                        $fgj_amount_10 = round($pv * $rate, 2) * 0.1;//推广者的佣金抽10%到个人复购金
10185
+                        $yj_amount_90 = bcmul($pv, $rate, 2) * 0.9;
10186
+                        $fgj_amount_10 = bcmul($pv, $rate, 2) * 0.1;//推广者的佣金抽10%到个人复购金
10181 10187
 
10182 10188
                         $yj_amount = $spread_data['brokerage_price'] + $yj_amount_90;
10183 10189
                         $fgj_amount = $spread_data['fugou'] + $fgj_amount_10;
@@ -10185,18 +10191,18 @@ class StoreOrderRepository extends BaseRepository
10185 10191
 
10186 10192
                         //Db::name('user')->where('uid',$spread_data['uid'])->update(['brokerage_price'=>$yj_amount,'fugou'=>$fgj_amount]);
10187 10193
 
10188
-                        $con = $spread_data['contribute'] + round($pv * $rate, 2);
10189
-                        $score = $spread_data['score'] + round($pv * $rate, 2);
10194
+                        $con = $spread_data['contribute'] + bcmul($pv, $rate, 2);
10195
+                        $score = $spread_data['score'] + bcmul($pv, $rate, 2);
10190 10196
 
10191 10197
                         //贡献值和积分
10192 10198
                         // Db::name('user')->where('uid',$spread_data['uid'])->update(["contribute"=>$con,"score"=>$score]);
10193 10199
 
10194 10200
                         //推广佣金
10195
-                        $this->bill_user_log($spread_data['uid'], $yj_amount_90, $store_order_data['order_id'], 3, $group_order['group_order_sn'], '推广获得金' . $yj_amount_90, $store_order_data['mer_id'], 0);
10201
+                        $this->bill_user_log($spread_data['uid'], $yj_amount_90, $store_order_data['order_id'], 3, $group_order['group_order_sn'], '推广获得金' . $yj_amount_90, $store_order_data['mer_id'], 0);
10196 10202
                         // 贡献值
10197 10203
                         $this->con_log($spread_data['uid'], $pv, $store_order_data['order_id'], 12, "推广商贸区商品赠送贡献值");
10198 10204
                         // 积分
10199
-                        $this->score_log($spread_data['uid'], round($pv * $rate, 2), $store_order_data['order_id'], 12, "推广商贸区商品赠送积分");
10205
+                        $this->score_log($spread_data['uid'], bcmul($pv, $rate, 2), $store_order_data['order_id'], 12, "推广商贸区商品赠送积分");
10200 10206
                     }
10201 10207
                 }
10202 10208
 
@@ -10206,15 +10212,15 @@ class StoreOrderRepository extends BaseRepository
10206 10212
                     $merchant_user_data = Db::name('user')->where('uid', $merchant_data['uid'])->find();
10207 10213
                     if (!empty($merchant_user_data)) {
10208 10214
                         //给推广者分配佣金
10209
-                        $yj_amount_90 = round($pv * 0.05, 2) * 0.9;
10210
-                        $fgj_amount_10 = round($pv * 0.05, 2) * 0.1;//推广者的佣金抽10%到个人复购金
10215
+                        $yj_amount_90 = bcmul($pv, 0.05, 2) * 0.9;
10216
+                        $fgj_amount_10 = bcmul($pv, 0.05, 2) * 0.1;//推广者的佣金抽10%到个人复购金
10211 10217
 
10212 10218
                         $yj_amount = $merchant_user_data['brokerage_price'] + $yj_amount_90;
10213 10219
                         $fgj_amount = $merchant_user_data['fugou'] + $fgj_amount_10;
10214 10220
                         $this->fugou_user_log($merchant_data['uid'], $fgj_amount_10, $store_order_data['order_id'], 1);
10215 10221
 
10216 10222
                         //推广佣金
10217
-                        $this->bill_user_log($merchant_data['uid'], $yj_amount_90, $store_order_data['order_id'], 3, $group_order['group_order_sn'], '推广获得金' . $yj_amount_90, $store_order_data['mer_id'], 0);
10223
+                        $this->bill_user_log($merchant_data['uid'], $yj_amount_90, $store_order_data['order_id'], 3, $group_order['group_order_sn'], '推广获得金' . $yj_amount_90, $store_order_data['mer_id'], 0);
10218 10224
                     }
10219 10225
                     /** @var OrderMerchantRepository $orderMerchantRepository */
10220 10226
                     $orderMerchantRepository = app()->make(OrderMerchantRepository::class);
@@ -10222,7 +10228,7 @@ class StoreOrderRepository extends BaseRepository
10222 10228
 
10223 10229
                     //商户获得贡献值
10224 10230
                     if ($concession_pri >= 0.01) {
10225
-                        $gonxian = round($concession_pri * $jdAndGonxianConfig['gonxian'], 2);
10231
+                        $gonxian = bcmul($concession_pri, $jdAndGonxianConfig['gonxian'], 2);
10226 10232
                         $gongxian_data = [
10227 10233
                             "uid" => $merchant_data["uid"],
10228 10234
                             "mer_id" => $user_data['mer_id'],
@@ -10244,7 +10250,7 @@ class StoreOrderRepository extends BaseRepository
10244 10250
 
10245 10251
                     //商户获得京豆
10246 10252
                     if ($concession_pri >= 0.01) {
10247
-                        $jd = round($concession_pri * $jdAndGonxianConfig['jd'], 2);
10253
+                        $jd = bcmul($concession_pri, $jdAndGonxianConfig['jd'], 2);
10248 10254
                         $jd_data = [
10249 10255
                             "uid" => $merchant_data["uid"],
10250 10256
                             "mer_id" => $user_data['mer_id'],
@@ -10307,7 +10313,7 @@ class StoreOrderRepository extends BaseRepository
10307 10313
 
10308 10314
 
10309 10315
         //code...
10310
-        $pay_gb = round($orderInfo['num'] * $orderInfo['gb_num'], 2);
10316
+        $pay_gb = bcmul($orderInfo['num'], $orderInfo['gb_num'], 2);
10311 10317
         //$pay_vr =  round($orderInfo['num'] * $orderInfo['vr_num'],2);
10312 10318
         //付款按照700的VR付款 start
10313 10319
         $vr_num = 0;
@@ -10340,17 +10346,17 @@ class StoreOrderRepository extends BaseRepository
10340 10346
 
10341 10347
             if ($goods_of_info['money'] == 1180) {
10342 10348
                 //修改订单到账状态
10343
-                $zs_ylj = round(700 * 0.05, 2);//计算的养老金 金额
10349
+                $zs_ylj = bcmul(700, 0.05, 2);//计算的养老金 金额
10344 10350
             } elseif ($goods_of_info['money'] == 11800) {
10345
-                $zs_ylj = round(7000 * 0.05, 2);//计算的养老金 金额
10351
+                $zs_ylj = bcmul(7000, 0.05, 2);//计算的养老金 金额
10346 10352
             } elseif ($goods_of_info['money'] == 3540) {
10347
-                $zs_ylj = round(2100 * 0.05, 2);//计算的养老金 金额
10353
+                $zs_ylj = bcmul(2100, 0.05, 2);//计算的养老金 金额
10348 10354
             } elseif ($goods_of_info['money'] == 10620) {
10349
-                $zs_ylj = round(6300 * 0.05, 2);//计算的养老金 金额
10355
+                $zs_ylj = bcmul(6300, 0.05, 2);//计算的养老金 金额
10350 10356
             } elseif ($goods_of_info['money'] == 9440) {
10351
-                $zs_ylj = round(5600 * 0.05, 2);//八单计算的养老金 金额
10357
+                $zs_ylj = bcmul(5600, 0.05, 2);//八单计算的养老金 金额
10352 10358
             } elseif ($goods_of_info['money'] == 2360) {
10353
-                $zs_ylj = round(1400 * 0.05, 2);//两单计算的养老金 金额
10359
+                $zs_ylj = bcmul(1400, 0.05, 2);//两单计算的养老金 金额
10354 10360
             }
10355 10361
 
10356 10362
 

+ 34 - 34
app/common/repositories/store/product/ProductRepository.php

@@ -381,7 +381,7 @@ class ProductRepository extends BaseRepository
381 381
         $pric = $stock = $ot_price = $cost = $dc_price = $concession_pri = 0;
382 382
         if (isset($data['attrValue']) && is_array($data['attrValue'])) {
383 383
             foreach ($data['attrValue'] as $value) {
384
-
384
+                $value['extension_one'] = $value['extension_one'] ?? 0;
385 385
                 $value['cost'] = bcsub($value['price'], bcmul($value['price'], $value['extension_one'] / 100, 2), 2);
386 386
                 $value['gong_mer_profit'] = bcmul($value['price'], $value['extension_one'] / 100, 2);
387 387
                 $value['gong_market_price'] = bcadd($value['cost'], $value['gong_mer_profit'], 2);
@@ -1025,7 +1025,7 @@ class ProductRepository extends BaseRepository
1025 1025
                 $s = 8000;
1026 1026
             }
1027 1027
 
1028
-            $res['yanglao'] = round($s * 0.035,2);
1028
+            $res['yanglao'] = bcmul($s, 0.035, 2);  
1029 1029
         }
1030 1030
 
1031 1031
 
@@ -1701,8 +1701,8 @@ class ProductRepository extends BaseRepository
1701 1701
 
1702 1702
             if($product['mer_id'] == 496){
1703 1703
 
1704
-                $yanglao = round($num_yl * 0.035, 2);
1705
-                $pv=$num_yl *0.7;
1704
+                $yanglao = bcmul($num_yl, 0.035, 2);
1705
+                $pv = bcmul($num_yl, 0.7, 2);
1706 1706
                 //$v['vr']=$v['price'];
1707 1707
                 //1:为会员专区,
1708 1708
 
@@ -1715,24 +1715,24 @@ class ProductRepository extends BaseRepository
1715 1715
 
1716 1716
             }else if($product['mer_id'] == 439){
1717 1717
                 //精彩生活和商贸区
1718
-                $jf = $product['price'] - round($product['concession_pri']*0.3, 2) . ' + ' . round($product['concession_pri']*0.3, 2);
1719
-                $jd = $product['price'] - round($product['concession_pri']*0.35, 2) . ' + ' . round($product['concession_pri']*0.35, 2);
1718
+                $jf = $product['price'] - bcmul($product['concession_pri'], 0.3, 2) . ' + ' . bcmul($product['concession_pri'],0.3, 2);
1719
+                $jd = $product['price'] - bcmul($product['concession_pri'], 0.35, 2) . ' + ' . bcmul($product['concession_pri'],0.35, 2);
1720 1720
                 if($product['concession_pri'] !=null || $product['concession_pri'] !=0){
1721
-                    $yanglao = round($product['concession_pri'] * 0.3, 2);
1722
-                    $pv = round($product['concession_pri'] * 0.35, 2);
1721
+                    $yanglao = bcmul($product['concession_pri'], 0.3, 2);
1722
+                    $pv = bcmul($product['concession_pri'], 0.35, 2);
1723 1723
                     $srtArry['jfduihuan'] =$jf;
1724 1724
                     $srtArry['jdduihuan'] = $jd;
1725
-                    $jifen = round($product['concession_pri'] * 0.35, 2);
1726
-                    $gongxian = round($product['concession_pri'] * 0.35, 2);
1725
+                    $jifen = bcmul($product['concession_pri'], 0.35, 2);
1726
+                    $gongxian = bcmul($product['concession_pri'], 0.35, 2);
1727 1727
 
1728
-                    $jcvr = $product['price'] - round($product['concession_pri']*0.3, 2);
1729
-                    $jcjf = round($product['concession_pri']*0.3, 2);
1730
-                    $jcprice = $product['price'] - round($product['concession_pri']*0.3, 2);
1731
-                    $jcjf1 = round($product['concession_pri']*0.3, 2);
1732
-                    $jcvr1 = $product['price'] - round($product['concession_pri']*0.35, 2);
1733
-                    $jcjd = round($product['concession_pri']*0.35, 2);
1734
-                    $jcprice1 = $product['price'] - round($product['concession_pri']*0.35, 2);
1735
-                    $jcjd1 = round($product['concession_pri']*0.35, 2);
1728
+                    $jcvr = $product['price'] - bcmul($product['concession_pri'], 0.3, 2);
1729
+                    $jcjf = bcmul($product['concession_pri'], 0.3, 2);
1730
+                    $jcprice = $product['price'] - bcmul($product['concession_pri'], 0.3, 2);
1731
+                    $jcjf1 = bcmul($product['concession_pri'], 0.3, 2);
1732
+                    $jcvr1 = $product['price'] - bcmul($product['concession_pri'], 0.35, 2);
1733
+                    $jcjd = bcmul($product['concession_pri'], 0.35, 2);
1734
+                    $jcprice1 = $product['price'] - bcmul($product['concession_pri'], 0.35, 2);
1735
+                    $jcjd1 = bcmul($product['concession_pri'], 0.35, 2);
1736 1736
 
1737 1737
 
1738 1738
                     //支付组合
@@ -1764,7 +1764,7 @@ class ProductRepository extends BaseRepository
1764 1764
                 // 获取商品sku
1765 1765
                 $productSku = Db::name('store_product_attr_value')->where('product_id', $good_id)->order('price asc')->find();
1766 1766
                 $pv = $productSku['plate_mer_profit']??0.00;
1767
-                $yanglao = round($pv * 0.5, 2);
1767
+                $yanglao = bcmul($pv, 0.5, 2);
1768 1768
                 //$v['vr']=$v['price'];
1769 1769
                 //1:为会员专区,
1770 1770
 
@@ -1783,24 +1783,24 @@ class ProductRepository extends BaseRepository
1783 1783
                 // 1企业2个体3个人
1784 1784
                 if ($merchantInfo && in_array($merchantInfo['type'],[2,3])) {
1785 1785
                     //商贸区
1786
-                    $jf = $product['price'] - round($product['concession_pri']*0.3, 2) . ' + ' . round($product['concession_pri']*0.3, 2);
1787
-                    $jd = $product['price'] - round($product['concession_pri']*0.35, 2) . ' + ' . round($product['concession_pri']*0.35, 2);
1786
+                    $jf = $product['price'] - bcmul($product['concession_pri'],0.3, 2) . ' + ' . bcmul($product['concession_pri'],0.3, 2);
1787
+                    $jd = $product['price'] - bcmul($product['concession_pri'],0.35, 2) . ' + ' . bcmul($product['concession_pri'],0.35, 2);
1788 1788
                     if($product['concession_pri'] !=null || $product['concession_pri'] !=0){
1789
-                        $yanglao = round($product['concession_pri'] * 0.3, 2);
1790
-                        $pv = round($product['concession_pri'] * 0.35, 2);
1789
+                        $yanglao = bcmul($product['concession_pri'], 0.3, 2);
1790
+                        $pv = bcmul($product['concession_pri'], 0.35, 2);
1791 1791
                         $srtArry['jfduihuan'] =$jf;
1792 1792
                         $srtArry['jdduihuan'] = $jd;
1793
-                        $jifen = round($product['concession_pri'] * 0.35, 2);
1794
-                        $gongxian = round($product['concession_pri'] * 0.35, 2);
1795
-
1796
-                        $jcvr = $product['price'] - round($product['concession_pri']*0.3, 2);
1797
-                        $jcjf = round($product['concession_pri']*0.3, 2);
1798
-                        $jcprice = $product['price'] - round($product['concession_pri']*0.3, 2);
1799
-                        $jcjf1 = round($product['concession_pri']*0.3, 2);
1800
-                        $jcvr1 = $product['price'] - round($product['concession_pri']*0.35, 2);
1801
-                        $jcjd = round($product['concession_pri']*0.35, 2);
1802
-                        $jcprice1 = $product['price'] - round($product['concession_pri']*0.35, 2);
1803
-                        $jcjd1 = round($product['concession_pri']*0.35, 2);
1793
+                        $jifen = bcmul($product['concession_pri'], 0.35, 2);
1794
+                        $gongxian = bcmul($product['concession_pri'], 0.35, 2);
1795
+
1796
+                        $jcvr = $product['price'] - bcmul($product['concession_pri'], 0.3, 2);
1797
+                        $jcjf = bcmul($product['concession_pri'], 0.3, 2);
1798
+                        $jcprice = $product['price'] - bcmul($product['concession_pri'], 0.3, 2);
1799
+                        $jcjf1 = bcmul($product['concession_pri'], 0.3, 2);
1800
+                        $jcvr1 = $product['price'] - bcmul($product['concession_pri'], 0.35, 2);
1801
+                        $jcjd = bcmul($product['concession_pri'], 0.35, 2);
1802
+                        $jcprice1 = $product['price'] - bcmul($product['concession_pri'], 0.35, 2);
1803
+                        $jcjd1 = bcmul($product['concession_pri'], 0.35, 2);
1804 1804
 
1805 1805
                         $fzone_paytype= [
1806 1806
 //                ['type'=>'b1','price'=>$jcvr,'other'=>$jcjf],

+ 92 - 91
app/controller/api/Notify.php

@@ -167,8 +167,8 @@ class Notify
167 167
                                     $job_par = json_decode($store_order_data['fzone_paytype'], true);
168 168
                                     //if($job_par['note'] == "现金"){
169 169
                                     //普通消费者
170
-                                    $ylj_pri = round($concession_pri * 0.3,2);
171
-                                    $pv = round($concession_pri * 0.35,2);
170
+                                    $ylj_pri = bcmul($concession_pri, 0.3,2);
171
+                                    $pv = bcmul($concession_pri, 0.35,2);  
172 172
 
173 173
                                     //分配养老金给消费者
174 174
                                     $ylj_amount_mine = $user_data['annuity'] + $ylj_pri;
@@ -195,18 +195,18 @@ class Notify
195 195
 
196 196
                                             // //给推广者分配佣金
197 197
                                             $yj_amount = 0;
198
-                                            $ylj_amount = $spread_data['annuity'] + round($pv * 0.05,2);
198
+                                            $ylj_amount = $spread_data['annuity'] + bcmul($pv, 0.05,2);
199 199
                                             $ssf = 0;//变量
200 200
                                             $yj_amount_90 = 0;//90%的佣金
201 201
 
202 202
                                             if($spread_data['user_group'] == 2){
203
-                                                $ssf =round($pv * 0.07,2);
204
-                                                $con       = $spread_data['contribute'] + round($pv * 0.07,2);
205
-                                                $score     = $spread_data['score'] + round($pv * 0.07,2);
203
+                                                $ssf =bcmul($pv, 0.07,2);
204
+                                                $con       = $spread_data['contribute'] + bcmul($pv, 0.07,2);
205
+                                                $score     = $spread_data['score'] + bcmul($pv, 0.07,2);
206 206
 
207 207
 
208
-                                                $yj_amount_90 = round($pv * 0.07,2) * 0.9;
209
-                                                $fgj_amount_10 = round($pv * 0.07,2) * 0.1;//推广者的佣金抽10%到个人复购金
208
+                                                $yj_amount_90 = bcmul($pv, 0.07,2) * 0.9;
209
+                                                $fgj_amount_10 = bcmul($pv, 0.07,2) * 0.1;//推广者的佣金抽10%到个人复购金
210 210
 
211 211
                                                 $yj_amount = $spread_data['brokerage_price'] + $yj_amount_90;
212 212
                                                 $fgj_amount = $spread_data['fugou'] + $fgj_amount_10;
@@ -216,12 +216,12 @@ class Notify
216 216
 
217 217
                                                 // Db::name('user')->where('uid',$spread_data['uid'])->update(['contribute'=> $con,'score'=> $score,'brokerage_price'=> $yj_amount,'annuity'=>$ylj_amount,'fugou'=>$fgj_amount]);
218 218
                                             }else if($spread_data['user_group'] == 3){
219
-                                                $ssf =round($pv * 0.09,2);
220
-                                                $con       = $spread_data['contribute'] + round($pv * 0.09,2);
221
-                                                $score     = $spread_data['score'] + round($pv * 0.09,2);
219
+                                                $ssf =bcmul($pv, 0.09,2);
220
+                                                $con       = $spread_data['contribute'] + bcmul($pv, 0.09,2);
221
+                                                $score     = $spread_data['score'] + bcmul($pv, 0.09,2);
222 222
 
223
-                                                $yj_amount_90 = round($pv * 0.09,2) * 0.9;
224
-                                                $fgj_amount_10 = round($pv * 0.09,2) * 0.1;//推广者的佣金抽10%到个人复购金
223
+                                                $yj_amount_90 = bcmul($pv, 0.09,2) * 0.9;
224
+                                                $fgj_amount_10 = bcmul($pv, 0.09,2) * 0.1;//推广者的佣金抽10%到个人复购金
225 225
 
226 226
                                                 $yj_amount = $spread_data['brokerage_price'] + $yj_amount_90;
227 227
                                                 $fgj_amount = $spread_data['fugou'] + $fgj_amount_10;
@@ -229,13 +229,13 @@ class Notify
229 229
 
230 230
                                                 // Db::name('user')->where('uid',$spread_data['uid'])->update(['contribute'=> $con,'score'=> $score,'brokerage_price'=> $yj_amount,'annuity'=>$ylj_amount,'fugou'=>$fgj_amount]);
231 231
                                             }else if($spread_data['user_group'] == 4){
232
-                                                $ssf =round($pv * 0.11,2);
233
-                                                $con       = $spread_data['contribute'] + round($pv * 0.11,2);
234
-                                                $score     = $spread_data['score'] + round($pv * 0.11,2);
232
+                                                $ssf =bcmul($pv, 0.11,2);
233
+                                                $con       = $spread_data['contribute'] + bcmul($pv, 0.11,2);
234
+                                                $score     = $spread_data['score'] + bcmul($pv, 0.11,2);
235 235
 
236 236
 
237
-                                                $yj_amount_90 = round($pv * 0.11,2) * 0.9;
238
-                                                $fgj_amount_10 = round($pv * 0.11,2) * 0.1;//推广者的佣金抽10%到个人复购金
237
+                                                $yj_amount_90 = bcmul($pv, 0.11,2) * 0.9;
238
+                                                $fgj_amount_10 = bcmul($pv, 0.11,2) * 0.1;//推广者的佣金抽10%到个人复购金
239 239
 
240 240
                                                 $yj_amount = $spread_data['brokerage_price'] + $yj_amount_90;
241 241
                                                 $fgj_amount = $spread_data['fugou'] + $fgj_amount_10;
@@ -243,13 +243,13 @@ class Notify
243 243
 
244 244
                                                 //Db::name('user')->where('uid',$spread_data['uid'])->update(['contribute'=> $con,'score'=> $score,'brokerage_price'=> $yj_amount,'annuity'=>$ylj_amount,'fugou'=>$fgj_amount]);
245 245
                                             }else if($spread_data['user_group'] == 5){
246
-                                                $ssf =round($pv * 0.13,2);
247
-                                                $con       = $spread_data['contribute'] + round($pv * 0.13,2);
248
-                                                $score     = $spread_data['score'] + round($pv * 0.13,2);
246
+                                                $ssf =bcmul($pv, 0.13,2);
247
+                                                $con       = $spread_data['contribute'] + bcmul($pv, 0.13,2);
248
+                                                $score     = $spread_data['score'] + bcmul($pv, 0.13,2);
249 249
                                                 // $yj_amount = $spread_data['brokerage_price'] + round($pv * 0.13,2);
250 250
 
251
-                                                $yj_amount_90 = round($pv * 0.13,2) * 0.9;
252
-                                                $fgj_amount_10 = round($pv * 0.13,2) * 0.1;//推广者的佣金抽10%到个人复购金
251
+                                                $yj_amount_90 = bcmul($pv, 0.13,2) * 0.9;
252
+                                                $fgj_amount_10 = bcmul($pv, 0.13,2) * 0.1;//推广者的佣金抽10%到个人复购金
253 253
 
254 254
                                                 $yj_amount = $spread_data['brokerage_price'] + $yj_amount_90;
255 255
                                                 $fgj_amount = $spread_data['fugou'] + $fgj_amount_10;
@@ -257,13 +257,13 @@ class Notify
257 257
 
258 258
                                                 // Db::name('user')->where('uid',$spread_data['uid'])->update(['contribute'=> $con,'score'=> $score,'brokerage_price'=> $yj_amount,'annuity'=>$ylj_amount,'fugou'=>$fgj_amount]);
259 259
                                             }else if($spread_data['user_group'] == 6){
260
-                                                $ssf =round($pv * 0.15,2);
261
-                                                $con       = $spread_data['contribute'] + round($pv * 0.15,2);
262
-                                                $score     = $spread_data['score'] + round($pv * 0.15,2);
260
+                                                $ssf =bcmul($pv, 0.15,2);
261
+                                                $con       = $spread_data['contribute'] + bcmul($pv, 0.15,2);
262
+                                                $score     = $spread_data['score'] + bcmul($pv, 0.15,2);
263 263
                                                 // $yj_amount = $spread_data['brokerage_price'] + round($pv * 0.15,2);
264 264
 
265
-                                                $yj_amount_90 = round($pv * 0.15,2) * 0.9;
266
-                                                $fgj_amount_10 = round($pv * 0.15,2) * 0.1;//推广者的佣金抽10%到个人复购金
265
+                                                $yj_amount_90 = bcmul($pv, 0.15,2) * 0.9;
266
+                                                $fgj_amount_10 = bcmul($pv, 0.15,2) * 0.1;//推广者的佣金抽10%到个人复购金
267 267
 
268 268
                                                 $yj_amount = $spread_data['brokerage_price'] + $yj_amount_90;
269 269
                                                 $fgj_amount = $spread_data['fugou'] + $fgj_amount_10;
@@ -271,13 +271,13 @@ class Notify
271 271
 
272 272
                                                 // Db::name('user')->where('uid',$spread_data['uid'])->update(['contribute'=> $con,'score'=> $score,'brokerage_price'=> $yj_amount,'annuity'=>$ylj_amount,'fugou'=>$fgj_amount]);
273 273
                                             }else if($spread_data['user_group'] == 7){
274
-                                                $ssf =round($pv * 0.17,2);
275
-                                                $con       = $spread_data['contribute'] + round($pv * 0.17,2);
276
-                                                $score     = $spread_data['score'] + round($pv * 0.17,2);
274
+                                                $ssf =bcmul($pv, 0.17,2);
275
+                                                $con       = $spread_data['contribute'] + bcmul($pv * 0.17,2);
276
+                                                $score     = $spread_data['score'] + bcmul($pv, 0.17,2);
277 277
                                                 // $yj_amount = $spread_data['brokerage_price'] + round($pv * 0.17,2);
278 278
 
279
-                                                $yj_amount_90 = round($pv * 0.17,2) * 0.9;
280
-                                                $fgj_amount_10 = round($pv * 0.17,2) * 0.1;//推广者的佣金抽10%到个人复购金
279
+                                                $yj_amount_90 = bcmul($pv, 0.17,2) * 0.9;
280
+                                                $fgj_amount_10 = bcmul($pv, 0.17,2) * 0.1;//推广者的佣金抽10%到个人复购金
281 281
 
282 282
                                                 $yj_amount = $spread_data['brokerage_price'] + $yj_amount_90;
283 283
                                                 $fgj_amount = $spread_data['fugou'] + $fgj_amount_10;
@@ -291,7 +291,7 @@ class Notify
291 291
                                             //积分
292 292
                                             $this->score_log($spread_data['uid'],$ssf,$store_order_data['order_id'],11,"精彩生活区商品赠送积分");
293 293
                                             // //推广佣金
294
-                                            $this->bill_user_log($spread_data['uid'],$yj_amount_90,$store_order_data['order_id'],3,$store_order_data['order_sn'],'推广获得金'.$yj_amount_90,$store_order_data['mer_id'],0);
294
+                                            $this->bill_user_log($spread_data['uid'],$yj_amount_90,$store_order_data['order_id'],3,$store_order_data['order_sn'],'推广获得金'.$yj_amount_90,$store_order_data['mer_id'],0);
295 295
                                             //养老金
296 296
                                             $this->bill_user_log($spread_data['uid'],round($pv * 0.05,2),$store_order_data['order_id'],5,$store_order_data['order_sn'],'推广获得养老金'.round($pv * 0.05,2),$store_order_data['mer_id'],0);
297 297
                                         }
@@ -300,8 +300,8 @@ class Notify
300 300
                                         if($spread_data['user_group'] == 1){
301 301
                                             //给推广者分配佣金
302 302
                                             // $ylj_amount = $spread_data['annuity'] + round($pv * 0.3,2);
303
-                                            $yj_amount_90 = round($pv * 0.21,2) * 0.9;
304
-                                            $fgj_amount_10 = round($pv * 0.21,2) * 0.1;//推广者的佣金抽10%到个人复购金
303
+                                            $yj_amount_90 = bcmul($pv, 0.21,2) * 0.9;
304
+                                            $fgj_amount_10 = bcmul($pv, 0.21,2) * 0.1;//推广者的佣金抽10%到个人复购金
305 305
 
306 306
                                             $yj_amount = $spread_data['brokerage_price'] + $yj_amount_90;
307 307
                                             $fgj_amount = $spread_data['fugou'] + $fgj_amount_10;
@@ -309,8 +309,8 @@ class Notify
309 309
 
310 310
                                             //Db::name('user')->where('uid',$spread_data['uid'])->update(['brokerage_price'=>$yj_amount,'fugou'=>$fgj_amount]);
311 311
 
312
-                                            $con = $spread_data['contribute'] + round($pv * 0.21,2);
313
-                                            $score = $spread_data['score'] + round($pv * 0.21,2);
312
+                                            $con = $spread_data['contribute'] + bcmul($pv, 0.21,2);
313
+                                            $score = $spread_data['score'] + bcmul($pv, 0.21,2);
314 314
 
315 315
                                             //贡献值和积分
316 316
                                             //Db::name('user')->where('uid',$spread_data['uid'])->update(["contribute"=>$con,"score"=>$score]);
@@ -318,7 +318,7 @@ class Notify
318 318
                                             //推广养老金
319 319
 
320 320
                                             //推广佣金
321
-                                            $this->bill_user_log($spread_data['uid'],$yj_amount_90,$store_order_data['order_id'],3,$store_order_data['order_sn'],'推广获得金'.$yj_amount_90,$store_order_data['mer_id'],0);
321
+                                            $this->bill_user_log($spread_data['uid'],$yj_amount_90,$store_order_data['order_id'],3,$store_order_data['order_sn'],'推广获得金'.$yj_amount_90,$store_order_data['mer_id'],0);
322 322
                                             $this->con_log($spread_data['uid'],round($pv * 0.21,2),$store_order_data['order_id'],11,"推广精彩生活区商品赠送贡献值");
323 323
                                             $this->score_log($spread_data['uid'],round($pv * 0.21,2),$store_order_data['order_id'],11,"推广精彩生活区商品赠送积分");
324 324
 
@@ -341,8 +341,8 @@ class Notify
341 341
                                             //$merchant_amount = $merchant_user_data['brokerage_price'] + round($pv * 0.05,2);
342 342
                                             //给推广者分配佣金
343 343
 
344
-                                            $yj_amount_90 = round($pv * 0.05,2) * 0.9;
345
-                                            $fgj_amount_10 = round($pv * 0.05,2) * 0.1;//推广者的佣金抽10%到个人复购金
344
+                                            $yj_amount_90 = bcmul($pv, 0.05,2) * 0.9;
345
+                                            $fgj_amount_10 = bcmul($pv, 0.05,2) * 0.1;//推广者的佣金抽10%到个人复购金
346 346
 
347 347
                                             $yj_amount = $merchant_user_data['brokerage_price'] + $yj_amount_90;
348 348
                                             $fgj_amount = $merchant_user_data['fugou'] + $fgj_amount_10;
@@ -352,7 +352,7 @@ class Notify
352 352
 
353 353
                                             //Db::name('user')->where('uid',$merchant_data['uid'])->update(['brokerage_price'=>$yj_amount,'fugou'=>$fgj_amount]);
354 354
                                             //推广佣金
355
-                                            $this->bill_user_log($merchant_data['uid'],  $yj_amount_90,$store_order_data['order_id'],3,$store_order_data['order_sn'],'推广获得金'.  $yj_amount_90,$store_order_data['mer_id'],0);
355
+                                            $this->bill_user_log($merchant_data['uid'],  $yj_amount_90,$store_order_data['order_id'],3,$store_order_data['order_sn'],'推广获得金'.  $yj_amount_90,$store_order_data['mer_id'],0);
356 356
 
357 357
                                         }
358 358
 
@@ -398,7 +398,7 @@ class Notify
398 398
                                     $le_yw_amount = 600;
399 399
                                 }
400 400
 
401
-                                $ylj_pri = round($pv * 0.035,2);
401
+                                $ylj_pri = bcmul($pv, 0.035,2);
402 402
                                 //$pv = round($pv * 0.35,2);
403 403
 
404 404
                                 //分配养老金给消费者
@@ -412,7 +412,7 @@ class Notify
412 412
  
413 413
                                 $this->bill_user_log($user_data['uid'],round($pv * 0.035,2),$store_order_data['order_id'],5,$store_order_data['order_sn'],'消费获得养老金'.round($pv * 0.035,2),$store_order_data['mer_id']);
414 414
  
415
-                                $this->con_log($user_data['uid'],$gx_jf,$store_order_data['order_id'],11,"购买会员专区商品赠送贡献值",1);
415
+                                $this->con_log($user_data['uid'],$gx_jf,$store_order_data['order_id'],11,"购买会员专区商品赠送贡献值",1, $pv);
416 416
                                 $this->score_log($user_data['uid'],$gx_jf,$store_order_data['order_id'],11,"购买会员专区商品赠送积分",1);
417 417
 
418 418
 
@@ -446,7 +446,7 @@ class Notify
446 446
                                         $con =0;//贡献值
447 447
                                         $score = 0;//积分
448 448
                                         //养老金
449
-                                        $uer_bill = $spread_data['annuity'] + round($pv * 0.035,2);
449
+                                        $uer_bill = $spread_data['annuity'] + bcmul($pv, 0.035,2);
450 450
 
451 451
 
452 452
                                         $yj_amount_90 = $le_yw_amount * 0.9;
@@ -460,8 +460,8 @@ class Notify
460 460
 
461 461
                                         if($spread_data['user_group'] == 2){
462 462
 
463
-                                            $con = $spread_data['contribute'] + round($pv * 0.07,2);
464
-                                            $score = $spread_data['brokerage_price'] + round($pv * 0.07,2);
463
+                                            $con = $spread_data['contribute'] + bcmul($pv, 0.07,2);
464
+                                            $score = $spread_data['brokerage_price'] + bcmul($pv, 0.07,2);
465 465
                                             //Db::name('user')->where('uid',$spread_data['uid'])->update(['contribute'=> $con,'score'=> $score,'brokerage_price'=> $yongjin,'annuity'=>$uer_bill,"fugou"=> $fgj_amount]);
466 466
 
467 467
                                             //贡献值
@@ -470,8 +470,8 @@ class Notify
470 470
                                             //$this->score_log($spread_data['uid'],round($pv * 0.07,2),$store_order_data['order_id'],11,"推广会员专区商品赠送积分",1);
471 471
 
472 472
                                         }else if($spread_data['user_group'] == 3){
473
-                                            $con = $spread_data['contribute'] + round($pv * 0.09,2);
474
-                                            $score = $spread_data['brokerage_price'] + round($pv * 0.09,2);
473
+                                            $con = $spread_data['contribute'] + bcmul($pv, 0.09,2);
474
+                                            $score = $spread_data['brokerage_price'] + bcmul($pv, 0.09,2);
475 475
                                             //Db::name('user')->where('uid',$spread_data['uid'])->update(['contribute'=> $con,'score'=> $score,'brokerage_price'=> $yongjin,'annuity'=>$uer_bill,"fugou"=> $fgj_amount]);
476 476
 
477 477
                                             //贡献值
@@ -481,8 +481,8 @@ class Notify
481 481
 
482 482
 
483 483
                                         }else if($spread_data['user_group'] == 4){
484
-                                            $con = $spread_data['contribute'] + round($pv * 0.11,2);
485
-                                            $score = $spread_data['brokerage_price'] + round($pv * 0.11,2);
484
+                                            $con = $spread_data['contribute'] + bcmul($pv, 0.11,2);
485
+                                            $score = $spread_data['brokerage_price'] + bcmul($pv, 0.11,2);
486 486
                                             //Db::name('user')->where('uid',$spread_data['uid'])->update(['contribute'=> $con,'score'=> $score,'brokerage_price'=> $yongjin,'annuity'=>$uer_bill,"fugou"=> $fgj_amount]);
487 487
 
488 488
                                             //贡献值
@@ -492,8 +492,8 @@ class Notify
492 492
 
493 493
 
494 494
                                         }else if($spread_data['user_group'] == 5){
495
-                                            $con = $spread_data['contribute'] + round($pv * 0.13,2);
496
-                                            $score = $spread_data['brokerage_price'] + round($pv * 0.13,2);
495
+                                            $con = $spread_data['contribute'] + bcmul($pv, 0.13,2);
496
+                                            $score = $spread_data['brokerage_price'] + bcmul($pv, 0.13,2);
497 497
                                             //Db::name('user')->where('uid',$spread_data['uid'])->update(['contribute'=> $con,'score'=> $score,'brokerage_price'=> $yongjin,'annuity'=>$uer_bill,"fugou"=> $fgj_amount]);
498 498
 
499 499
                                             //贡献值
@@ -502,8 +502,8 @@ class Notify
502 502
                                            // $this->score_log($spread_data['uid'],round($pv * 0.13,2),$store_order_data['order_id'],11,"推广会员专区商品赠送积分",1);
503 503
 
504 504
                                         }else if($spread_data['user_group'] == 6){
505
-                                            $con = $spread_data['contribute'] + round($pv * 0.15,2);
506
-                                            $score = $spread_data['brokerage_price'] + round($pv * 0.15,2);
505
+                                            $con = $spread_data['contribute'] + bcmul($pv, 0.15,2);
506
+                                            $score = $spread_data['brokerage_price'] + bcmul($pv, 0.15,2);
507 507
                                             //Db::name('user')->where('uid',$spread_data['uid'])->update(['contribute'=> $con,'score'=> $score,'brokerage_price'=> $yongjin,'annuity'=>$uer_bill,"fugou"=> $fgj_amount]);
508 508
 
509 509
                                             //贡献值
@@ -513,8 +513,8 @@ class Notify
513 513
 
514 514
 
515 515
                                         }else if($spread_data['user_group'] == 7){
516
-                                            $con = $spread_data['contribute'] + round($pv * 0.17,2);
517
-                                            $score = $spread_data['brokerage_price'] + round($pv * 0.17,2);
516
+                                            $con = $spread_data['contribute'] + bcmul($pv, 0.17,2);
517
+                                            $score = $spread_data['brokerage_price'] + bcmul($pv, 0.17,2);
518 518
                                             //Db::name('user')->where('uid',$spread_data['uid'])->update(['contribute'=> $con,'score'=> $score,'brokerage_price'=> $yongjin,'annuity'=>$uer_bill,"fugou"=> $fgj_amount]);
519 519
 
520 520
                                             //贡献值
@@ -528,12 +528,12 @@ class Notify
528 528
                                         $this->score_log($spread_data['uid'],round($gx_jf,2),$store_order_data['order_id'],11,"推广会员专区商品赠送积分",1);
529 529
 
530 530
 
531
-                                        $this->con_log($spread_data['uid'],round($gx_jf,2),$store_order_data['order_id'],11,"推广会员专区商品赠送贡献值",1);
531
+                                        $this->con_log($spread_data['uid'],round($gx_jf,2),$store_order_data['order_id'],11,"推广会员专区商品赠送贡献值",1, $pv);
532 532
 
533 533
                                         //养老金
534 534
                                         $this->bill_user_log($spread_data['uid'],round($pv * 0.035,2),$store_order_data['order_id'],5,$store_order_data['order_sn'],'消费获得养老金'.round($pv * 0.035,2),$store_order_data['mer_id']);
535 535
                                         //佣金
536
-                                        $this->bill_user_log($spread_data['uid'], $yj_amount_90,$store_order_data['order_id'],3,$store_order_data['order_sn'],'推广获得金'. $yj_amount_90,$store_order_data['mer_id']);
536
+                                        $this->bill_user_log($spread_data['uid'], $yj_amount_90,$store_order_data['order_id'],3,$store_order_data['order_sn'],'推广获得金'. $yj_amount_90,$store_order_data['mer_id']);
537 537
                                         //复购金
538 538
                                         $this->fugou_user_log($spread_data['uid'],$fgj_amount_10,$store_order_data['order_id'],1,1);
539 539
 
@@ -546,15 +546,15 @@ class Notify
546 546
                                         // //推广养老金
547 547
                                         // $this->bill_user_log($user_data['spread_uid'],round($pv * 0.01,2),$store_order_data['order_id'],5,$group_order['group_order_sn'],'推广获得养老金'.round($pv * 0.01,2),$store_order_data['mer_id']);
548 548
                                         // //推广佣金
549
-                                        // $this->bill_user_log($user_data['spread_uid'],round($pv * 0.01,2),$store_order_data['order_id'],3,$group_order['group_order_sn'],'推广获得金'.round($pv * 0.01,2),$store_order_data['mer_id']);
549
+                                        // $this->bill_user_log($user_data['spread_uid'],round($pv * 0.01,2),$store_order_data['order_id'],3,$group_order['group_order_sn'],'推广获得金'.round($pv * 0.01,2),$store_order_data['mer_id']);
550 550
 
551 551
                                         //获取贡献值和积分和佣金
552
-                                        $gx_jf = $spread_data['contribute'] + round($pv * 0.21,2);
552
+                                        $gx_jf = $spread_data['contribute'] + bcmul($pv, 0.21,2);
553 553
 
554 554
                                         //$yj111 = $spread_data['brokerage_price'] + $yj1;
555 555
 
556
-                                        $yj_amount_90 = round($yj1 * 0.9,2);
557
-                                        $fgj_amount_10 = round($yj1 * 0.1,2);//推广者的佣金抽10%到个人复购金
556
+                                        $yj_amount_90 = bcmul($yj1, 0.9,2);
557
+                                        $fgj_amount_10 = bcmul($yj1, 0.1,2);//推广者的佣金抽10%到个人复购金
558 558
 
559 559
                                         $yj_amount = $spread_data['brokerage_price'] + $yj_amount_90;
560 560
                                         $fgj_amount = $spread_data['fugou'] + $fgj_amount_10;
@@ -562,10 +562,10 @@ class Notify
562 562
 
563 563
 
564 564
                                         //Db::name('user')->where('uid',$spread_data['uid'])->update(['contribute'=> $gx_jf,'score'=> $gx_jf,'brokerage_price'=> $yj_amount,'fugou'=>$fgj_amount]);
565
-                                        $this->con_log($spread_data['uid'],round($pv * 0.21,2),$store_order_data['order_id'],11,"推广会员专区商品赠送贡献值",1);
565
+                                        $this->con_log($spread_data['uid'],round($pv * 0.21,2),$store_order_data['order_id'],11,"推广会员专区商品赠送贡献值",1, $pv);
566 566
                                         $this->score_log($spread_data['uid'],round($pv * 0.21,2),$store_order_data['order_id'],11,"推广会员专区商品赠送积分",1);
567 567
                                         //推广佣金
568
-                                        $this->bill_user_log($spread_data['uid'],$yj_amount_90,$store_order_data['order_id'],3,$store_order_data['order_sn'],'推广获得金'.$yj_amount_90,$store_order_data['mer_id']);
568
+                                        $this->bill_user_log($spread_data['uid'],$yj_amount_90,$store_order_data['order_id'],3,$store_order_data['order_sn'],'推广获得金'.$yj_amount_90,$store_order_data['mer_id']);
569 569
                                     }
570 570
 
571 571
 
@@ -579,7 +579,7 @@ class Notify
579 579
                                     // $spread_data = Db::name('user')->where('uid',473)->find();
580 580
 
581 581
                                     //养老金
582
-                                    $uer_bill = $spread_data['annuity'] + round($pv * 0.035,2);
582
+                                    $uer_bill = $spread_data['annuity'] + bcmul($pv, 0.035,2);
583 583
 
584 584
 
585 585
                                     $yj_amount_90 = $le_yw_amount * 0.9;
@@ -589,11 +589,11 @@ class Notify
589 589
                                     $fgj_amount = $spread_data['fugou'] + $fgj_amount_10;
590 590
 
591 591
 
592
-                                    $this->con_log($spread_data['uid'],round($gx_jf,2),$store_order_data['order_id'],11,"推广会员专区商品赠送贡献值",1);
592
+                                    $this->con_log($spread_data['uid'],round($gx_jf,2),$store_order_data['order_id'],11,"推广会员专区商品赠送贡献值",1, $pv);
593 593
                                     //养老金
594 594
                                     $this->bill_user_log($spread_data['uid'],round($pv * 0.035,2),$store_order_data['order_id'],5,$store_order_data['order_sn'],'消费获得养老金'.round($pv * 0.035,2),$store_order_data['mer_id']);
595 595
                                     //佣金
596
-                                    $this->bill_user_log($spread_data['uid'], $yj_amount_90,$store_order_data['order_id'],3,$store_order_data['order_sn'],'推广获得金'. $yj_amount_90,$store_order_data['mer_id']);
596
+                                    $this->bill_user_log($spread_data['uid'], $yj_amount_90,$store_order_data['order_id'],3,$store_order_data['order_sn'],'推广获得金'. $yj_amount_90,$store_order_data['mer_id']);
597 597
                                     //复购金
598 598
                                     $this->fugou_user_log($spread_data['uid'],$fgj_amount_10,$store_order_data['order_id'],1,1);
599 599
 
@@ -625,8 +625,8 @@ class Notify
625 625
                                     if(!empty($merchant_user_data)){
626 626
 
627 627
 
628
-                                        $yj_amount_90 = round($pv * 0.035,2) * 0.9;
629
-                                        $fgj_amount_10 = round($pv * 0.035,2) * 0.1;//推广者的佣金抽10%到个人复购金
628
+                                        $yj_amount_90 = bcmul($pv, 0.035,2) * 0.9;
629
+                                        $fgj_amount_10 = bcmul($pv, 0.035,2) * 0.1;//推广者的佣金抽10%到个人复购金
630 630
 
631 631
                                         $yj_amount = $merchant_data['brokerage_price'] + $yj_amount_90;
632 632
                                         $fgj_amount = $merchant_data['fugou'] + $fgj_amount_10;
@@ -636,7 +636,7 @@ class Notify
636 636
 
637 637
                                         //Db::name('user')->where('uid',$merchant_data['uid'])->update(['brokerage_price'=>$yj_amount,'fugou'=>$fgj_amount]);
638 638
                                         //推广佣金
639
-                                        $this->bill_user_log($merchant_data['uid'],round($pv * 0.35,2),$store_order_data['order_id'],3,$store_order_data['order_sn'],'推广获得金'.round($pv * 0.35,2),$store_order_data['mer_id']);
639
+                                        $this->bill_user_log($merchant_data['uid'],round($pv * 0.35,2),$store_order_data['order_id'],3,$store_order_data['order_sn'],'推广获得金'.round($pv * 0.35,2),$store_order_data['mer_id']);
640 640
                                     }
641 641
 
642 642
                                 }
@@ -925,7 +925,7 @@ class Notify
925 925
 
926 926
 
927 927
         //code...
928
-        $pay_gb =  round($orderInfo['num'] * $orderInfo['gb_num'],2);
928
+        $pay_gb =  bcmul($orderInfo['num'], $orderInfo['gb_num'],2);
929 929
         //$pay_vr =  round($orderInfo['num'] * $orderInfo['vr_num'],2);
930 930
         //付款按照700的VR付款 start
931 931
         $vr_num = 0;
@@ -959,17 +959,17 @@ class Notify
959 959
 
960 960
             if($orderInfo['price'] == 1180){
961 961
                 //修改订单到账状态
962
-                $zs_ylj = round(700 * 0.05,2);//计算的养老金 金额
962
+                $zs_ylj = bcmul(700, 0.05,2);//计算的养老金 金额
963 963
             }elseif($orderInfo['price'] == 11800){
964
-                $zs_ylj = round(7000 * 0.05,2);//计算的养老金 金额
964
+                $zs_ylj = bcmul(7000, 0.05,2);//计算的养老金 金额
965 965
             }elseif($orderInfo['price'] == 3540){
966
-                $zs_ylj = round(2100 * 0.05,2);//计算的养老金 金额
966
+                $zs_ylj = bcmul(2100, 0.05,2);//计算的养老金 金额
967 967
             }elseif($orderInfo['price'] == 10620){
968
-                $zs_ylj = round(6300 * 0.05,2);//计算的养老金 金额
968
+                $zs_ylj = bcmul(6300, 0.05,2);//计算的养老金 金额
969 969
             }elseif($orderInfo['price'] == 9440){
970
-                $zs_ylj = round(5600 * 0.05,2);//八单计算的养老金 金额
970
+                $zs_ylj = bcmul(5600, 0.05,2);//八单计算的养老金 金额
971 971
             }elseif($orderInfo['price'] == 2360){
972
-                $zs_ylj = round(1400 * 0.05,2);//两单计算的养老金 金额
972
+                $zs_ylj = bcmul(1400, 0.05,2);//两单计算的养老金 金额
973 973
             }
974 974
 
975 975
 
@@ -1396,15 +1396,15 @@ class Notify
1396 1396
 
1397 1397
 
1398 1398
     //添加贡献值日志
1399
-    public function con_log($uid,$num,$order_id,$order_type,$mark,$status = -1){
1399
+    public function con_log($uid,$num,$order_id,$order_type,$mark,$status = -1, $pv = 0){
1400 1400
 
1401 1401
         $con_data = Db::name('user')->where("uid",$uid)->find();
1402 1402
         //如果状态是1那就是即刻入账,
1403 1403
         if($status == 1){
1404 1404
           
1405 1405
 
1406
-            //如果当前用户是业务经理之前的等级,那么需要将当前用户的直推用户贡献值加到自己贡献值中去
1407
-            if( $con_data['user_group'] <= 2 ){
1406
+            // //如果当前用户是业务经理之前的等级,那么需要将当前用户的直推用户贡献值加到自己贡献值中去
1407
+            // if( $con_data['user_group'] <= 2 ){
1408 1408
            
1409 1409
                 $spread_data = Db::name('user')->where("spread_uid",$uid)->select();
1410 1410
 
@@ -1456,27 +1456,28 @@ class Notify
1456 1456
 
1457 1457
                // }
1458 1458
 
1459
-            }else{
1459
+            // }else{
1460 1460
                 
1461
-                // 检查是否包含“推广”
1462
-                // if (strpos($mark, "推广") !== false) {
1463
-                //     echo "字符串1包含'推广'\n";
1464
-                // }
1461
+            //     // 检查是否包含“推广”
1462
+            //     // if (strpos($mark, "推广") !== false) {
1463
+            //     //     echo "字符串1包含'推广'\n";
1464
+            //     // }
1465 1465
 
1466
-                // 检查是否包含“购买”
1467
-                if (strpos($mark, "购买") !== false) {
1468
-                    Db::name('user')->where("uid",$uid)->update(['contribute'=>$con_data['contribute'] + $num]);
1469
-                }
1466
+            //     // 检查是否包含“购买”
1467
+            //     if (strpos($mark, "购买") !== false) {
1468
+            //         Db::name('user')->where("uid",$uid)->update(['contribute'=>$con_data['contribute'] + $num]);
1469
+            //     }
1470 1470
 
1471 1471
                  
1472 1472
                
1473 1473
                
1474
-            }
1474
+            // }
1475 1475
 
1476 1476
         }
1477 1477
 
1478 1478
         $con = [
1479 1479
             'uid'=>$uid,
1480
+            'pv' => $pv,
1480 1481
             'number'=>$num,//赠送数量
1481 1482
             'status'=>$status,//红包状态
1482 1483
             'mark'=>$mark,//备注

+ 7 - 7
app/controller/api/store/merchant/Taskorder.php

@@ -1593,7 +1593,7 @@ public function getbig_samll_datas_copy($user_id) {
1593 1593
                     //积分
1594 1594
                     $this->score_log($spread_data['uid'],$ssf,$store_order_data['order_id'],11,"精彩生活区商品赠送积分");
1595 1595
                     // //推广佣金
1596
-                    $this->bill_user_log($spread_data['uid'],$yj_amount_90,$store_order_data['order_id'],3,$group_order['group_order_sn'],'推广获得金'.$yj_amount_90,$store_order_data['mer_id'],0);
1596
+                    $this->bill_user_log($spread_data['uid'],$yj_amount_90,$store_order_data['order_id'],3,$group_order['group_order_sn'],'推广获得金'.$yj_amount_90,$store_order_data['mer_id'],0);
1597 1597
                     //养老金
1598 1598
                     $this->bill_user_log($spread_data['uid'],round($pv * 0.05,2),$store_order_data['order_id'],5,$group_order['group_order_sn'],'推广获得养老金'.round($pv * 0.05,2),$store_order_data['mer_id'],0);
1599 1599
                 }
@@ -1620,7 +1620,7 @@ public function getbig_samll_datas_copy($user_id) {
1620 1620
                   //推广养老金
1621 1621
                  // $this->bill_user_log($spread_data['uid'],round($pv * 0.3,2),$store_order_data['order_id'],5,$group_order['group_order_sn'],'推广获得养老金'.round($pv * 0.3,2),$store_order_data['mer_id']);
1622 1622
                   //推广佣金
1623
-                  $this->bill_user_log($spread_data['uid'],$yj_amount_90,$store_order_data['order_id'],3,$group_order['group_order_sn'],'推广获得金'.$yj_amount_90,$store_order_data['mer_id'],0);
1623
+                  $this->bill_user_log($spread_data['uid'],$yj_amount_90,$store_order_data['order_id'],3,$group_order['group_order_sn'],'推广获得金'.$yj_amount_90,$store_order_data['mer_id'],0);
1624 1624
                   $this->con_log($spread_data['uid'],round($pv * 0.03,2),$store_order_data['order_id'],11,"推广会员专区商品赠送贡献值");
1625 1625
                   $this->score_log($spread_data['uid'],round($pv * 0.03,2),$store_order_data['order_id'],11,"推广会员专区商品赠送积分");
1626 1626
                   
@@ -1654,7 +1654,7 @@ public function getbig_samll_datas_copy($user_id) {
1654 1654
                     
1655 1655
                     Db::name('user')->where('uid',$merchant_data['uid'])->update(['brokerage_price'=>$yj_amount,'fugou'=>$fgj_amount]);
1656 1656
                 //推广佣金
1657
-                $this->bill_user_log($merchant_data['uid'],  $yj_amount_90,$store_order_data['order_id'],3,$group_order['group_order_sn'],'推广获得金'.  $yj_amount_90,$store_order_data['mer_id'],0);
1657
+                $this->bill_user_log($merchant_data['uid'],  $yj_amount_90,$store_order_data['order_id'],3,$group_order['group_order_sn'],'推广获得金'.  $yj_amount_90,$store_order_data['mer_id'],0);
1658 1658
                         
1659 1659
                         }
1660 1660
 
@@ -1804,7 +1804,7 @@ public function getbig_samll_datas_copy($user_id) {
1804 1804
                 //养老金
1805 1805
                 $this->bill_user_log($spread_data['uid'],round($pv * 0.035,2),$store_order_data['order_id'],5,$group_order['group_order_sn'],'消费获得养老金'.round($pv * 0.035,2),$store_order_data['mer_id']);
1806 1806
                 //佣金
1807
-                $this->bill_user_log($spread_data['uid'], $yj_amount_90,$store_order_data['order_id'],3,$group_order['group_order_sn'],'推广获得金'. $yj_amount_90,$store_order_data['mer_id']);
1807
+                $this->bill_user_log($spread_data['uid'], $yj_amount_90,$store_order_data['order_id'],3,$group_order['group_order_sn'],'推广获得金'. $yj_amount_90,$store_order_data['mer_id']);
1808 1808
                 //复购金
1809 1809
                 $this->fugou_user_log($spread_data['uid'],$fgj_amount_10,$store_order_data['order_id'],1);
1810 1810
 
@@ -1817,7 +1817,7 @@ public function getbig_samll_datas_copy($user_id) {
1817 1817
                     // //推广养老金
1818 1818
                     // $this->bill_user_log($user_data['spread_uid'],round($pv * 0.01,2),$store_order_data['order_id'],5,$group_order['group_order_sn'],'推广获得养老金'.round($pv * 0.01,2),$store_order_data['mer_id']);
1819 1819
                     // //推广佣金
1820
-                    // $this->bill_user_log($user_data['spread_uid'],round($pv * 0.01,2),$store_order_data['order_id'],3,$group_order['group_order_sn'],'推广获得金'.round($pv * 0.01,2),$store_order_data['mer_id']);
1820
+                    // $this->bill_user_log($user_data['spread_uid'],round($pv * 0.01,2),$store_order_data['order_id'],3,$group_order['group_order_sn'],'推广获得金'.round($pv * 0.01,2),$store_order_data['mer_id']);
1821 1821
                     
1822 1822
                 //获取贡献值和积分和佣金
1823 1823
                 $gx_jf = $spread_data['contribute'] + round($pv * 0.03,2);
@@ -1836,7 +1836,7 @@ public function getbig_samll_datas_copy($user_id) {
1836 1836
                 $this->con_log($spread_data['uid'],round($pv * 0.03,2),$store_order_data['order_id'],11,"推广会员专区商品赠送贡献值");
1837 1837
                 $this->score_log($spread_data['uid'],round($pv * 0.03,2),$store_order_data['order_id'],11,"推广会员专区商品赠送积分");
1838 1838
                 //推广佣金
1839
-                $this->bill_user_log($spread_data['uid'],$yj_amount_90,$store_order_data['order_id'],3,$group_order['group_order_sn'],'推广获得金'.$yj_amount_90,$store_order_data['mer_id']);
1839
+                $this->bill_user_log($spread_data['uid'],$yj_amount_90,$store_order_data['order_id'],3,$group_order['group_order_sn'],'推广获得金'.$yj_amount_90,$store_order_data['mer_id']);
1840 1840
             }
1841 1841
 
1842 1842
         
@@ -1864,7 +1864,7 @@ public function getbig_samll_datas_copy($user_id) {
1864 1864
                 
1865 1865
                 Db::name('user')->where('uid',$merchant_data['uid'])->update(['brokerage_price'=>$yj_amount,'fugou'=>$fgj_amount]);
1866 1866
             //推广佣金
1867
-            $this->bill_user_log($merchant_data['uid'],round($pv * 0.35,2),$store_order_data['order_id'],3,$group_order['group_order_sn'],'推广获得金'.round($pv * 0.35,2),$store_order_data['mer_id']);
1867
+            $this->bill_user_log($merchant_data['uid'],round($pv * 0.35,2),$store_order_data['order_id'],3,$group_order['group_order_sn'],'推广获得金'.round($pv * 0.35,2),$store_order_data['mer_id']);
1868 1868
             }
1869 1869
 
1870 1870
         }

+ 6 - 6
app/controller/api/store/service/Huafei.php

@@ -125,7 +125,7 @@ class Huafei extends BaseController
125 125
 
126 126
 		foreach($data as $k=>$v){
127 127
 
128
-			$commissionMoney = $v['money']*0.04;
128
+			$commissionMoney = $v['money']*0.02;
129 129
 			$systemvalueObj = $goods_obj = Db::name('system_config_value')->where('config_key','sanfangfenpei')->find();
130 130
 
131 131
 			$sanfangfenpei=json_decode($systemvalueObj['value'],true);
@@ -194,7 +194,7 @@ class Huafei extends BaseController
194 194
 	//话费充值推送
195 195
 	public function pushHf($uid, $order_sn, $phone, $money, $order_id = 0){
196 196
 
197
-		$commissionMoney = $money*0.04;
197
+		$commissionMoney = $money*0.02;
198 198
 		//判断数据库有无此订单
199 199
 		$type_shop = 9;
200 200
 		$orderThird = app()->make(UserThirdRepository::class);
@@ -225,13 +225,13 @@ class Huafei extends BaseController
225 225
 		$push = $this->pushOrder($order_sn, $phone, $money);
226 226
 		Db::name('log')->insert(['data'=>'话费充值推送订单返回数据'.json_encode($push)]);
227 227
 		if($push['code'] == '0000'){
228
-			$commissionMoney = $money*0.04;
228
+			$commissionMoney = $money*0.02;
229 229
 			//成功入库记录
230 230
 			$insertdata = [
231 231
 				'uid'=> $uid,
232 232
 				'mobile' => $phone,
233 233
 				'commission'=> $commissionMoney,
234
-				'commission_share'=> 0.04,
234
+				'commission_share'=> 0.02,
235 235
 				'order_number' => $push['data']['order_number'],
236 236
 				'order_sn' => $order_sn,
237 237
 				'amount_price' => $push['data']['amount'],
@@ -246,13 +246,13 @@ class Huafei extends BaseController
246 246
 			Db::name('order_huafei')->insert($insertdata);
247 247
 			return $push;
248 248
 		}else{
249
-			$commissionMoney = $money*0.04;
249
+			$commissionMoney = $money*0.02;
250 250
 			//失败入库记录
251 251
 			$insertdata = [
252 252
 				'uid'=> $uid,
253 253
 				'mobile' => $phone,
254 254
 				'commission'=> $commissionMoney,
255
-				'commission_share'=> 0.04,
255
+				'commission_share'=> 0.02,
256 256
 				'order_number' => '',
257 257
 				'order_sn' => $order_sn,
258 258
 				'amount_price' => $money,

+ 149 - 89
app/controller/api/user/User.php

@@ -41,6 +41,7 @@ use think\facade\Log;
41 41
 use think\facade\Request as r;
42 42
 
43 43
 use app\common\common;
44
+use phpseclib3\Math\BigInteger\Engines\BCMath;
44 45
 
45 46
 class User extends BaseController
46 47
 {
@@ -240,6 +241,8 @@ class User extends BaseController
240 241
                 $children = $this->buildTreeContribute($users, $user['uid']); // 递归查找子节点
241 242
                 if ($children) {
242 243
                     $user['children'] = $children; // 如果有子节点,添加到当前节点
244
+                }else{
245
+                    $user['children'] = [];
243 246
                 }
244 247
                 $user['total_contribute'] = $user['contribute_sum']; // 初始化当前节点的总余额为自身余额
245 248
                 if ($children) { // 如果存在子节点,计算总余额
@@ -337,15 +340,19 @@ class User extends BaseController
337 340
             //如果用户等级为用户身份 只查一级直推
338 341
             //去除掉贡献值最大的下级
339 342
             $child_nums = $this->getRecursiveChildrenChengji($user_id, $number);
340
-            $child_nums_Tree = $this->buildTreeContribute($child_nums);
343
+            $child_nums_Tree = $this->buildTreeContribute($child_nums, $con['spread_uid']);
341 344
             if (empty($child_nums_Tree)){
342 345
                 $child_nums_Tree = $child_nums;
343 346
                 $total_contribute = $child_nums_Tree[0]['per_contribute'];
344 347
             }else{
345 348
                 // 找到贡献值最大的用户的索引
346
-                $maxBalanceIndex = array_search(max(array_column($child_nums_Tree[0]['children'], 'total_contribute')), array_column($child_nums_Tree, 'total_contribute'));
347
-                // 减去该用户的贡献值
348
-                $total_contribute = bcsub($child_nums_Tree[0]['total_contribute'], $child_nums_Tree[0]['children'][$maxBalanceIndex]['total_contribute'], 2);
349
+                if(count($child_nums_Tree[0]['children'])){
350
+                    $maxBalanceIndex = array_search(max(array_column($child_nums_Tree[0]['children'], 'total_contribute')), array_column($child_nums_Tree, 'total_contribute'));
351
+                    // 减去该用户的贡献值
352
+                    $total_contribute = bcsub($child_nums_Tree[0]['total_contribute'], $child_nums_Tree[0]['children'][$maxBalanceIndex]['total_contribute'], 2);
353
+                }else{
354
+                    $total_contribute = $child_nums_Tree[0]['total_contribute'];
355
+                }
349 356
             }
350 357
             $data['team_gongxian_num'] = $total_contribute;
351 358
 
@@ -1489,63 +1496,141 @@ class User extends BaseController
1489 1496
 
1490 1497
     }
1491 1498
 
1492
-    /**
1493
-     * 一壶茶-团队列表
1494
-     */
1495
-    public function team_list()
1496
-    {
1497
-        $teamid = $this->request->uid();
1498
-
1499
-        //return app("json")->fail("未做任何修改");
1500
-        //$teamid =  $this->request->param('teamid');//测试ID
1501
-        //$teamid = 17;
1502 1499
 
1500
+    public function buildTreePv($users, $parentId = 0) {
1501
+        $branch = array();
1502
+        foreach ($users as $user) {
1503
+            if ($user['spread_uid'] == $parentId) {
1504
+                $children = $this->buildTreePv($users, $user['uid']); // 递归查找子节点
1505
+                if ($children) {
1506
+                    $user['children'] = $children; // 如果有子节点,添加到当前节点
1507
+                }else{
1508
+                    $user['children'] = [];
1509
+                }
1510
+                $user['team_count'] = count($children);
1511
+                $user['total_pv'] = $user['pv']; // 初始化当前节点的总余额为自身余额
1512
+                if ($children) { // 如果存在子节点,计算总余额
1513
+                    foreach ($children as $child) {
1514
+                        $user['total_pv'] += $child['total_pv']; // 累加子节点的总余额
1515
+                        $user['team_count'] += $child['team_count'];
1516
+                    }
1517
+                }
1518
+                $branch[] = $user; // 将当前节点添加到树中
1519
+            }
1520
+        }
1521
+        return $branch; // 返回当前分支的所有节点
1522
+    }
1503 1523
 
1504
-        if($teamid == 592){
1505
-             $teamid = 17;//593
1524
+    // 根据父级uid,递归获取所有子级UID数组 默认深度10级
1525
+    public function getdepartmentStatistics($parentUid) {
1526
+        $user = Db::name('user')->where('uid', $parentUid)->field('uid,nickname,avatar,spread_uid,pv,create_time')->find();
1527
+        $uids = [];// 用于存储符合条件的子级 uid
1528
+        $result = [$user]; // 用于存储符合条件的子级数据
1506 1529
 
1507
-//            // $ss=  $this->userupdates($teamid);
1508
-//            // var_dump($ss);
1530
+        // 定义递归函数
1531
+        $recursion = function ($parentUid) use (&$uids, &$result, &$recursion) {
1532
+            // 查询当前父级的所有直接子级
1533
+            $children = Db::name('user')->field('uid,nickname,avatar,spread_uid,pv,create_time')->where("spread_uid", $parentUid)->select()->toArray();
1534
+            // 如果没有子级,直接返回
1535
+            if (!count($children) && count($children) < 1) {
1536
+                return;
1537
+            }
1509 1538
 
1510
- //$team_userinfo_old_jbp22 = $this->getPerformance22(17);
1511
-//var_dump($team_userinfo_old_jbp22);
1512
- $datas_jbp = Db::name('user')->where("status",1)->select();
1539
+            // 遍历每个子级
1540
+            foreach ($children as $childUid) {
1541
+                //如果有重复的就跳过 防止死循环
1542
+                if(in_array($childUid['uid'], $uids)){
1543
+                    continue;
1544
+                }
1545
+                // 将符合条件的子级 uid 添加到结果数组
1546
+                $uids[] = $childUid['uid'];
1547
+                $result[] = $childUid;
1548
+                // 递归查询子级的子级
1549
+                $recursion($childUid['uid']);
1550
+            }
1551
+        };
1513 1552
 
1514
- //var_dump( $team_userinfo_old_jbp22['person_nums_pv']);
1553
+        // 从初始父级开始递归查询
1554
+        $recursion($parentUid);
1515 1555
 
1516
-foreach($datas_jbp as $k=>$v){
1517
-    $team_userinfo_old_jbp22 = $this->getPerformance22($v['uid']);
1518
-    var_dump("id:" . $v['uid'] . "  用户:" . $v['nickname'] . "    小部门贡献值 :" .  $team_userinfo_old_jbp22['person_nums_pv'] . " 大部门: " . $team_userinfo_old_jbp22['common_nums_pv']);
1519
-}
1556
+        return $result; // 返回结果数组,并去重
1557
+    }
1520 1558
 
1521
- return;
1522
-//                 $team_userinfo_old_jbp1 = $this->getPerformance($teamid);
1559
+    /**
1560
+     * 一壶茶-团队列表
1561
+     */
1562
+    public function team_list()
1563
+    {
1564
+        $teamid = $this->request->uid();
1523 1565
 
1524
-//            //return;
1525
-//               var_dump($team_userinfo_old_jbp1);return;
1566
+        //小夏重写部分
1567
+        $user_id = $teamid;
1568
+        //如果下级团队只有一个人 那就不用再查了 为0
1569
+        //如果用户等级为用户身份 只查一级直推
1570
+        //去除掉贡献值最大的下级
1571
+        $user = Db::name('user')->where('uid', $user_id)->field('uid,nickname,avatar,spread_uid,pv,create_time')->find();
1572
+        $child_nums = $this->getdepartmentStatistics($user_id);
1573
+        $child_nums_Tree = $this->buildTreePv($child_nums, $user['spread_uid']);
1574
+        $person_nums_pv = 0;//大部门业绩
1575
+        $common_nums_pv = 0;//小部门业绩
1576
+        $aLL_list = [];//全部数据
1577
+        $person_list = [];//大部门数据
1578
+        $common_list = [];//小部门数据
1579
+        if(count($child_nums_Tree) && isset($child_nums_Tree[0]['children']) && count($child_nums_Tree[0]['children'])){
1580
+            //获取大部门的key
1581
+            $maxBalanceIndex = array_search(max(array_column($child_nums_Tree[0]['children'], 'total_pv')), array_column($child_nums_Tree, 'total_pv'));
1582
+            foreach($child_nums_Tree[0]['children'] as $k=>$v){
1583
+                if($k == $maxBalanceIndex){
1584
+                    $person_list[] = [
1585
+                        "uid" => $v["uid"],
1586
+                        "spread_uid" => $v['spread_uid'],
1587
+                        "nickname" => $v['nickname'],
1588
+                        "avatar" => $v['avatar'],
1589
+                        "pv" => $v['pv'],
1590
+                        "total_performance" => (int)$v['total_pv'],
1591
+                        "create_time" => $v['create_time'],
1592
+                        'team_count'=> $v['team_count']
1593
+                    ];
1594
+                    $person_nums_pv = bcadd($person_nums_pv,$v['total_pv']);
1595
+                }else{
1596
+                    $common_list[] = [
1597
+                        "uid" => $v["uid"],
1598
+                        "spread_uid" => $v['spread_uid'],
1599
+                        "nickname" => $v['nickname'],
1600
+                        "avatar" => $v['avatar'],
1601
+                        "pv" => $v['pv'],
1602
+                        "total_performance" => (int)$v['total_pv'],
1603
+                        "create_time" => $v['create_time'],
1604
+                        'team_count'=> $v['team_count']
1605
+                    ];
1606
+                    $common_nums_pv = bcadd($common_nums_pv,$v['total_pv']);
1607
+                }
1608
+                $aLL_list[] =  [
1609
+                    "uid" => $v["uid"],
1610
+                    "spread_uid" => $v['spread_uid'],
1611
+                    "nickname" => $v['nickname'],
1612
+                    "avatar" => $v['avatar'],
1613
+                    "pv" => $v['pv'],
1614
+                    "total_performance" => (int)$v['total_pv'],
1615
+                    "create_time" => $v['create_time'],
1616
+                    'team_count'=> $v['team_count']
1617
+                ];
1618
+            }
1526 1619
         }
1527 1620
 
1528 1621
 
1529
-        //根据用户找jbp1.0的节点人数组 end
1530
-
1531
-        $datas_jbp = Db::name('old_user_jbp')->where("id",$teamid)->find();//查询旧系统是否有当前会员
1532
-        $type = $this->request->param('type',0);//1:大部门,0:小部门,2:直推
1533
-        // 初始化最终返回的数据
1534
-        $data = [
1535
-            'team_list' => [],
1536
-            'fans_num' => 0, // 粉丝数
1537
-            'new_performance' => 0, // 新增业绩
1538
-            'total_performance' => 0, // 总业绩
1539
-            'person_nums' => 0, // 个人联盟人数
1540
-            'common_nums' => 0, // 公共联盟人数
1541
-            'common_nums_pv' => 0, // 公共联盟PV
1542
-            'person_nums_pv' => 0, // 个人联盟PV
1543
-        ];
1544
-
1545
-        // 如果在旧系统中有数据
1546
-     
1547
-            $team_userinfo_old_jbp1 = $this->getPerformance($teamid);
1548
-            $tes = $this->teamPeople($teamid, $type); // 1:团队, 2:个人
1622
+            $type = $this->request->param('type',0);//1:大部门,0:小部门,2:直推
1623
+            // 初始化最终返回的数据
1624
+            $data = [
1625
+                'team_list' => [],
1626
+                'fans_num' => 0, // 粉丝数
1627
+                'new_performance' => 0, // 新增业绩
1628
+                'total_performance' => 0, // 总业绩
1629
+                'person_nums' => 0, // 个人联盟人数
1630
+                'common_nums' => 0, // 公共联盟人数
1631
+                'common_nums_pv' => 0, // 公共联盟PV
1632
+                'person_nums_pv' => 0, // 个人联盟PV
1633
+            ];
1549 1634
 
1550 1635
             $data1 = [
1551 1636
                 "total" => 100,
@@ -1556,52 +1641,27 @@ foreach($datas_jbp as $k=>$v){
1556 1641
             ];
1557 1642
 
1558 1643
             if ($type != 2) {
1559
-                foreach ($tes as $k => $v) {
1560
-                    $curr_pv = '';
1561
-                    if ($v['curr_type'] == 0) {
1562
-                        $curr_pv = $team_userinfo_old_jbp1['person_nums_pv'];
1563
-                    } elseif ($v['curr_type'] == 1) {
1564
-                        $curr_pv = $team_userinfo_old_jbp1['common_nums_pv'];
1565
-                    } else {
1566
-                        $curr_pv = 0;
1567
-                    }
1568
-
1569
-                    $data1['data'][$k] = [
1570
-                        "uid" => $v["id"],
1571
-                        "nickname" => $v['user_name'] . $curr_pv,
1572
-                        "phone" => "137****3315",
1573
-                        "avatar" => "https://cdn.bjtdba.com/vod/image/2025-01-20/20250120125206881.png",
1574
-                        "create_time" => "2025-01-25 11:00:18",
1575
-                        "identity" => "11",
1576
-                        "level" => "40002",
1577
-                        "partnership" => "22",
1578
-                        "total_performance" => $curr_pv,
1579
-                        "new_performance" => 0,
1580
-                        "team_count" => $v["performance"]['common_nums'] + $v["performance"]['person_nums'] + 1,
1581
-                    ];
1644
+                if($type == 1){
1645
+                    $data1['data'] = $person_list;
1646
+                }else{
1647
+                    $data1['data'] = $common_list;
1582 1648
                 }
1583 1649
             } else {
1584
-                foreach ($tes as $k => $v) {
1585
-                    $data1['data'][$k] = [
1586
-                        "uid" => $v["uid"],
1587
-                        "nickname" => $v['nickname'],
1588
-                        "avatar" => $v['avatar'],
1589
-                        "create_time" => "2025-01-25 11:00:18",
1590
-                    ];
1591
-                }
1650
+                $data1['data'] = $aLL_list;
1592 1651
             }
1593 1652
 
1594 1653
             // 旧系统中的公共部分数据
1654
+            $data['teamid'] = $teamid;
1595 1655
             $data['team_list'] = $data1;
1596
-            $data['fans_num'] = $team_userinfo_old_jbp1['person_nums'] + $team_userinfo_old_jbp1['common_nums'];
1597
-            $data['new_performance'] = 0;
1598
-            $data['total_performance'] = $team_userinfo_old_jbp1['sum_nums_pv'];
1599
-            $data['person_nums'] = $team_userinfo_old_jbp1['common_nums'];
1600
-            $data['common_nums'] = $team_userinfo_old_jbp1['person_nums'];
1601
-            $data['common_nums_pv'] = max($team_userinfo_old_jbp1['common_nums_pv'], $team_userinfo_old_jbp1['person_nums_pv']);
1602
-            $data['person_nums_pv'] = min($team_userinfo_old_jbp1['common_nums_pv'], $team_userinfo_old_jbp1['person_nums_pv']);
1656
+            $data['fans_num'] = $child_nums_Tree[0]['team_count'];//总人数
1657
+            $data['new_performance'] = 0;//新增业绩
1658
+            $data['total_performance'] = (int)bcadd($child_nums_Tree[0]['total_pv'] ?? 0, 0, 2);//总业绩
1659
+            $data['person_nums'] = count($person_list);//大部门人数
1660
+            $data['common_nums'] = count($common_list);//小部门人数
1661
+            $data['common_nums_pv'] = $person_nums_pv;//大部门业绩
1662
+            $data['person_nums_pv'] = $common_nums_pv;//小部门业绩
1603 1663
       
1604
-return app("json")->success($data);
1664
+            return app("json")->success($data);
1605 1665
 // // 查询当前会员旗下的会员数据(分页)
1606 1666
 //         [$page, $limit] = $this->getPage();
1607 1667
 //         $subordinate_members = Db::name('user')