Procházet zdrojové kódy

话费订单养老金入账

xialei před 1 rokem
rodič
revize
3eda139c60
1 změnil soubory, kde provedl 55 přidání a 0 odebrání
  1. 55 0
      app/command/PensionTasks.php

+ 55 - 0
app/command/PensionTasks.php

@@ -55,6 +55,7 @@ class PensionTasks extends Command
55 55
             $this->doThridTaobaoOrderGzc($nowTime, $timeLimit = 2);
56 56
             $this->doThridVipOrderGzc($nowTime, $timeLimit = 2);
57 57
             $this->doThridDyOrderGzc($nowTime, $timeLimit = 2);
58
+            $this->doThridHfOrderGzc($nowTime, $timeLimit = 2);
58 59
             //升级
59 60
 //            $this -> doUpgrade();
60 61
         } catch (\Throwable $e) {
@@ -541,6 +542,60 @@ class PensionTasks extends Command
541 542
         }
542 543
     }
543 544
 
545
+
546
+
547
+    /**
548
+     * 第三方订单话费IN10入账
549
+     * @param $nowTime
550
+     * @param $timeLimit
551
+     * author: php迷途小书童
552
+     * created: 2021/3/20 9:26
553
+     */
554
+    public function doThridHfOrderGzc($nowTime, $timeLimit)
555
+    {
556
+        $cursor = Db::table('rrx_order_huafei')
557
+        ->where('gzc', 0)
558
+        ->where('bill_status', 1)
559
+        ->where('commission', '>', 0)
560
+        ->whereTime('bill_end_time', '<', $nowTime - bcmul((string)$timeLimit, (string)86400))
561
+        ->cursor();
562
+        $ProductRepository       = app()->make(ProductRepository::class);
563
+        $OrderGzcRepository      = app()->make(OrderGzcRepository::class);
564
+        $OrderMerchantRepository = app()->make(OrderMerchantRepository::class);
565
+        foreach ($cursor as $thrid) {
566
+            $uid = $thrid['uid'];
567
+            if (!$uid)
568
+                continue;
569
+            $certification = UserCertification::getInstance()->where('uid', $uid)->find();
570
+            if (!$certification) {
571
+                Log::info('用户ID' . $uid . '未实名认证');
572
+                continue;
573
+            }
574
+            $pension = $ProductRepository->yanglaojin(0, sprintf('%.2f', $thrid['commission']));
575
+            Db::transaction(function () use ($uid, $certification, $thrid, $pension, $OrderGzcRepository, $OrderMerchantRepository) {
576
+                //新增入账明细记录
577
+                $orderId   = $OrderMerchantRepository->getNewOrderId('IN10');
578
+                $create    = [
579
+                    'uid'          => $uid,
580
+                    'platform_no'  => $orderId,
581
+                    'user_name'    => $certification['user_name'],
582
+                    'mobile'       => $certification['mobile'],
583
+                    'user_card'    => $certification['user_card'],
584
+                    'pension'      => $pension,
585
+                    'order_type'   => 6,
586
+                    'out_trade_no' => $thrid['order_sn']
587
+                ];
588
+                $test_user = Db::name('user')->where('uid', $uid)->value('test_user');
589
+                if ($test_user == 0) {
590
+                    $OrderGzcRepository->create($create);
591
+                }
592
+                Db::table('rrx_order_huafei')->update(['gzc' => 1, 'order_tb_id' => $thrid['order_tb_id']]);
593
+            });
594
+        }
595
+    }
596
+
597
+
598
+
544 599
     /**
545 600
      * 第三方订单淘宝IN10入账
546 601
      * @param $nowTime