Selaa lähdekoodia

Merge branch 'master' into dev

sunxbiao 1 vuosi sitten
vanhempi
commit
3b0dc63f22

+ 2 - 0
app/command/CinemaSchedCommand.php

@@ -37,6 +37,8 @@ class CinemaSchedCommand extends Command
37 37
             foreach ($result['cinema_list'] as $key => $value) {
38 38
                 foreach ($filmResult['film_list'] as $subKey => $subValue) {
39 39
                     $this->doCinemaSched($subValue, $value);
40
+//                    if ($subValue['film_sign'] == 'F6556061D4' && $value['cinema_sign'] == 'CCB622D8D8') {
41
+//                    }
40 42
                 }
41 43
             }
42 44
         } catch (\Exception $exception) {

+ 354 - 226
app/command/PensionTasks.php

@@ -58,6 +58,7 @@ class PensionTasks extends Command
58 58
             $this->doThridVipOrderGzc($nowTime, $timeLimit = 2);
59 59
             $this->doThridDyOrderGzc($nowTime, $timeLimit = 2);
60 60
             $this->doThridHfOrderGzc($nowTime, $timeLimit = 2);
61
+            $this->billGzcAdd($nowTime);
61 62
             //升级
62 63
 //            $this -> doUpgrade();
63 64
         } catch (\Throwable $e) {
@@ -68,6 +69,109 @@ class PensionTasks extends Command
68 69
         $output->writeln('pensiontask');
69 70
     }
70 71
 
