Sfoglia il codice sorgente

Merge remote-tracking branch 'origin/master'

橙汁先生 1 anno fa
parent
commit
579a40e5fc

+ 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

+ 4 - 3
app/controller/api/business/BusinessSchool.php

@@ -17,7 +17,8 @@ class BusinessSchool  extends BaseController
17 17
         $this->merId =  $this->request->header('merId');
18 18
     }
19 19
     public function classify_list(){
20
-        $list = Db::name("business_school_classify")->field('id,name') ->where('mer_id',$this->merId)->where('state',1)->where('is_del',0)->order("sort desc,id desc")-> select() -> toArray();
20
+        // $list = Db::name("business_school_classify")->field('id,name') ->where('mer_id',$this->merId)->where('state',1)->where('is_del',0)->order("sort desc,id desc")-> select() -> toArray();
21
+        $list = Db::name("business_school_classify")->field('id,name')->where('state',1)->where('is_del',0)->order("sort desc,id desc")-> select() -> toArray();
21 22
         return app("json") -> success($list);
22 23
     }
23 24
 
@@ -27,7 +28,7 @@ class BusinessSchool  extends BaseController
27 28
         $query=Db::name('business_school')
28 29
             -> alias("sp")
29 30
             -> join("business_school_classify spc","sp.classify = spc.id","left")
30
-            ->where('spc.mer_id',$this->merId)
31
+            // ->where('spc.mer_id',$this->merId)
31 32
             ->where('sp.state',1)
32 33
             ->where('sp.is_del',0)
33 34
             -> when(!empty($where['classify']),function ($query) use ($where){
@@ -42,7 +43,7 @@ class BusinessSchool  extends BaseController
42 43
         $data=Db::name('business_school')
43 44
             -> alias("sp")
44 45
             -> join("business_school_classify spc","sp.classify = spc.id","left")
45
-            ->where('spc.mer_id',$this->merId)
46
+            // ->where('spc.mer_id',$this->merId)
46 47
             ->where('sp.state',1)
47 48
             ->where('sp.id',$id)
48 49
             ->field("sp.id,sp.name,sp.image,sp.cover,sp.type,DATE(sp.create_time) as create_time,sp.mp4,sp.content,sp.reading,spc.name as classify_name")