72
+
73
+    /**
74
+     * 线下支付订单公证处IN10入账
75
+     * @param $nowTime
76
+     * author: php迷途小书童
77
+     * created: 2021/3/20 9:26
78
+     */
79
+    public function billGzcAdd($nowTime)
80
+    {
81
+        $OrderGzcRepository      = app()->make(OrderGzcRepository::class);
82
+        $OrderMerchantRepository = app()->make(OrderMerchantRepository::class);
83
+        $StoreOrderRepository    = app()->make(StoreOrderRepository::class);
84
+        $cursor = Db::table('user_bill')
85
+        ->where('status', 1)
86
+        ->where('is_gzc', 0)
87
+        ->where('commission_type', 5)
88
+        ->select()->toArray();
89
+        foreach ($cursor as $bill) {
90
+            $type_shop = $bill['type_shop'] ?? 0;
91
+
92
+            switch ($type_shop){
93
+                case "0":
94
+                    $online = $cursor = Db::table('rrx_store_order')->where('uid', $bill['uid'])->where('order_sn', $bill['order_sn'])->where('paid', 1)->find();
95
+                    break;
96
+                case "1":
97
+                    $online = Db::table('rrx_order_pdd')->where('uid', $bill['uid'])->where('order_sn', $bill['order_sn'])->find();
98
+                    break;
99
+                case "2":
100
+                    $online =  Db::table('rrx_order_vip')->where('uid', $bill['uid'])->where('order_sn', $bill['order_sn'])->find();
101
+                    break;
102
+                case "3":
103
+                    $online = Db::table('rrx_order_su')->where('uid', $bill['uid'])->where('order_sn', $bill['order_sn'])->find();
104
+                    break;
105
+                case "4":
106
+                    $online = '';
107
+                    break;
108
+                case "5":
109
+                    $online = Db::table('rrx_order_tb')->where('uid', $bill['uid'])->where('order_sn', $bill['order_sn'])->find();
110
+                    break;
111
+                case "6":
112
+                    $online = Db::table('rrx_order_jd')->where('uid', $bill['uid'])->where('order_sn', $bill['order_sn'])->find();
113
+                    break;
114
+                case "7":
115
+                    $online = '';
116
+                    break;
117
+                case "8":
118
+                    $online = '';
119
+                    break;
120
+                case "9":
121
+                    $online = Db::table('rrx_order_huafei')->where('uid', $bill['uid'])->where('order_sn', $bill['order_sn'])->find();
122
+                    break;
123
+                default:
124
+                    $online = Db::table('rrx_store_order')->where('uid', $bill['uid'])->where('order_sn', $bill['order_sn'])->where('paid', 1)->find();
125
+            }
126
+
127
+            if (!$online) {
128
+                Log::info($bill['uid'] . '查询不到订单');
129
+                continue;
130
+            }   
131
+
132
+            $certification = UserCertification::getInstance()->where('uid', $bill['uid'])->find();
133
+            if (!$certification) {
134
+                Log::info($online['uid'] . '没有实名认证');
135
+                continue;
136
+            }   
137
+
138
+            $pension = $bill['number'] ?? 0;
139
+            if ($pension <= 0) {
140
+                Log::info($online['order_sn'] . 'pension' . $pension);
141
+                continue;
142
+            }
143
+
144
+            //新增入账明细记录
145
+            $orderId   = $OrderMerchantRepository->getNewOrderId('IN10');
146
+            $create    = [
147
+                'uid'          => $online['uid'],
148
+                'platform_no'  => $orderId,
149
+                'account_type' => $online['pay_type'] == 1 ? 3 : 2,
150
+                'user_name'    => $certification['user_name'],
151
+                'mobile'       => $certification['mobile'],
152
+                'user_card'    => $certification['user_card'],
153
+                'pension'      => $pension,
154
+                'order_type'   => 2,
155
+                'out_trade_no' => $online['order_sn'],
156
+                'link_id'=> $bill['bill_id']
157
+            ];
158
+            $test_user = Db::name('user')->where('uid', $online['uid'])->value('test_user');
159
+            $check     = Db::name("gzc_logs")->where("link_id", $bill['id'])->where("order_type", 2)->count();
160
+            if ($test_user == 0 && $check <= 0) {
161
+                $OrderGzcRepository->create($create);
162
+                Db::name('user_bill')
163
+                ->where('bill_id', $bill['bill_id'])
164
+                ->where('commission_type', 5)
165
+                ->update([
166
+                    'is_gzc'          => 1
167
+                ]);
168
+            }
169
+        }
170
+
171
+    }
172
+
173
+
174
+
71 175
     /**
72 176
      * 线下支付订单公证处IN10入账
73 177
      * @param $nowTime
@@ -108,56 +212,52 @@ class PensionTasks extends Command
108 212
                 Log::info($offline['pay_user_id'] . '未绑定用户');
109 213
                 continue;
110 214
             }
111
-            $certification = UserCertification::getInstance()->where('uid', $uid)->find();
112
-            if (!$certification) {
113
-                Log::info($offline['pay_user_id'] . '未实名认证');
114
-                continue;
115
-            }
215
+            // $certification = UserCertification::getInstance()->where('uid', $uid)->find();
216
+            // if (!$certification) {
217
+            //     Log::info($offline['pay_user_id'] . '未实名认证');
218
+            //     continue;
219
+            // }
116 220
             //查询养老金金额
117 221
             $UserBillRepository = app()->make(UserBillRepository::class);
118 222
             $bill               = $UserBillRepository->getWhere(['uid' => $uid, 'link_id' => $offline['id'], 'order_sn' => $offline['out_trade_no'], 'title' => '养老金']);
119 223
 
120
-//            if ($bill->status == 0) {
121
-//                Log::info($offline['out_trade_no'] . 'pension未交年费');
122
-//                continue;
123
-//            }
124
-
125 224
             $pension = $bill->number ?? 0;
126
-            if ($pension <= 0) {
127
-                Log::info($offline['out_trade_no'] . 'pension' . $pension);
128
-                continue;
129
-            }
225
+            // if ($pension <= 0) {
226
+            //     Log::info($offline['out_trade_no'] . 'pension' . $pension);
227
+            //     continue;
228
+            // }
130 229
 
131
-            Db::transaction(function () use ($uid, $certification, $accountType, $offline, $OrderGzcRepository, $OrderMerchantRepository, $pension, $StoreOrderRepository) {
230
+            // Db::transaction(function () use ($uid, $certification, $accountType, $offline, $OrderGzcRepository, $OrderMerchantRepository, $pension, $StoreOrderRepository) {
231
+            Db::transaction(function () use ($uid, $accountType, $offline, $OrderGzcRepository, $OrderMerchantRepository, $pension, $StoreOrderRepository) {
132 232
                 $order                  = OrderMerchant::getInstance()->find($offline['id']);
133 233
                 $order->gzc             = 1;
134 234
                 $order->is_settlement   = 1;
135 235
                 $order->settlement_time = date('Y-m-d H:i:s');
136 236
                 $order->save();
137 237
                 //新增入账明细记录
138
-                $orderId   = $OrderMerchantRepository->getNewOrderId('IN10');
139
-                $create    = [
140
-                    'uid'          => $uid,
141
-                    'platform_no'  => $orderId,
142
-                    'account_type' => $accountType,
143
-                    'user_name'    => $certification['user_name'],
144
-                    'mobile'       => $certification['mobile'],
145
-                    'user_card'    => $certification['user_card'],
146
-                    'pension'      => $pension,
147
-                    'order_type'   => 1,
148
-                    'out_trade_no' => $offline['out_trade_no']
149
-                ];
150
-                $test_user = Db::name('user')->where('uid', $uid)->value('test_user');
151
-                if ($test_user == 0) {
152
-                    $OrderGzcRepository->create($create);
153
-                }
154
-                // 养老金区域奖励
155
-                $order_data = [
156
-                    'pay_price'        => $pension,
157
-                    'user_address_ids' => $offline['user_address_ids'],
158
-                    'uid'              => $offline['uid'],
159
-                    'order_sn'         => $offline['out_trade_no']
160
-                ];
238
+                // $orderId   = $OrderMerchantRepository->getNewOrderId('IN10');
239
+                // $create    = [
240
+                //     'uid'          => $uid,
241
+                //     'platform_no'  => $orderId,
242
+                //     'account_type' => $accountType,
243
+                //     'user_name'    => $certification['user_name'],
244
+                //     'mobile'       => $certification['mobile'],
245
+                //     'user_card'    => $certification['user_card'],
246
+                //     'pension'      => $pension,
247
+                //     'order_type'   => 1,
248
+                //     'out_trade_no' => $offline['out_trade_no']
249
+                // ];
250
+                // $test_user = Db::name('user')->where('uid', $uid)->value('test_user');
251
+                // if ($test_user == 0) {
252
+                //     $OrderGzcRepository->create($create);
253
+                // }
254
+                // // 养老金区域奖励
255
+                // $order_data = [
256
+                //     'pay_price'        => $pension,
257
+                //     'user_address_ids' => $offline['user_address_ids'],
258
+                //     'uid'              => $offline['uid'],
259
+                //     'order_sn'         => $offline['out_trade_no']
260
+                // ];
161 261
 //                $StoreOrderRepository->area_manage_details($order_data, 0, 2);
162 262
 
163 263
 
@@ -469,48 +569,53 @@ class PensionTasks extends Command
469 569
                 }
470 570
             }
471 571
 
472
-            $certification = UserCertification::getInstance()->where('uid', $online['uid'])->find();
473
-            if (!$certification) {
474
-                Log::info($online['uid'] . '没有实名认证');
475
-                continue;
476
-            }   
572
+            // $certification = UserCertification::getInstance()->where('uid', $online['uid'])->find();
573
+            // if (!$certification) {
574
+            //     Log::info($online['uid'] . '没有实名认证');
575
+            //     continue;
576
+            // }   
477 577
             //查询养老金金额
478 578
             $UserBillRepository = app()->make(UserBillRepository::class);
479 579
             $bill               = $UserBillRepository->getWhere(['uid' => $online['uid'], 'link_id' => $online['order_id'], 'order_sn' => $online['order_sn'], 'commission_type' => 5]);
480 580
 
481 581
             $pension = $bill->number ?? 0;
482
-            if ($pension <= 0) {
483
-                Log::info($online['order_sn'] . 'pension' . $pension);
484
-                continue;
485
-            }
582
+            // if ($pension <= 0) {
583
+            //     Log::info($online['order_sn'] . 'pension' . $pension);
584
+            //     continue;
585
+            // }
486 586
             //首信易分账
487 587
             // $StoreOrderRepository = app()->make(StoreOrderRepository::class);
488 588
             // if ($online['pay_type'] > 0) {
489 589
             //     $StoreOrderRepository->splitOrder($online);
490 590
             // }
491 591
 
492
-            Db::transaction(function () use ($certification, $online, $pension, $OrderGzcRepository, $OrderMerchantRepository, $StoreOrderRepository) {
592
+            Db::transaction(function () use ($online, $pension, $OrderGzcRepository, $OrderMerchantRepository, $StoreOrderRepository) {
493 593
                 //新增入账明细记录
494
-                $orderId   = $OrderMerchantRepository->getNewOrderId('IN10');
495
-                $create    = [
496
-                    'uid'          => $online['uid'],
497
-                    'platform_no'  => $orderId,
498
-                    'account_type' => $online['pay_type'] == 1 ? 3 : 2,
499
-                    'user_name'    => $certification['user_name'],
500
-                    'mobile'       => $certification['mobile'],
501
-                    'user_card'    => $certification['user_card'],
502
-                    'pension'      => $pension,
503
-                    'order_type'   => 2,
504
-                    'out_trade_no' => $online['order_sn']
505
-                ];
506
-                $test_user = Db::name('user')->where('uid', $online['uid'])->value('test_user');
507
-                $check     = Db::name("gzc_logs")->where("out_trade_no", $online['order_sn'])->where("order_type", 2)->count();
508
-                if ($test_user == 0 && $check <= 0) {
509
-                    $OrderGzcRepository->create($create);
510
-                }
594
+                // $orderId   = $OrderMerchantRepository->getNewOrderId('IN10');
595
+                // $create    = [
596
+                //     'uid'          => $online['uid'],
597
+                //     'platform_no'  => $orderId,
598
+                //     'account_type' => $online['pay_type'] == 1 ? 3 : 2,
599
+                //     'user_name'    => $certification['user_name'],
600
+                //     'mobile'       => $certification['mobile'],
601
+                //     'user_card'    => $certification['user_card'],
602
+                //     'pension'      => $pension,
603
+                //     'order_type'   => 2,
604
+                //     'out_trade_no' => $online['order_sn']
605
+                // ];
606
+                // $test_user = Db::name('user')->where('uid', $online['uid'])->value('test_user');
607
+                // $check     = Db::name("gzc_logs")->where("out_trade_no", $online['order_sn'])->where("order_type", 2)->count();
608
+                // if ($test_user == 0 && $check <= 0) {
609
+                //     $OrderGzcRepository->create($create);
610
+                // }
511 611
                 $order                  = StoreOrder::getInstance()->find($online['order_id']);
512 612
                 $order->gzc             = 1;
513 613
                 $order->save();
614
+                Db::name('user_bill')
615
+                ->where('order_sn', $online['order_sn'])
616
+                ->where('commission_type', 5)
617
+                ->update(['status'=> 1]);
618
+
514 619
                 // 养老金区域奖励
515 620
 //                $order_data = [
516 621
 //                    'pay_price'        => $pension,
@@ -523,7 +628,7 @@ class PensionTasks extends Command
523 628
             });
524 629
         }
525 630
 
526
-        // 普通订单(红包,积分,京东,佣金,复购金,养老金,贡献值)
631
+        // 普通订单(红包,积分,京东,佣金,复购金,贡献值)
527 632
         $cursor = Db::table('rrx_store_order')->where('paid', 1)->where('is_settlement', 0)->where('pay_type', 'in', '0,1,2,4')->cursor();
528 633
         $StoreOrderStatusRepository = app()->make(StoreOrderStatusRepository::class);
529 634
         $OrderMerchantRepository    = app()->make(OrderMerchantRepository::class);
@@ -743,33 +848,36 @@ class PensionTasks extends Command
743 848
             $uid = $thrid['uid'];
744 849
             if (!$uid)
745 850
                 continue;
746
-            $certification = UserCertification::getInstance()->where('uid', $uid)->find();
747
-            if (!$certification) {
748
-                Log::info('用户ID' . $uid . '未实名认证');
749
-                continue;
750
-            }
851
+            // $certification = UserCertification::getInstance()->where('uid', $uid)->find();
852
+            // if (!$certification) {
853
+            //     Log::info('用户ID' . $uid . '未实名认证');
854
+            //     continue;
855
+            // }
751 856
             $pension = $ProductRepository->yanglaojin(0, sprintf('%.2f', $thrid['commission']));
752
-            Db::transaction(function () use ($uid, $certification, $thrid, $pension, $OrderGzcRepository, $OrderMerchantRepository, $StoreOrderRepository) {
857
+            Db::transaction(function () use ($uid,  $thrid, $pension, $OrderGzcRepository, $OrderMerchantRepository, $StoreOrderRepository) {
753 858
                 //新增入账明细记录
754
-                $orderId   = $OrderMerchantRepository->getNewOrderId('IN10');
755
-                $create    = [
756
-                    'uid'          => $uid,
757
-                    'platform_no'  => $orderId,
758
-                    'user_name'    => $certification['user_name'],
759
-                    'mobile'       => $certification['mobile'],
760
-                    'user_card'    => $certification['user_card'],
761
-                    'pension'      => $pension,
762
-                    'order_type'   => 3,
763
-                    'out_trade_no' => $thrid['order_sn']
764
-                ];
765
-                $test_user = Db::name('user')->where('uid', $uid)->value('test_user');
766
-                if ($test_user == 0) {
767
-                    $OrderGzcRepository->create($create);
768
-                }
859
+                // $orderId   = $OrderMerchantRepository->getNewOrderId('IN10');
860
+                // $create    = [
861
+                //     'uid'          => $uid,
862
+                //     'platform_no'  => $orderId,
863
+                //     'user_name'    => $certification['user_name'],
864
+                //     'mobile'       => $certification['mobile'],
865
+                //     'user_card'    => $certification['user_card'],
866
+                //     'pension'      => $pension,
867
+                //     'order_type'   => 3,
868
+                //     'out_trade_no' => $thrid['order_sn']
869
+                // ];
870
+                // $test_user = Db::name('user')->where('uid', $uid)->value('test_user');
871
+                // if ($test_user == 0) {
872
+                //     $OrderGzcRepository->create($create);
873
+                // }
769 874
 //                $OrderGzcRepository->create($create);
770 875
                 Db::table('rrx_order_pdd')
771 876
                     ->update(['gzc' => 1, 'order_pdd_id' => $thrid['order_pdd_id']]);
772
-
877
+                Db::name('user_bill')
878
+                    ->where('order_sn', $thrid['order_sn'])
879
+                    ->where('commission_type', 5)
880
+                    ->update(['status'=> 1]);
773 881
                 // 养老金区域奖励
774 882
                 $order_data = [
775 883
                     'pay_price'        => $pension,
@@ -807,39 +915,43 @@ class PensionTasks extends Command
807 915
             $uid = $thrid['uid'];
808 916
             if (!$uid)
809 917
                 continue;
810
-            $certification = UserCertification::getInstance()->where('uid', $uid)->find();
811
-            if (!$certification) {
812
-                Log::info('用户ID' . $uid . '未实名认证');
813
-                continue;
814
-            }
918
+            // $certification = UserCertification::getInstance()->where('uid', $uid)->find();
919
+            // if (!$certification) {
920
+            //     Log::info('用户ID' . $uid . '未实名认证');
921
+            //     continue;
922
+            // }
815 923
             $pension = $ProductRepository->yanglaojin(0, sprintf('%.2f', $thrid['commission']));
816
-            Db::transaction(function () use ($uid, $certification, $thrid, $pension, $OrderGzcRepository, $OrderMerchantRepository, $StoreOrderRepository) {
924
+            Db::transaction(function () use ($uid, $thrid, $pension, $OrderGzcRepository, $OrderMerchantRepository, $StoreOrderRepository) {
817 925
                 //新增入账明细记录
818
-                $orderId   = $OrderMerchantRepository->getNewOrderId('IN10');
819
-                $create    = [
820
-                    'uid'          => $uid,
821
-                    'platform_no'  => $orderId,
822
-                    'user_name'    => $certification['user_name'],
823
-                    'mobile'       => $certification['mobile'],
824
-                    'user_card'    => $certification['user_card'],
825
-                    'pension'      => $pension,
826
-                    'order_type'   => 4,
827
-                    'out_trade_no' => $thrid['order_sn']
828
-                ];
829
-                $test_user = Db::name('user')->where('uid', $uid)->value('test_user');
830
-                if ($test_user == 0) {
831
-                    $OrderGzcRepository->create($create);
832
-                }
926
+                // $orderId   = $OrderMerchantRepository->getNewOrderId('IN10');
927
+                // $create    = [
928
+                //     'uid'          => $uid,
929
+                //     'platform_no'  => $orderId,
930
+                //     'user_name'    => $certification['user_name'],
931
+                //     'mobile'       => $certification['mobile'],
932
+                //     'user_card'    => $certification['user_card'],
933
+                //     'pension'      => $pension,
934
+                //     'order_type'   => 4,
935
+                //     'out_trade_no' => $thrid['order_sn']
936
+                // ];
937
+                // $test_user = Db::name('user')->where('uid', $uid)->value('test_user');
938
+                // if ($test_user == 0) {
939
+                //     $OrderGzcRepository->create($create);
940
+                // }
833 941
 //                $OrderGzcRepository->create($create);
834 942
                 Db::table('rrx_order_jd')
835 943
                     ->update(['gzc' => 1, 'order_jd_id' => $thrid['order_jd_id']]);
944
+                Db::name('user_bill')
945
+                ->where('order_sn', $thrid['order_sn'])
946
+                ->where('commission_type', 5)
947
+                ->update(['status'=> 1]);
836 948
                 // 养老金区域奖励
837
-                $order_data = [
838
-                    'pay_price'        => $pension,
839
-                    'user_address_ids' => $thrid['user_address_ids'],
840
-                    'uid'              => $thrid['uid'],
841
-                    'order_sn'         => $thrid['order_sn']
842
-                ];
949
+                // $order_data = [
950
+                //     'pay_price'        => $pension,
951
+                //     'user_address_ids' => $thrid['user_address_ids'],
952
+                //     'uid'              => $thrid['uid'],
953
+                //     'order_sn'         => $thrid['order_sn']
954
+                // ];
843 955
 //                $StoreOrderRepository->area_manage_details($order_data, 6, 2);
844 956
             });
845 957
         }
@@ -868,33 +980,36 @@ class PensionTasks extends Command
868 980
             $uid = $thrid['uid'];
869 981
             if (!$uid)
870 982
                 continue;
871
-            $certification = UserCertification::getInstance()->where('uid', $uid)->find();
872
-            if (!$certification) {
873
-                Log::info('用户ID' . $uid . '未实名认证');
874
-                continue;
875
-            }
983
+            // $certification = UserCertification::getInstance()->where('uid', $uid)->find();
984
+            // if (!$certification) {
985
+            //     Log::info('用户ID' . $uid . '未实名认证');
986
+            //     continue;
987
+            // }
876 988
             $pension = $ProductRepository->yanglaojin(0, sprintf('%.2f', $thrid['commission']));
877
-            Db::transaction(function () use ($uid, $certification, $thrid, $pension, $OrderGzcRepository, $OrderMerchantRepository, $StoreOrderRepository) {
989
+            Db::transaction(function () use ($uid, $thrid, $pension, $OrderGzcRepository, $OrderMerchantRepository, $StoreOrderRepository) {
878 990
                 //新增入账明细记录
879
-                $orderId   = $OrderMerchantRepository->getNewOrderId('IN10');
880
-                $create    = [
881
-                    'uid'          => $uid,
882
-                    'platform_no'  => $orderId,
883
-                    'user_name'    => $certification['user_name'],
884
-                    'mobile'       => $certification['mobile'],
885
-                    'user_card'    => $certification['user_card'],
886
-                    'pension'      => $pension,
887
-                    'order_type'   => 5,
888
-                    'out_trade_no' => $thrid['order_sn']
889
-                ];
890
-                $test_user = Db::name('user')->where('uid', $uid)->value('test_user');
891
-                if ($test_user == 0) {
892
-                    $OrderGzcRepository->create($create);
893
-                }
991
+                // $orderId   = $OrderMerchantRepository->getNewOrderId('IN10');
992
+                // $create    = [
993
+                //     'uid'          => $uid,
994
+                //     'platform_no'  => $orderId,
995
+                //     'user_name'    => $certification['user_name'],
996
+                //     'mobile'       => $certification['mobile'],
997
+                //     'user_card'    => $certification['user_card'],
998
+                //     'pension'      => $pension,
999
+                //     'order_type'   => 5,
1000
+                //     'out_trade_no' => $thrid['order_sn']
1001
+                // ];
1002
+                // $test_user = Db::name('user')->where('uid', $uid)->value('test_user');
1003
+                // if ($test_user == 0) {
1004
+                //     $OrderGzcRepository->create($create);
1005
+                // }
894 1006
 //                $OrderGzcRepository->create($create);
895 1007
                 Db::table('rrx_order_su')
896 1008
                     ->update(['gzc' => 1, 'order_su_id' => $thrid['order_su_id']]);
897
-
1009
+                Db::name('user_bill')
1010
+                ->where('order_sn', $thrid['order_sn'])
1011
+                ->where('commission_type', 5)
1012
+                ->update(['status'=> 1]);
898 1013
                 // 养老金区域奖励
899 1014
                 $order_data = [
900 1015
                     'pay_price'        => $pension,
@@ -931,30 +1046,34 @@ class PensionTasks extends Command
931 1046
             $uid = $thrid['uid'];
932 1047
             if (!$uid)
933 1048
                 continue;
934
-            $certification = UserCertification::getInstance()->where('uid', $uid)->find();
935
-            if (!$certification) {
936
-                Log::info('用户ID' . $uid . '未实名认证');
937
-                continue;
938
-            }
1049
+            // $certification = UserCertification::getInstance()->where('uid', $uid)->find();
1050
+            // if (!$certification) {
1051
+            //     Log::info('用户ID' . $uid . '未实名认证');
1052
+            //     continue;
1053
+            // }
939 1054
             $pension = $ProductRepository->yanglaojin(0, sprintf('%.2f', $thrid['commission']));
940
-            Db::transaction(function () use ($uid, $certification, $thrid, $pension, $OrderGzcRepository, $OrderMerchantRepository) {
941
-                //新增入账明细记录
942
-                $orderId   = $OrderMerchantRepository->getNewOrderId('IN10');
943
-                $create    = [
944
-                    'uid'          => $uid,
945
-                    'platform_no'  => $orderId,
946
-                    'user_name'    => $certification['user_name'],
947
-                    'mobile'       => $certification['mobile'],
948
-                    'user_card'    => $certification['user_card'],
949
-                    'pension'      => $pension,
950
-                    'order_type'   => 6,
951
-                    'out_trade_no' => $thrid['order_sn']
952
-                ];
953
-                $test_user = Db::name('user')->where('uid', $uid)->value('test_user');
954
-                if ($test_user == 0) {
955
-                    $OrderGzcRepository->create($create);
956
-                }
1055
+            Db::transaction(function () use ($uid, $thrid, $pension, $OrderGzcRepository, $OrderMerchantRepository) {
1056
+                // //新增入账明细记录
1057
+                // $orderId   = $OrderMerchantRepository->getNewOrderId('IN10');
1058
+                // $create    = [
1059
+                //     'uid'          => $uid,
1060
+                //     'platform_no'  => $orderId,
1061
+                //     'user_name'    => $certification['user_name'],
1062
+                //     'mobile'       => $certification['mobile'],
1063
+                //     'user_card'    => $certification['user_card'],
1064
+                //     'pension'      => $pension,
1065
+                //     'order_type'   => 6,
1066
+                //     'out_trade_no' => $thrid['order_sn']
1067
+                // ];
1068
+                // $test_user = Db::name('user')->where('uid', $uid)->value('test_user');
1069
+                // if ($test_user == 0) {
1070
+                //     $OrderGzcRepository->create($create);
1071
+                // }
957 1072
                 Db::table('rrx_order_huafei')->update(['gzc' => 1, 'order_tb_id' => $thrid['order_tb_id']]);
1073
+                Db::name('user_bill')
1074
+                ->where('order_sn', $thrid['order_sn'])
1075
+                ->where('commission_type', 5)
1076
+                ->update(['status'=> 1]);
958 1077
             });
959 1078
         }
960 1079
     }
@@ -984,33 +1103,36 @@ class PensionTasks extends Command
984 1103
             $uid = $thrid['uid'];
985 1104
             if (!$uid)
986 1105
                 continue;
987
-            $certification = UserCertification::getInstance()->where('uid', $uid)->find();
988
-            if (!$certification) {
989
-                Log::info('用户ID' . $uid . '未实名认证');
990
-                continue;
991
-            }
1106
+            // $certification = UserCertification::getInstance()->where('uid', $uid)->find();
1107
+            // if (!$certification) {
1108
+            //     Log::info('用户ID' . $uid . '未实名认证');
1109
+            //     continue;
1110
+            // }
992 1111
             $pension = $ProductRepository->yanglaojin(0, sprintf('%.2f', $thrid['commission']));
993
-            Db::transaction(function () use ($uid, $certification, $thrid, $pension, $OrderGzcRepository, $OrderMerchantRepository, $StoreOrderRepository) {
1112
+            Db::transaction(function () use ($uid, $thrid, $pension, $OrderGzcRepository, $OrderMerchantRepository, $StoreOrderRepository) {
994 1113
                 //新增入账明细记录
995
-                $orderId   = $OrderMerchantRepository->getNewOrderId('IN10');
996
-                $create    = [
997
-                    'uid'          => $uid,
998
-                    'platform_no'  => $orderId,
999
-                    'user_name'    => $certification['user_name'],
1000
-                    'mobile'       => $certification['mobile'],
1001
-                    'user_card'    => $certification['user_card'],
1002
-                    'pension'      => $pension,
1003
-                    'order_type'   => 6,
1004
-                    'out_trade_no' => $thrid['order_sn']
1005
-                ];
1006
-                $test_user = Db::name('user')->where('uid', $uid)->value('test_user');
1007
-                if ($test_user == 0) {
1008
-                    $OrderGzcRepository->create($create);
1009
-                }
1114
+                // $orderId   = $OrderMerchantRepository->getNewOrderId('IN10');
1115
+                // $create    = [
1116
+                //     'uid'          => $uid,
1117
+                //     'platform_no'  => $orderId,
1118
+                //     'user_name'    => $certification['user_name'],
1119
+                //     'mobile'       => $certification['mobile'],
1120
+                //     'user_card'    => $certification['user_card'],
1121
+                //     'pension'      => $pension,
1122
+                //     'order_type'   => 6,
1123
+                //     'out_trade_no' => $thrid['order_sn']
1124
+                // ];
1125
+                // $test_user = Db::name('user')->where('uid', $uid)->value('test_user');
1126
+                // if ($test_user == 0) {
1127
+                //     $OrderGzcRepository->create($create);
1128
+                // }
1010 1129
 //                $OrderGzcRepository->create($create);
1011 1130
                 Db::table('rrx_order_tb')
1012 1131
                     ->update(['gzc' => 1, 'order_tb_id' => $thrid['order_tb_id']]);
1013
-
1132
+                Db::name('user_bill')
1133
+                ->where('order_sn', $thrid['order_sn'])
1134
+                ->where('commission_type', 5)
1135
+                ->update(['status'=> 1]);
1014 1136
                 // 养老金区域奖励
1015 1137
                 $order_data = [
1016 1138
                     'pay_price'        => $pension,
@@ -1046,33 +1168,36 @@ class PensionTasks extends Command
1046 1168
             $uid = $thrid['uid'];
1047 1169
             if (!$uid)
1048 1170
                 continue;
1049
-            $certification = UserCertification::getInstance()->where('uid', $uid)->find();
1050
-            if (!$certification) {
1051
-                Log::info('用户ID' . $uid . '未实名认证');
1052
-                continue;
1053
-            }
1171
+            // $certification = UserCertification::getInstance()->where('uid', $uid)->find();
1172
+            // if (!$certification) {
1173
+            //     Log::info('用户ID' . $uid . '未实名认证');
1174
+            //     continue;
1175
+            // }
1054 1176
             $pension = $ProductRepository->yanglaojin(0, sprintf('%.2f', $thrid['commission']));
1055
-            Db::transaction(function () use ($uid, $certification, $thrid, $pension, $OrderGzcRepository, $OrderMerchantRepository, $StoreOrderRepository) {
1177
+            Db::transaction(function () use ($uid, $thrid, $pension, $OrderGzcRepository, $OrderMerchantRepository, $StoreOrderRepository) {
1056 1178
                 //新增入账明细记录
1057
-                $orderId   = $OrderMerchantRepository->getNewOrderId('IN10');
1058
-                $create    = [
1059
-                    'uid'          => $uid,
1060
-                    'platform_no'  => $orderId,
1061
-                    'user_name'    => $certification['user_name'],
1062
-                    'mobile'       => $certification['mobile'],
1063
-                    'user_card'    => $certification['user_card'],
1064
-                    'pension'      => $pension,
1065
-                    'order_type'   => 7,
1066
-                    'out_trade_no' => $thrid['order_sn']
1067
-                ];
1068
-                $test_user = Db::name('user')->where('uid', $uid)->value('test_user');
1069
-                if ($test_user == 0) {
1070
-                    $OrderGzcRepository->create($create);
1071
-                }
1179
+                // $orderId   = $OrderMerchantRepository->getNewOrderId('IN10');
1180
+                // $create    = [
1181
+                //     'uid'          => $uid,
1182
+                //     'platform_no'  => $orderId,
1183
+                //     'user_name'    => $certification['user_name'],
1184
+                //     'mobile'       => $certification['mobile'],
1185
+                //     'user_card'    => $certification['user_card'],
1186
+                //     'pension'      => $pension,
1187
+                //     'order_type'   => 7,
1188
+                //     'out_trade_no' => $thrid['order_sn']
1189
+                // ];
1190
+                // $test_user = Db::name('user')->where('uid', $uid)->value('test_user');
1191
+                // if ($test_user == 0) {
1192
+                //     $OrderGzcRepository->create($create);
1193
+                // }
1072 1194
 //                $OrderGzcRepository->create($create);
1073 1195
                 Db::table('rrx_order_vip')
1074 1196
                     ->update(['gzc' => 1, 'order_vip_id' => $thrid['order_vip_id']]);
1075
-
1197
+                Db::name('user_bill')
1198
+                    ->where('order_sn', $thrid['order_sn'])
1199
+                    ->where('commission_type', 5)
1200
+                    ->update(['status'=> 1]);
1076 1201
                 // 养老金区域奖励
1077 1202
                 $order_data = [
1078 1203
                     'pay_price'        => $pension,
@@ -1108,32 +1233,35 @@ class PensionTasks extends Command
1108 1233
             $uid = $thrid['uid'];
1109 1234
             if (!$uid)
1110 1235
                 continue;
1111
-            $certification = UserCertification::getInstance()->where('uid', $uid)->find();
1112
-            if (!$certification) {
1113
-                Log::info('用户ID' . $uid . '未实名认证');
1114
-                continue;
1115
-            }
1236
+            // $certification = UserCertification::getInstance()->where('uid', $uid)->find();
1237
+            // if (!$certification) {
1238
+            //     Log::info('用户ID' . $uid . '未实名认证');
1239
+            //     continue;
1240
+            // }
1116 1241
             $pension = $ProductRepository->yanglaojin(0, sprintf('%.2f', $thrid['commission']));
1117
-            Db::transaction(function () use ($uid, $certification, $thrid, $pension, $OrderGzcRepository, $OrderMerchantRepository, $StoreOrderRepository) {
1118
-                //新增入账明细记录
1119
-                $orderId   = $OrderMerchantRepository->getNewOrderId('IN10');
1120
-                $create    = [
1121
-                    'uid'          => $uid,
1122
-                    'platform_no'  => $orderId,
1123
-                    'user_name'    => $certification['user_name'],
1124
-                    'mobile'       => $certification['mobile'],
1125
-                    'user_card'    => $certification['user_card'],
1126
-                    'pension'      => $pension,
1127
-                    'order_type'   => 8,
1128
-                    'out_trade_no' => $thrid['order_sn']
1129
-                ];
1130
-                $test_user = Db::name('user')->where('uid', $uid)->value('test_user');
1131
-                if ($test_user == 0) {
1132
-                    $OrderGzcRepository->create($create);
1133
-                }
1242
+            Db::transaction(function () use ($uid, $thrid, $pension, $OrderGzcRepository, $OrderMerchantRepository, $StoreOrderRepository) {
1243
+                // //新增入账明细记录
1244
+                // $orderId   = $OrderMerchantRepository->getNewOrderId('IN10');
1245
+                // $create    = [
1246
+                //     'uid'          => $uid,
1247
+                //     'platform_no'  => $orderId,
1248
+                //     'user_name'    => $certification['user_name'],
1249
+                //     'mobile'       => $certification['mobile'],
1250
+                //     'user_card'    => $certification['user_card'],
1251
+                //     'pension'      => $pension,
1252
+                //     'order_type'   => 8,
1253
+                //     'out_trade_no' => $thrid['order_sn']
1254
+                // ];
1255
+                // $test_user = Db::name('user')->where('uid', $uid)->value('test_user');
1256
+                // if ($test_user == 0) {
1257
+                //     $OrderGzcRepository->create($create);
1258
+                // }
1134 1259
                 Db::table('rrx_order_dy')
1135 1260
                     ->update(['gzc' => 1, 'order_dy_id' => $thrid['order_dy_id']]);
1136
-
1261
+                Db::name('user_bill')
1262
+                    ->where('order_sn', $thrid['order_sn'])
1263
+                    ->where('commission_type', 5)
1264
+                    ->update(['status'=> 1]);
1137 1265
                 // 养老金区域奖励
1138 1266
                 $order_data = [
1139 1267
                     'pay_price'        => $pension,

+ 8 - 12
app/common/repositories/movie/MovieRepository.php

@@ -123,22 +123,18 @@ class MovieRepository extends BaseRepository
123 123
     {
124 124
         $result = DouHuoMallFilmApiRequest::getSchedSeat($relation_id, $sched_sign);
125 125
 
126
-        $schedSeatList = (isset($result['code']) && ($result['code'] == ApiResponseService::DEFAULT_SUCCESS_CODE))
127
-            ? $result['data']['list'] : [];
126
+        $schedSeatList = (isset($result['code']) && ($result['code'] == ApiResponseService::DEFAULT_SUCCESS_CODE)) ? $result['data'] : [];
128 127
         foreach ($schedSeatList as $key => $value) {
129
-            $tmpprice = json_decode($value['price'], true);
130
-            if (isset($tmpprice['P2'])) {
131
-                $price = $tmpprice['P2'];
132
-            } elseif (isset($tmpprice['P1'])) {
133
-                $price = $tmpprice['P1'];
134
-            } elseif (isset($tmpprice['P0'])) {
135
-                $price = $tmpprice['P0'];
136
-            } else {
137
-                $price = 0.00;
128
+            $tmpprice = [];
129
+            foreach ($value['price'] as $pKey => $pValue) {
130
+                $tmpprice[$pValue] = ['channel_type' => $pKey, 'price' => $pValue];
138 131
             }
132
+            ksort($tmpprice);
133
+            $tmpprice = array_shift($tmpprice);
139 134
             unset($schedSeatList[$key]['price']);
140 135
 
141
-            $pcYanglaojinGongxian = self::getPvYanglaojinScore($price);
136
+            $pcYanglaojinGongxian = self::getPvYanglaojinScore($tmpprice['price']);
137
+            $schedSeatList[$key]['channel_type'] = $tmpprice['channel_type'];
142 138
             $schedSeatList[$key]['price'] = $pcYanglaojinGongxian['cost_price'];
143 139
             $schedSeatList[$key]['yanglaojin'] = $pcYanglaojinGongxian['yanglaojin'];
144 140
             $schedSeatList[$key]['pv'] = $pcYanglaojinGongxian['pv'];

+ 39 - 33
app/common/repositories/store/product/ProductRepository.php

@@ -381,6 +381,12 @@ 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
+
385
+                $value['cost'] = bcsub($value['price'], bcmul($value['price'], $value['extension_one'] / 100, 2), 2);
386
+                $value['gong_mer_profit'] = bcmul($value['price'], $value['extension_one'] / 100, 2);
387
+                $value['gong_market_price'] = bcadd($value['cost'], $value['gong_mer_profit'], 2);
388
+                $value['plate_mer_profit'] = $value['gong_mer_profit'];
389
+
384 390
                 $sku = '';
385 391
                 if (isset($value['detail']) && is_array($value['detail'])) {
386 392
                     $sku = implode(',', $value['detail']);
@@ -1019,7 +1025,7 @@ class ProductRepository extends BaseRepository
1019 1025
                 $s = 8000;
1020 1026
             }
1021 1027
 
1022
-            $res['yanglao'] = round($s * 0.035,2);
1028
+            $res['yanglao'] = bcmul($s, 0.035, 2);  
1023 1029
         }
1024 1030
 
1025 1031
 
@@ -1695,8 +1701,8 @@ class ProductRepository extends BaseRepository
1695 1701
 
1696 1702
             if($product['mer_id'] == 496){
1697 1703
 
1698
-                $yanglao = round($num_yl * 0.035, 2);
1699
-                $pv=$num_yl *0.7;
1704
+                $yanglao = bcmul($num_yl, 0.035, 2);
1705
+                $pv = bcmul($num_yl, 0.7, 2);
1700 1706
                 //$v['vr']=$v['price'];
1701 1707
                 //1:为会员专区,
1702 1708
 
@@ -1709,24 +1715,24 @@ class ProductRepository extends BaseRepository
1709 1715
 
1710 1716
             }else if($product['mer_id'] == 439){
1711 1717
                 //精彩生活和商贸区
1712
-                $jf = $product['price'] - round($product['concession_pri']*0.3, 2) . ' + ' . round($product['concession_pri']*0.3, 2);
1713
-                $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);
1714 1720
                 if($product['concession_pri'] !=null || $product['concession_pri'] !=0){
1715
-                    $yanglao = round($product['concession_pri'] * 0.3, 2);
1716
-                    $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);
1717 1723
                     $srtArry['jfduihuan'] =$jf;
1718 1724
                     $srtArry['jdduihuan'] = $jd;
1719
-                    $jifen = round($product['concession_pri'] * 0.35, 2);
1720
-                    $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);
1721 1727
 
1722
-                    $jcvr = $product['price'] - round($product['concession_pri']*0.3, 2);
1723
-                    $jcjf = round($product['concession_pri']*0.3, 2);
1724
-                    $jcprice = $product['price'] - round($product['concession_pri']*0.3, 2);
1725
-                    $jcjf1 = round($product['concession_pri']*0.3, 2);
1726
-                    $jcvr1 = $product['price'] - round($product['concession_pri']*0.35, 2);
1727
-                    $jcjd = round($product['concession_pri']*0.35, 2);
1728
-                    $jcprice1 = $product['price'] - round($product['concession_pri']*0.35, 2);
1729
-                    $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);
1730 1736
 
1731 1737
 
1732 1738
                     //支付组合
@@ -1758,7 +1764,7 @@ class ProductRepository extends BaseRepository
1758 1764
                 // 获取商品sku
1759 1765
                 $productSku = Db::name('store_product_attr_value')->where('product_id', $good_id)->order('price asc')->find();
1760 1766
                 $pv = $productSku['plate_mer_profit']??0.00;
1761
-                $yanglao = round($pv * 0.5, 2);
1767
+                $yanglao = bcmul($pv, 0.5, 2);
1762 1768
                 //$v['vr']=$v['price'];
1763 1769
                 //1:为会员专区,
1764 1770
 
@@ -1777,24 +1783,24 @@ class ProductRepository extends BaseRepository
1777 1783
                 // 1企业2个体3个人
1778 1784
                 if ($merchantInfo && in_array($merchantInfo['type'],[2,3])) {
1779 1785
                     //商贸区
1780
-                    $jf = $product['price'] - round($product['concession_pri']*0.3, 2) . ' + ' . round($product['concession_pri']*0.3, 2);
1781
-                    $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);
1782 1788
                     if($product['concession_pri'] !=null || $product['concession_pri'] !=0){
1783
-                        $yanglao = round($product['concession_pri'] * 0.3, 2);
1784
-                        $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);
1785 1791
                         $srtArry['jfduihuan'] =$jf;
1786 1792
                         $srtArry['jdduihuan'] = $jd;
1787
-                        $jifen = round($product['concession_pri'] * 0.35, 2);
1788
-                        $gongxian = round($product['concession_pri'] * 0.35, 2);
1789
-
1790
-                        $jcvr = $product['price'] - round($product['concession_pri']*0.3, 2);
1791
-                        $jcjf = round($product['concession_pri']*0.3, 2);
1792
-                        $jcprice = $product['price'] - round($product['concession_pri']*0.3, 2);
1793
-                        $jcjf1 = round($product['concession_pri']*0.3, 2);
1794
-                        $jcvr1 = $product['price'] - round($product['concession_pri']*0.35, 2);
1795
-                        $jcjd = round($product['concession_pri']*0.35, 2);
1796
-                        $jcprice1 = $product['price'] - round($product['concession_pri']*0.35, 2);
1797
-                        $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);
1798 1804
 
1799 1805
                         $fzone_paytype= [
1800 1806
 //                ['type'=>'b1','price'=>$jcvr,'other'=>$jcjf],

+ 9 - 9
app/common/repositories/system/merchant/MerchantRepository.php

@@ -455,8 +455,8 @@ class MerchantRepository extends BaseRepository
455 455
 
456 456
             if($merId == 496){
457 457
 
458
-                $v['yanglao'] = round($num_yl * 0.035, 2);
459
-                $v['pv']=$num_yl *0.7;
458
+                $v['yanglao'] = bcmul($num_yl, 0.035, 2);
459
+                $v['pv'] = bcmul($num_yl, 0.7, 2);
460 460
                 //$v['vr']=$v['price'];
461 461
                 //1:为会员专区,
462 462
 
@@ -469,15 +469,15 @@ class MerchantRepository extends BaseRepository
469 469
 
470 470
             }else if($merId == 439 || $is_commercetrade){
471 471
                 //精彩生活和商贸区
472
-                $jf = $v['price'] - round($v['concession_pri']*0.3, 2) . ' + ' . round($v['concession_pri']*0.3, 2);
473
-                $jd = $v['price'] - round($v['concession_pri']*0.35, 2) . ' + ' . round($v['concession_pri']*0.35, 2);
472
+                $jf = $v['price'] - bcmul($v['concession_pri'],0.3, 2) . ' + ' . bcmul($v['concession_pri'],0.3, 2);
473
+                $jd = $v['price'] - bcmul($v['concession_pri'],0.35, 2) . ' + ' . bcmul($v['concession_pri'],0.35, 2);
474 474
                 if($v['concession_pri'] !=null || $v['concession_pri'] !=0){
475
-                    $v['yanglao'] = round($v['concession_pri'] * 0.3, 2);
476
-                    $v['pv'] = round($v['concession_pri'] * 0.35, 2);
475
+                    $v['yanglao'] = bcmul($v['concession_pri'],0.3, 2);
476
+                    $v['pv'] = bcmul($v['concession_pri'],0.35, 2);
477 477
                     $v['jfduihuan'] =$jf;
478 478
                     $v['jdduihuan'] = $jd;
479
-                    $v['jifen'] = round($v['concession_pri'] * 0.35, 2);
480
-                    $v['gongxian'] = round($v['concession_pri'] * 0.35, 2);
479
+                    $v['jifen'] = bcmul($v['concession_pri'], 0.35, 2);
480
+                    $v['gongxian'] = bcmul($v['concession_pri'], 0.35, 2);
481 481
                 }
482 482
             }else if($merId == 491){
483 483
                 // 获取商品sku
@@ -486,7 +486,7 @@ class MerchantRepository extends BaseRepository
486 486
 
487 487
 //                $num_yl = $v['price'];
488 488
 //                $pv= $num_yl * 0.3;
489
-                $yanglao = round($pv * 0.5, 2);
489
+                $yanglao = bcmul($pv, 0.5, 2);
490 490
                 $v['pv'] = $pv;
491 491
                 $v['yanglao'] = $yanglao;
492 492
 

+ 1 - 1
app/controller/api/movie/Movie.php

@@ -189,7 +189,7 @@ class Movie extends BaseController
189 189
         );
190 190
 
191 191
         if (empty($params['relation_id']) || empty($params['sched_sign'])) return app('json')->fail('请选择观影场次');
192
-        if (empty($params['seat_no']) || empty($params['seat_sign'])) return app('json')->fail('请选择座位');
192
+        if (empty($params['seat_no']) || empty($params['seat_sign'])) return app('json')->fail('请选择观影座位');
193 193
 
194 194
         $result = $this->repository->submitOrder($this->request->userInfo(), $params);
195 195
         if (!empty($result)) {

+ 101 - 13
app/controller/api/user/User.php

@@ -231,6 +231,75 @@ class User extends BaseController
231 231
         log::info("=======date==={$data}");
232 232
         return app("json")->success($data);
233 233
     }
234
+
235
+
236
+    public function buildTreeContribute($users, $parentId = 0) {
237
+        $branch = array();
238
+        foreach ($users as $user) {
239
+            if ($user['spread_uid'] == $parentId) {
240
+                $children = $this->buildTreeContribute($users, $user['uid']); // 递归查找子节点
241
+                if ($children) {
242
+                    $user['children'] = $children; // 如果有子节点,添加到当前节点
243
+                }
244
+                $user['total_contribute'] = $user['contribute_sum']; // 初始化当前节点的总余额为自身余额
245
+                if ($children) { // 如果存在子节点,计算总余额
246
+                    foreach ($children as $child) {
247
+                        $user['total_contribute'] += $child['total_contribute']; // 累加子节点的总余额
248
+                    }
249
+                }
250
+                $branch[] = $user; // 将当前节点添加到树中
251
+            }
252
+        }
253
+        return $branch; // 返回当前分支的所有节点
254
+    }
255
+
256
+    // 根据父级uid,递归获取所有子级UID数组 默认深度10级
257
+    public function getRecursiveChildrenChengji($parentUid, $number = 10) {
258
+        $user = Db::name('user')->where('uid', $parentUid)->field('uid,spread_uid,contribute,per_contribute')->find();
259
+        $user['contribute_sum'] = bcadd($user['contribute'], $user['per_contribute'], 2);
260
+        $uids = [];// 用于存储符合条件的子级 uid
261
+        $result = [$user]; // 用于存储符合条件的子级数据
262
+
263
+        // 定义递归函数
264
+        $num = 0;//当前层级
265
+        $recursion = function ($parentUid, $number, $num) use (&$uids, &$result, &$recursion) {
266
+            if($num >= $number){ 
267
+                return;
268
+            }
269
+
270
+            // 查询当前父级的所有直接子级
271
+            $children = Db::name('user')->field('uid,spread_uid,contribute,per_contribute')->where("spread_uid", $parentUid)->select()->toArray();
272
+            // 如果没有子级,直接返回
273
+            if (!count($children) && count($children) < 1) {
274
+                return;
275
+            }else{
276
+                $num = $num + 1;
277
+            }
278
+
279
+            // 遍历每个子级
280
+            foreach ($children as $childUid) {
281
+                //如果有重复的就跳过 防止死循环
282
+                if(in_array($childUid['uid'], $uids)){
283
+                    continue;
284
+                }
285
+                // 将符合条件的子级 uid 添加到结果数组
286
+                $uids[] = $childUid['uid'];
287
+
288
+                // 将符合条件的子级 uid 添加到结果数组
289
+                $childUid['contribute_sum'] = bcadd($childUid['contribute'], $childUid['per_contribute'], 2);
290
+                $result[] = $childUid;
291
+
292
+                // 递归查询子级的子级
293
+                $recursion($childUid['uid'], $number, $num);
294
+            }
295
+        };
296
+
297
+        // 从初始父级开始递归查询
298
+        $recursion($parentUid, $number, $num);
299
+
300
+        return $result; // 返回结果数组,并去重
301
+    }
302
+
234 303
     //贡献值
235 304
 
236 305
     public function  gongxian_info(){
@@ -245,33 +314,52 @@ class User extends BaseController
245 314
             //     $totalcon += $v['number'];
246 315
             // }
247 316
             //已经入账贡献值
248
-            if( $con['user_group'] <= 2 ){
249
-                $data['total_source'] =  $con['contribute'] + $con['per_contribute'];
250
-            }else{
251
-                $data['total_source'] =  $con['contribute'];
252
-            }
317
+            // if( $con['user_group'] <= 2 ){
318
+            //     $data['total_source'] =  $con['contribute'] + $con['per_contribute'];
319
+            // }else{
320
+            $data['total_source'] =  $con['contribute'];
321
+            // }
253 322
            
254 323
             
255 324
            // $getteamscon = $this->getPerformance($user->uid);
256 325
 
257 326
             //$getcon = $this->getPerformance_getcon( $user->uid);
258 327
 
259
-            $team_userinfo_old_jbp22 = $this->getPerformance22($user->uid);
328
+            // $team_userinfo_old_jbp22 = $this->getPerformance22($user->uid);
260 329
 
261
-            //我的团队贡献值
262
-            if( $con['user_group'] <= 2 ){
263
-                $data['team_gongxian_num'] =  $team_userinfo_old_jbp22['person_nums_pv'] - $con['per_contribute'];
330
+            $user_id = $con['uid'];
331
+            $user_group = $con['user_group'];
332
+            $number = 10;
333
+            if($user_group <= 1){
334
+                $number = 1;
335
+            }
336
+            //如果下级团队只有一个人 那就不用再查了 为0
337
+            //如果用户等级为用户身份 只查一级直推
338
+            //去除掉贡献值最大的下级
339
+            $child_nums = $this->getRecursiveChildrenChengji($user_id, $number);
340
+            $child_nums_Tree = $this->buildTreeContribute($child_nums);
341
+            if (empty($child_nums_Tree)){
342
+                $child_nums_Tree = $child_nums;
343
+                $total_contribute = $child_nums_Tree[0]['per_contribute'];
264 344
             }else{
265
-                $data['team_gongxian_num'] = $team_userinfo_old_jbp22['person_nums_pv'];
345
+                // 找到贡献值最大的用户的索引
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);
266 349
             }
350
+            $data['team_gongxian_num'] = $total_contribute;
267 351
 
268
-           
352
+            //我的团队贡献值
353
+            // if( $con['user_group'] <= 2 ){
354
+            //     $data['team_gongxian_num'] = $team_userinfo_old_jbp22['person_nums_pv'] - $con['per_contribute'];
355
+            // }else{
356
+            //     $data['team_gongxian_num'] = $team_userinfo_old_jbp22['person_nums_pv'];
357
+            // }
269 358
 
270
-            //为生贡献值
359
+            //未生效贡献值
271 360
             $data['no_total_source']=Db::name('user_sign_gongxian')->where('status', -1)->where('uid', $user->uid)->sum('number');
272 361
             log::info("====spread_info_yhc=={$data['total_source']}======={$data['no_total_source']}");
273 362
             return app('json')->success($data);
274
-
275 363
         }
276 364
 
277 365
     }

+ 4 - 4
crmeb/listens/GongListen.php

@@ -21,10 +21,10 @@ class GongListen implements ListenerInterface
21 21
         $storeOrderRepository = app()->make(StoreOrderRepository::class);
22 22
         Timer::tick(60000, function () use ($storeOrderRepository) {
23 23
             //每天下午3点执行一次
24
-            if (date('i') == '00') {
24
+            // if (date('i') == '00') {
25 25
                 $storeOrderRepository->douhuomall_delivery();
26
-                $this->mer_365_up();
27
-            }
26
+                // $this->mer_365_up();
27
+            // }
28 28
             //每天晚上1点
29 29
             if (date('H:i') == '01:00') {
30 30
 //                $storeOrderRepository->yihuchashengji();
@@ -34,7 +34,7 @@ class GongListen implements ListenerInterface
34 34
 //                $storeOrderRepository->yihuchafenxiang();
35 35
             }
36 36
             if (date('H:i') == '23:00') {
37
-                $this->take();
37
+                // $this->take();
38 38
             }
39 39
         });
40 40
     }