Explorar o código

Merge branch 'master' into huangfamily

family hai 1 ano
pai
achega
6459eaf009

+ 87 - 0
app/command/HuafeiOrderIndependentAccount.php

@@ -0,0 +1,87 @@
1
+<?php
2
+
3
+namespace app\command;
4
+
5
+use app\common\model\store\order\StoreOrder;
6
+use app\common\model\user\UserCertification;
7
+use app\common\repositories\merchant\order\OrderGzcRepository;
8
+use app\common\repositories\merchant\order\OrderMerchantRepository;
9
+use app\common\repositories\store\order\StoreOrderRepository;
10
+use app\common\repositories\store\order\StoreOrderStatusRepository;
11
+use app\common\repositories\user\UserBillRepository;
12
+use app\common\repositories\user\UserRepository;
13
+use Carbon\Carbon;
14
+use think\console\Command;
15
+use think\console\Input;
16
+use think\console\Output;
17
+use think\facade\Db;
18
+use think\facade\Log;
19
+
20
+class HuafeiOrderIndependentAccount extends Command
21
+{
22
+    protected function configure()
23
+    {
24
+        // 指令配置
25
+        $this->setName('huafei-order-independent-account')
26
+            ->setDescription('话费订单分账');
27
+    }
28
+
29
+    protected function execute(Input $input, Output $output)
30
+    {
31
+        // @todo 精彩生活区订单分账
32
+        $this->doHuafeiOrderIndependentAccount();
33
+    }
34
+
35
+    /**
36
+     * 会员专区、精彩生活区订单分账
37
+     *
38
+     * @param $merId
39
+     * @param $timeLimit
40
+     * @return void
41
+     * @throws \think\db\exception\DataNotFoundException
42
+     * @throws \think\db\exception\DbException
43
+     * @throws \think\db\exception\ModelNotFoundException
44
+     */
45
+    private function doHuafeiOrderIndependentAccount($timeLimit = 1)
46
+    {
47
+        $dst_mer_id = systemConfig('mer_365');
48
+
49
+        // 商户信息
50
+        $merchants = [];
51
+
52
+        $time = time();
53
+        // 订单状态(0:待发货;1:待收货;2:待评价;3:已完成;4已申请退款;-1:已退款)5未支付 6已取消'
54
+        $status = [2];
55
+        // 普通订单
56
+        $cursor = Db::table('rrx_order_huafei')->where('is_independentaccount', 0)->whereIn('status', $status)->cursor();
57
+
58
+        /** @var StoreOrderRepository $storeOrderRepository */
59
+        $storeOrderRepository = app()->make(StoreOrderRepository::class);
60
+
61
+        foreach ($cursor as $key => $value) {
62
+            $settlement_period_time = strtotime($value['create_time']) + $timeLimit * 24 * 3600;
63
+            // @todo 下单后第{$timeLimit}天后可分账
64
+            if ($settlement_period_time >= $time) {
65
+                $merchants['496'] = Db::name('merchant')->where('mer_id', 496)->find();
66
+                $order_huafei_hf = Db::name('order_huafei_hf')->where('order_no', $value['order_sn'])->find();
67
+                if(!$order_huafei_hf) continue;
68
+                $value['mer_id'] = 496;
69
+                $order_huafei_hf['mer_id'] = 496;
70
+
71
+                // 分账账号 496:表示{会员专区}账户,分账到{会员专区}账户
72
+                $independentAccount = $storeOrderRepository->getIndependentAccountHuafei($order_huafei_hf, $dst_mer_id, $merchants['496']['hf_member_id']);
73
+
74
+                // @todo 预分账处理 分账到{会员专区}账户,故:hf_platform_member_id 为入账账户
75
+                $isSuccessed = $storeOrderRepository->prepareExecuteIndependentAccountHuafei(
76
+                    $value, $order_huafei_hf, $independentAccount['api_key'], $independentAccount['hf_platform_member_id'], '', $value['pay_price'], 0
77
+                );
78
+
79
+                if ($isSuccessed) {
80
+                    Db::name("log")->insert(array('data' => '话费-订单分账:' . json_encode($value, JSON_FORCE_OBJECT)));//日志记录
81
+                    Db::table('rrx_order_huafei')->where('order_sn', $value['order_sn'])->update(['is_independentaccount' => 1]);
82
+                }
83
+            }
84
+        }
85
+    }
86
+
87
+}

+ 5 - 5
app/command/PensionTasks.php

@@ -473,7 +473,7 @@ class PensionTasks extends Command
473
             if (!$certification) {
473
             if (!$certification) {
474
                 Log::info($online['uid'] . '没有实名认证');
474
                 Log::info($online['uid'] . '没有实名认证');
475
                 continue;
475
                 continue;
476
-            }
476
+            }   
477
             //查询养老金金额
477
             //查询养老金金额
478
             $UserBillRepository = app()->make(UserBillRepository::class);
478
             $UserBillRepository = app()->make(UserBillRepository::class);
479
             $bill               = $UserBillRepository->getWhere(['uid' => $online['uid'], 'link_id' => $online['order_id'], 'order_sn' => $online['order_sn'], 'commission_type' => 5]);
479
             $bill               = $UserBillRepository->getWhere(['uid' => $online['uid'], 'link_id' => $online['order_id'], 'order_sn' => $online['order_sn'], 'commission_type' => 5]);
@@ -484,10 +484,10 @@ class PensionTasks extends Command
484
                 continue;
484
                 continue;
485
             }
485
             }
486
             //首信易分账
486
             //首信易分账
487
-            $StoreOrderRepository = app()->make(StoreOrderRepository::class);
488
-            if ($online['pay_type'] > 0) {
489
-                $StoreOrderRepository->splitOrder($online);
490
-            }
487
+            // $StoreOrderRepository = app()->make(StoreOrderRepository::class);
488
+            // if ($online['pay_type'] > 0) {
489
+            //     $StoreOrderRepository->splitOrder($online);
490
+            // }
491
 
491
 
492
             Db::transaction(function () use ($certification, $online, $pension, $OrderGzcRepository, $OrderMerchantRepository, $StoreOrderRepository) {
492
             Db::transaction(function () use ($certification, $online, $pension, $OrderGzcRepository, $OrderMerchantRepository, $StoreOrderRepository) {
493
                 //新增入账明细记录
493
                 //新增入账明细记录

+ 56 - 26
app/common/repositories/merchant/order/OrderMerchantRepository.php

@@ -359,7 +359,7 @@ class OrderMerchantRepository extends BaseRepository
359
                 }
359
                 }
360
             }
360
             }
361
             if ($paramOrder['avatar'] == null) {
361
             if ($paramOrder['avatar'] == null) {
362
-                $paramOrder['avatar'] = 'http://app.bjtdba.com/uploads/def/20201118/5984361a2e00f5407776bcd6eaaae1ce.png';
362
+                $paramOrder['avatar'] = 'https://cdn.bjtdba.com/vod/image/2025-01-21/20250121180855764.png';
363
             }
363
             }
364
             $order = Db::transaction(function () use ($paramOrder) {
364
             $order = Db::transaction(function () use ($paramOrder) {
365
                 $merchantOrder = $this->dao->create($paramOrder);
365
                 $merchantOrder = $this->dao->create($paramOrder);
@@ -425,7 +425,7 @@ class OrderMerchantRepository extends BaseRepository
425
         }
425
         }
426
 //        Db::name('log')->insert(['data' => json_encode($paramOrder)]);
426
 //        Db::name('log')->insert(['data' => json_encode($paramOrder)]);
427
         if ($paramOrder['avatar'] == null) {
427
         if ($paramOrder['avatar'] == null) {
428
-            $paramOrder['avatar'] = 'http://app.bjtdba.com/uploads/def/20201118/5984361a2e00f5407776bcd6eaaae1ce.png';
428
+            $paramOrder['avatar'] = 'https://cdn.bjtdba.com/vod/image/2025-01-21/20250121180855764.png';
429
         }
429
         }
430
         $order = Db::transaction(function () use ($paramOrder) {
430
         $order = Db::transaction(function () use ($paramOrder) {
431
             $merchantOrder = $this->dao->create($paramOrder);
431
             $merchantOrder = $this->dao->create($paramOrder);
@@ -902,7 +902,7 @@ class OrderMerchantRepository extends BaseRepository
902
                     $unionData = [
902
                     $unionData = [
903
                         'unionid' => $order->pay_user_id,
903
                         'unionid' => $order->pay_user_id,
904
                         'nickname' => $order->nickname ?: time(),
904
                         'nickname' => $order->nickname ?: time(),
905
-                        'avatar' => $order->avatar ?: 'http://app.bjtdba.com/uploads/def/20201118/5984361a2e00f5407776bcd6eaaae1ce.png',
905
+                        'avatar' => $order->avatar ?: 'https://cdn.bjtdba.com/vod/image/2025-01-21/20250121180855764.png',
906
                         'is_lock' => 1,
906
                         'is_lock' => 1,
907
                         'lock_mer_id' => $order->mer_id,
907
                         'lock_mer_id' => $order->mer_id,
908
                         'lock_time' => date('Y-m-d H:i:s'),
908
                         'lock_time' => date('Y-m-d H:i:s'),
@@ -917,7 +917,7 @@ class OrderMerchantRepository extends BaseRepository
917
                     } else {
917
                     } else {
918
                         $updateData = [
918
                         $updateData = [
919
                             'nickname' => $order->nickname ?: time(),
919
                             'nickname' => $order->nickname ?: time(),
920
-                            'avatar' => $order->avatar ?: 'http://app.bjtdba.com/uploads/def/20201118/5984361a2e00f5407776bcd6eaaae1ce.png',
920
+                            'avatar' => $order->avatar ?: 'https://cdn.bjtdba.com/vod/image/2025-01-21/20250121180855764.png',
921
                             'balance' => Db::raw('balance+' . $order->money),
921
                             'balance' => Db::raw('balance+' . $order->money),
922
                             'give_money' => Db::raw('give_money+' . $order->give_money),
922
                             'give_money' => Db::raw('give_money+' . $order->give_money),
923
                             'pension' => Db::raw('pension+' . $order->pension),
923
                             'pension' => Db::raw('pension+' . $order->pension),
@@ -1583,6 +1583,8 @@ class OrderMerchantRepository extends BaseRepository
1583
         //可分总佣金
1583
         //可分总佣金
1584
         $divisible_commission = bcmul($order['pay_price'], bcdiv($mer_fanyongbili, '100', 2), 2);//让利部分
1584
         $divisible_commission = bcmul($order['pay_price'], bcdiv($mer_fanyongbili, '100', 2), 2);//让利部分
1585
         $pv = bcmul($divisible_commission, '0.7', 2);//商家让利部分30%给消费者做养老金,70%做业绩PV
1585
         $pv = bcmul($divisible_commission, '0.7', 2);//商家让利部分30%给消费者做养老金,70%做业绩PV
1586
+        //更新值
1587
+        Db::name("order_merchant")->where('id', $order_id)->where('out_trade_no', $order_sn)->update(['available'=>$divisible_commission]);
1586
 
1588
 
1587
         /**
1589
         /**
1588
          * 各自的比例开始
1590
          * 各自的比例开始
@@ -1598,6 +1600,34 @@ class OrderMerchantRepository extends BaseRepository
1598
          * 各自的比例结束
1600
          * 各自的比例结束
1599
          */
1601
          */
1600
 
1602
 
1603
+        $gongxian = Db::name('user_sign_gongxian')->where('order_id', $order_id)->find();
1604
+        if(!$gongxian){
1605
+            ///用户可以拿到PV等值贡献值
1606
+            if ($pv >= 0.01) {
1607
+                //贡献值
1608
+                $gongxian_data = [
1609
+                    "uid"           =>$order["uid"]??0,
1610
+                    "number"  =>    $pv,
1611
+                    "addtime"       =>time(),
1612
+                    "status"        =>1,
1613
+                    "order_type"    =>1,
1614
+                    "order_id"      =>$order_id,
1615
+                    "mark"          =>"扫码消费获得赠送贡献值",
1616
+                    "desc"          =>'',
1617
+                    "surplus"       =>$pv,
1618
+                    "type"          =>1,
1619
+                    'settlement_time' => date('Y-m-d H:i:s')
1620
+                ];
1621
+                Db::name("user_sign_gongxian")->insert($gongxian_data);//添加记录
1622
+            } else {
1623
+                Db::name('log')->insert(['data' => '订单号:' . $order['order_sn'] . '付款额度较低或 商家、平台设置的返佣比例较低,积分和贡献值低于0.01无法入库 特此记录!']);
1624
+            }
1625
+        }
1626
+
1627
+
1628
+
1629
+
1630
+
1601
         // 商户---------------------------------------------------------------------------------------------------------------
1631
         // 商户---------------------------------------------------------------------------------------------------------------
1602
 
1632
 
1603
         $mer_data = Db::name('merchant')->where('mer_id', $order['mer_id'])->field('uid,mer_id')->find();
1633
         $mer_data = Db::name('merchant')->where('mer_id', $order['mer_id'])->field('uid,mer_id')->find();
@@ -1605,28 +1635,28 @@ class OrderMerchantRepository extends BaseRepository
1605
         $merchant_user = $userRepository->getOne(['uid' => $mer_data["uid"]]);
1635
         $merchant_user = $userRepository->getOne(['uid' => $mer_data["uid"]]);
1606
 
1636
 
1607
         //商户得到的(京豆和贡献值奖励的倍,后台设置)
1637
         //商户得到的(京豆和贡献值奖励的倍,后台设置)
1608
-        $gongxian = bcmul($divisible_commission, $mer_gonxian, 2);
1609
-        if ($gongxian >= 0.01) {
1610
-            $gongxian_data = [
1611
-                "uid"           =>$mer_data["uid"],
1612
-                "mer_id"        =>$order["mer_id"],
1613
-                "pv"            =>$pv,
1614
-                "number"  =>    $gongxian,
1615
-                "addtime"       =>time(),
1616
-                "status"        =>1,
1617
-                "order_type"    =>2,
1618
-                "order_id"      =>$order_id,
1619
-                "mark"          =>"用户消费商家获得赠送贡献值",
1620
-                "desc"          =>'',
1621
-                "surplus"       =>$gongxian,
1622
-                "type"          =>1
1623
-            ];
1624
-            Db::name("user_sign_gongxian")->insert($gongxian_data);//添加记录
1625
-            $merchant_user->contribute = bcadd($merchant_user->contribute, (float)$gongxian,2);
1626
-            $merchant_user->save();
1627
-        } else {
1628
-            Db::name('log')->insert(['data' => '订单号:' . $order['order_sn'] . '付款额度较低或 商家、平台设置的返佣比例较低,贡献值低于0.01无法入库 特此记录!']);
1629
-        }
1638
+        // $gongxian = bcmul($divisible_commission, $mer_gonxian, 2);
1639
+        // if ($gongxian >= 0.01) {
1640
+            // $gongxian_data = [
1641
+            //     "uid"           =>$mer_data["uid"],
1642
+            //     "mer_id"        =>$order["mer_id"],
1643
+            //     "pv"            =>$pv,
1644
+            //     "number"  =>    $gongxian,
1645
+            //     "addtime"       =>time(),
1646
+            //     "status"        =>1,
1647
+            //     "order_type"    =>2,
1648
+            //     "order_id"      =>$order_id,
1649
+            //     "mark"          =>"用户消费商家获得赠送贡献值",
1650
+            //     "desc"          =>'',
1651
+            //     "surplus"       =>$gongxian,
1652
+            //     "type"          =>1
1653
+            // ];
1654
+            // Db::name("user_sign_gongxian")->insert($gongxian_data);//添加记录
1655
+        //     $merchant_user->contribute = bcadd($merchant_user->contribute, (float)$gongxian,2);
1656
+        //     $merchant_user->save();
1657
+        // // } else {
1658
+        //     Db::name('log')->insert(['data' => '订单号:' . $order['order_sn'] . '付款额度较低或 商家、平台设置的返佣比例较低,贡献值低于0.01无法入库 特此记录!']);
1659
+        // }
1630
 
1660
 
1631
         //商户得到的(京豆和贡献值奖励的倍,后台设置)
1661
         //商户得到的(京豆和贡献值奖励的倍,后台设置)
1632
         $jd = bcmul($divisible_commission, $mer_jd, 2);
1662
         $jd = bcmul($divisible_commission, $mer_jd, 2);

+ 108 - 25
app/common/repositories/store/order/StoreOrderRepository.php

@@ -1134,14 +1134,7 @@ class StoreOrderRepository extends BaseRepository
1134
                             /** @var UserThirdRepository $orderThird */
1134
                             /** @var UserThirdRepository $orderThird */
1135
                             $orderThird = app()->make(\app\common\repositories\user\UserThirdRepository::class);
1135
                             $orderThird = app()->make(\app\common\repositories\user\UserThirdRepository::class);
1136
                             //预估养老金
1136
                             //预估养老金
1137
-//                            $orderThird->yuguOrder(
1138
-//                                $_order->order_id,
1139
-//                                $commissionMoney,
1140
-//                                $uid,
1141
-//                                $_order->order_sn,
1142
-//                                $type_shop,
1143
-//                                'order_fugou'
1144
-//                            );
1137
+
1145
                             //复购区 - 预估养老金
1138
                             //复购区 - 预估养老金
1146
                             $orderThird->repurchaseAreaEstimateAnnuityOrder(
1139
                             $orderThird->repurchaseAreaEstimateAnnuityOrder(
1147
                                 $_order->order_id,
1140
                                 $_order->order_id,
@@ -9553,7 +9546,7 @@ class StoreOrderRepository extends BaseRepository
9553
 
9546
 
9554
                 // Db::name('user')->where('uid',$user_data['uid'])->update(['annuity'=>$ylj_amount_mine,"contribute"=>$con,"score"=>$score]);
9547
                 // Db::name('user')->where('uid',$user_data['uid'])->update(['annuity'=>$ylj_amount_mine,"contribute"=>$con,"score"=>$score]);
9555
 
9548
 
9556
-                $this->bill_user_log($user_data['uid'], $ylj_pri, $store_order_data['order_id'], 5, $group_order['group_order_sn'], '消费获得养老金' . $ylj_pri, $store_order_data['mer_id'], 0);
9549
+                $this->bill_user_log($user_data['uid'], $ylj_pri, $store_order_data['order_id'], 5, $store_order_data['order_sn'], '消费获得养老金' . $ylj_pri, $store_order_data['mer_id'], 0);
9557
                 // 贡献值
9550
                 // 贡献值
9558
                 $this->con_log($user_data['uid'], $pv, $store_order_data['order_id'], 11, "购买精彩生活商品赠送贡献值");
9551
                 $this->con_log($user_data['uid'], $pv, $store_order_data['order_id'], 11, "购买精彩生活商品赠送贡献值");
9559
                 // 积分
9552
                 // 积分
@@ -9665,9 +9658,9 @@ class StoreOrderRepository extends BaseRepository
9665
                         //积分
9658
                         //积分
9666
                         $this->score_log($spread_data['uid'], $ssf, $store_order_data['order_id'], 11, "精彩生活区商品赠送积分");
9659
                         $this->score_log($spread_data['uid'], $ssf, $store_order_data['order_id'], 11, "精彩生活区商品赠送积分");
9667
                         // //推广佣金
9660
                         // //推广佣金
9668
-                        $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);
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);
9669
                         //养老金
9662
                         //养老金
9670
-                        $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);
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);
9671
                     }
9664
                     }
9672
 
9665
 
9673
                     //普通用户推广人
9666
                     //普通用户推广人
@@ -9691,7 +9684,7 @@ class StoreOrderRepository extends BaseRepository
9691
 
9684
 
9692
                         //推广养老金
9685
                         //推广养老金
9693
                         //推广佣金
9686
                         //推广佣金
9694
-                        $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);
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);
9695
                         // 贡献值
9688
                         // 贡献值
9696
                         $this->con_log($spread_data['uid'], $pv, $store_order_data['order_id'], 11, "推广会员专区商品赠送贡献值");
9689
                         $this->con_log($spread_data['uid'], $pv, $store_order_data['order_id'], 11, "推广会员专区商品赠送贡献值");
9697
                         //积分
9690
                         //积分
@@ -9720,7 +9713,7 @@ class StoreOrderRepository extends BaseRepository
9720
 
9713
 
9721
                         // Db::name('user')->where('uid',$merchant_data['uid'])->update(['brokerage_price'=>$yj_amount,'fugou'=>$fgj_amount]);
9714
                         // Db::name('user')->where('uid',$merchant_data['uid'])->update(['brokerage_price'=>$yj_amount,'fugou'=>$fgj_amount]);
9722
                         //推广佣金
9715
                         //推广佣金
9723
-                        $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);
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);
9724
 
9717
 
9725
                     }
9718
                     }
9726
 
9719
 
@@ -9774,8 +9767,7 @@ class StoreOrderRepository extends BaseRepository
9774
 
9767
 
9775
             // Db::name('user')->where('uid',$user_data['uid'])->update(['annuity'=>$ylj_amount_mine,'contribute'=> $gxz_amount_mine,'score'=> $jf_amount_mine]);
9768
             // Db::name('user')->where('uid',$user_data['uid'])->update(['annuity'=>$ylj_amount_mine,'contribute'=> $gxz_amount_mine,'score'=> $jf_amount_mine]);
9776
 
9769
 
9777
-            $this->bill_user_log($user_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']);
9778
-
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']);
9779
             $this->con_log($user_data['uid'], $gx_jf, $store_order_data['order_id'], 11, "购买会员专区商品赠送贡献值", 1);
9771
             $this->con_log($user_data['uid'], $gx_jf, $store_order_data['order_id'], 11, "购买会员专区商品赠送贡献值", 1);
9780
             $this->score_log($user_data['uid'], $gx_jf, $store_order_data['order_id'], 11, "购买会员专区商品赠送积分", 1);
9772
             $this->score_log($user_data['uid'], $gx_jf, $store_order_data['order_id'], 11, "购买会员专区商品赠送积分", 1);
9781
 
9773
 
@@ -9890,16 +9882,16 @@ class StoreOrderRepository extends BaseRepository
9890
                     $this->con_log($spread_data['uid'], round($gx_jf, 2), $store_order_data['order_id'], 11, "推广会员专区商品赠送贡献值", 1);
9882
                     $this->con_log($spread_data['uid'], round($gx_jf, 2), $store_order_data['order_id'], 11, "推广会员专区商品赠送贡献值", 1);
9891
 
9883
 
9892
                     //养老金
9884
                     //养老金
9893
-                    $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']);
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']);
9894
                     //佣金
9886
                     //佣金
9895
-                    $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']);
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']);
9896
                     //复购金
9888
                     //复购金
9897
                     $this->fugou_user_log($spread_data['uid'], $fgj_amount_10, $store_order_data['order_id'], 1, 1);
9889
                     $this->fugou_user_log($spread_data['uid'], $fgj_amount_10, $store_order_data['order_id'], 1, 1);
9898
 
9890
 
9899
                 }
9891
                 }
9900
 
9892
 
9901
                 //普通的用户推广人
9893
                 //普通的用户推广人
9902
-                if ($spread_data['user_group'] == 1) {
9894
+                if ($spread_data['user_group'] == 1) {  
9903
 
9895
 
9904
                     //获取贡献值和积分和佣金
9896
                     //获取贡献值和积分和佣金
9905
                     $gx_jf = $spread_data['contribute'] + round($pv * 0.21, 2);
9897
                     $gx_jf = $spread_data['contribute'] + round($pv * 0.21, 2);
@@ -9917,7 +9909,7 @@ class StoreOrderRepository extends BaseRepository
9917
                     $this->con_log($spread_data['uid'], round($pv * 0.21, 2), $store_order_data['order_id'], 11, "推广会员专区商品赠送贡献值", 1);
9909
                     $this->con_log($spread_data['uid'], round($pv * 0.21, 2), $store_order_data['order_id'], 11, "推广会员专区商品赠送贡献值", 1);
9918
                     $this->score_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);
9919
                     //推广佣金
9911
                     //推广佣金
9920
-                    $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']);
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']);
9921
                 }
9913
                 }
9922
 
9914
 
9923
 
9915
 
@@ -9938,9 +9930,9 @@ class StoreOrderRepository extends BaseRepository
9938
 
9930
 
9939
                 $this->con_log($spread_data['uid'], round($gx_jf, 2), $store_order_data['order_id'], 11, "推广会员专区商品赠送贡献值", 1);
9931
                 $this->con_log($spread_data['uid'], round($gx_jf, 2), $store_order_data['order_id'], 11, "推广会员专区商品赠送贡献值", 1);
9940
                 //养老金
9932
                 //养老金
9941
-                $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']);
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']);
9942
                 //佣金
9934
                 //佣金
9943
-                $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']);
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']);
9944
                 //复购金
9936
                 //复购金
9945
                 $this->fugou_user_log($spread_data['uid'], $fgj_amount_10, $store_order_data['order_id'], 1, 1);
9937
                 $this->fugou_user_log($spread_data['uid'], $fgj_amount_10, $store_order_data['order_id'], 1, 1);
9946
 
9938
 
@@ -10009,20 +10001,20 @@ class StoreOrderRepository extends BaseRepository
10009
 
10001
 
10010
                 $merchant_user_data = Db::name('user')->where('uid', $merchant_data['uid'])->find();
10002
                 $merchant_user_data = Db::name('user')->where('uid', $merchant_data['uid'])->find();
10011
 
10003
 
10012
-                if (!empty($merchant_user_data)) {
10004
+                if (!empty($merchant_data) && !empty($merchant_user_data)) {
10013
 
10005
 
10014
 
10006
 
10015
                     $yj_amount_90 = round($pv * 0.035, 2) * 0.9;
10007
                     $yj_amount_90 = round($pv * 0.035, 2) * 0.9;
10016
                     $fgj_amount_10 = round($pv * 0.035, 2) * 0.1;//推广者的佣金抽10%到个人复购金
10008
                     $fgj_amount_10 = round($pv * 0.035, 2) * 0.1;//推广者的佣金抽10%到个人复购金
10017
 
10009
 
10018
-                    $yj_amount = $merchant_data['brokerage_price'] + $yj_amount_90;
10019
-                    $fgj_amount = $merchant_data['fugou'] + $fgj_amount_10;
10010
+                    $yj_amount = $merchant_user_data['brokerage_price'] + $yj_amount_90;
10011
+                    $fgj_amount = $merchant_user_data['fugou'] + $fgj_amount_10;
10020
                     $this->fugou_user_log($merchant_data['uid'], $fgj_amount_10, $store_order_data['order_id'], 1, 1);
10012
                     $this->fugou_user_log($merchant_data['uid'], $fgj_amount_10, $store_order_data['order_id'], 1, 1);
10021
 
10013
 
10022
 
10014
 
10023
                     // Db::name('user')->where('uid',$merchant_data['uid'])->update(['brokerage_price'=>$yj_amount,'fugou'=>$fgj_amount]);
10015
                     // Db::name('user')->where('uid',$merchant_data['uid'])->update(['brokerage_price'=>$yj_amount,'fugou'=>$fgj_amount]);
10024
                     //推广佣金
10016
                     //推广佣金
10025
-                    $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']);
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']);
10026
                 }
10018
                 }
10027
 
10019
 
10028
             }
10020
             }
@@ -10555,6 +10547,40 @@ class StoreOrderRepository extends BaseRepository
10555
         return compact('hf_member_id', 'hf_platform_member_id', 'api_key');
10547
         return compact('hf_member_id', 'hf_platform_member_id', 'api_key');
10556
     }
10548
     }
10557
 
10549
 
10550
+
10551
+    /**
10552
+     * 获取分账账号信息话费专用
10553
+     *
10554
+     * @param $order
10555
+     * @param $dst_mer_id
10556
+     * @param $alhf_member_id
10557
+     * @return array
10558
+     */
10559
+    public function getIndependentAccountHuafei($order, $dst_mer_id, $alhf_member_id)
10560
+    {
10561
+        if ($order['pay_type'] == 1) {
10562
+            $hf_member_id = Db::name('merchant_member')->where('mer_id', $order['mer_id'])->where("type", 3)->value('member_id');
10563
+            $api_key = 'api_live_b0a687ec-5450-4ada-a0e4-65bac0f46871';
10564
+            $type = 3;
10565
+
10566
+            // 平台特殊账户
10567
+            $hf_platform_member_id = Db::name('merchant_member')->where(['mer_id' => $dst_mer_id, 'type' => $type])->value('member_id');
10568
+        } else {
10569
+            //支付宝
10570
+            $hf_member_id = $alhf_member_id;
10571
+            $api_key = 'api_live_b23537ed-64b8-45d6-832e-fb228aa9e0a9';
10572
+
10573
+            // 平台特殊账户
10574
+            $hf_platform_member_id = Db::name('merchant_member')->where(['mer_id' => $dst_mer_id, 'type' => 1])->value('member_id');
10575
+        }
10576
+
10577
+        return compact('hf_member_id', 'hf_platform_member_id', 'api_key');
10578
+    }
10579
+
10580
+
10581
+
10582
+
10583
+
10558
     /**
10584
     /**
10559
      * 预分账处理
10585
      * 预分账处理
10560
      *
10586
      *
@@ -10607,6 +10633,63 @@ class StoreOrderRepository extends BaseRepository
10607
         return false;
10633
         return false;
10608
     }
10634
     }
10609
 
10635
 
10636
+
10637
+
10638
+
10639
+    /**
10640
+     * 预分账处理话费专用
10641
+     *
10642
+     * @param $order
10643
+     * @param $api_key
10644
+     * @param $hf_member_id
10645
+     * @param $hf_platform_member_id
10646
+     * @param $merchant_profit
10647
+     * @param $platform_profit
10648
+     * @param $dst_mer_id
10649
+     * @return bool
10650
+     * @throws DbException
10651
+     */
10652
+    public function prepareExecuteIndependentAccountHuafei($order, $group_order, $api_key, $hf_member_id, $hf_platform_member_id, $merchant_profit, $platform_profit, $dst_mer_id = 0)
10653
+    {
10654
+        $members[] = [
10655
+            'member_id' => $hf_member_id,
10656
+            'amount' => $merchant_profit,
10657
+            'fee_flag' => 'Y'
10658
+        ];
10659
+        if (!empty($hf_platform_member_id) && ($platform_profit > 0)) {
10660
+            $members[] = [
10661
+                'member_id' => $hf_platform_member_id,
10662
+                'amount' => $platform_profit,
10663
+                'fee_flag' => 'N'
10664
+            ];
10665
+        }
10666
+
10667
+        $requestId = ShouxinyiApiRequest::getOrderNumber('split');
10668
+        $params = [
10669
+            'payment_id' => $group_order['hf_pay_id'],
10670
+            'order_no' => $requestId,
10671
+            'confirm_amt' => $group_order['pay_price'],
10672
+            'div_members' => $members
10673
+        ];
10674
+
10675
+        $params['api_key'] = $api_key;
10676
+
10677
+        // 记录分账订单
10678
+        $this->recordIndependentAccount($order['mer_id'], $dst_mer_id, $group_order, $requestId, $merchant_profit, $platform_profit);
10679
+
10680
+        Db::name("log")->insert(array('data' => '汇付分账参数-----' . json_encode($params, JSON_FORCE_OBJECT)));//日志记录
10681
+        $res = $this->payment_confirm_create_traits($params);
10682
+        Db::name("log")->insert(array('data' => '汇付分账结果-----' . json_encode($res, JSON_FORCE_OBJECT)));//日志记录
10683
+        if ($res['status'] == 'succeeded') {
10684
+            Db::name("store_split_order")->where('requestId', $requestId)->update(['status' => 1, 'hf_pay_id' => $res['id']]);
10685
+            return true;
10686
+        }
10687
+        return false;
10688
+    }
10689
+
10690
+
10691
+
10692
+
10610
     /**
10693
     /**
10611
      * 记录分账订单
10694
      * 记录分账订单
10612
      *
10695
      *

+ 8 - 2
app/common/repositories/user/UserOfflineRechargeRepository.php

@@ -171,8 +171,14 @@ class UserOfflineRechargeRepository extends BaseRepository
171
                     // //同步复购金
171
                     // //同步复购金
172
                     // Db::name("user_sign_fugou")->where('order_id', $order->id)->update(['uid' => $unionUser->uid]);
172
                     // Db::name("user_sign_fugou")->where('order_id', $order->id)->update(['uid' => $unionUser->uid]);
173
                     
173
                     
174
-                    // //同步贡献值
175
-                    // Db::name("user_sign_gongxian")->where('order_id', $order->id)->update(['uid' => $unionUser->uid]);
174
+                    //同步贡献值
175
+                    $gongxian = Db::name('user_sign_gongxian')->where('order_id', $order->id)->find();
176
+                    if($gongxian){
177
+                        Db::name("user_sign_gongxian")->where('order_id', $order->id)->update(['uid' => $unionUser->uid]);
178
+                        $user_contribute = Db::name('user')->where('order_id', $order->id)->where('uid', $unionUser->uid)->value('contribute');
179
+                        $user_contribute = bcadd($user_contribute, $gongxian['number'], 2);
180
+                        Db::name('user')->where('uid', $unionUser->uid)->update(['contribute'=>$user_contribute]);
181
+                    }
176
 
182
 
177
 
183
 
178
 
184
 

+ 1 - 2
app/common/repositories/user/UserRepository.php

@@ -2881,7 +2881,6 @@ class UserRepository extends BaseRepository
2881
         }
2881
         }
2882
         $paramStr =  $paramStr.'sign='.urlencode($sign);
2882
         $paramStr =  $paramStr.'sign='.urlencode($sign);
2883
         return $paramStr;
2883
         return $paramStr;
2884
-
2885
     }
2884
     }
2886
 
2885
 
2887
     /*
2886
     /*
@@ -3013,7 +3012,7 @@ class UserRepository extends BaseRepository
3013
             $request->setGrantType("authorization_code");
3012
             $request->setGrantType("authorization_code");
3014
             $request->setCode($authorization_code);
3013
             $request->setCode($authorization_code);
3015
             $result = $aop->execute($request);
3014
             $result = $aop->execute($request);
3016
-
3015
+            Db::name('log')->insert(['data'=>'支付宝相关信息']);
3017
             if (isset($result->alipay_system_oauth_token_response->user_id)) {
3016
             if (isset($result->alipay_system_oauth_token_response->user_id)) {
3018
                 $return['user_id'] = $result->alipay_system_oauth_token_response->user_id;
3017
                 $return['user_id'] = $result->alipay_system_oauth_token_response->user_id;
3019
                 $return['msg'] = $result->alipay_system_oauth_token_response->access_token;
3018
                 $return['msg'] = $result->alipay_system_oauth_token_response->access_token;

+ 12 - 12
app/controller/api/Notify.php

@@ -178,7 +178,7 @@ class Notify
178
 
178
 
179
                                     //Db::name('user')->where('uid',$user_data['uid'])->update(['annuity'=>$ylj_amount_mine,"contribute"=>$con,"score"=>$score]);
179
                                     //Db::name('user')->where('uid',$user_data['uid'])->update(['annuity'=>$ylj_amount_mine,"contribute"=>$con,"score"=>$score]);
180
 
180
 
181
-                                    $this->bill_user_log($user_data['uid'],$ylj_pri,$store_order_data['order_id'],5,$group_order['group_order_sn'],'消费获得养老金'.$ylj_pri,$store_order_data['mer_id'],0);
181
+                                    $this->bill_user_log($user_data['uid'],$ylj_pri,$store_order_data['order_id'],5,$store_order_data['order_sn'],'消费获得养老金'.$ylj_pri,$store_order_data['mer_id'],0);
182
                                     $this->con_log($user_data['uid'],$pv,$store_order_data['order_id'],11,"购买精彩生活商品赠送贡献值");
182
                                     $this->con_log($user_data['uid'],$pv,$store_order_data['order_id'],11,"购买精彩生活商品赠送贡献值");
183
                                     $this->score_log($user_data['uid'],$pv,$store_order_data['order_id'],11,"购买精彩生活商品赠送积分");
183
                                     $this->score_log($user_data['uid'],$pv,$store_order_data['order_id'],11,"购买精彩生活商品赠送积分");
184
 
184
 
@@ -291,9 +291,9 @@ class Notify
291
                                             //积分
291
                                             //积分
292
                                             $this->score_log($spread_data['uid'],$ssf,$store_order_data['order_id'],11,"精彩生活区商品赠送积分");
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,$group_order['group_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
-                                            $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);
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
                                         }
298
 
298
 
299
                                         //普通用户推广人
299
                                         //普通用户推广人
@@ -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,$group_order['group_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
                                             $this->con_log($spread_data['uid'],round($pv * 0.21,2),$store_order_data['order_id'],11,"推广精彩生活区商品赠送贡献值");
322
                                             $this->con_log($spread_data['uid'],round($pv * 0.21,2),$store_order_data['order_id'],11,"推广精彩生活区商品赠送贡献值");
323
                                             $this->score_log($spread_data['uid'],round($pv * 0.21,2),$store_order_data['order_id'],11,"推广精彩生活区商品赠送积分");
323
                                             $this->score_log($spread_data['uid'],round($pv * 0.21,2),$store_order_data['order_id'],11,"推广精彩生活区商品赠送积分");
324
 
324
 
@@ -352,7 +352,7 @@ class Notify
352
 
352
 
353
                                             //Db::name('user')->where('uid',$merchant_data['uid'])->update(['brokerage_price'=>$yj_amount,'fugou'=>$fgj_amount]);
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,$group_order['group_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
 
@@ -410,7 +410,7 @@ class Notify
410
 
410
 
411
                                 //Db::name('user')->where('uid',$user_data['uid'])->update(['annuity'=>$ylj_amount_mine,'contribute'=> $gxz_amount_mine,'score'=> $jf_amount_mine]);
411
                                 //Db::name('user')->where('uid',$user_data['uid'])->update(['annuity'=>$ylj_amount_mine,'contribute'=> $gxz_amount_mine,'score'=> $jf_amount_mine]);
412
  
412
  
413
-                                $this->bill_user_log($user_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']);
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);
416
                                 $this->score_log($user_data['uid'],$gx_jf,$store_order_data['order_id'],11,"购买会员专区商品赠送积分",1);
416
                                 $this->score_log($user_data['uid'],$gx_jf,$store_order_data['order_id'],11,"购买会员专区商品赠送积分",1);
@@ -531,9 +531,9 @@ class Notify
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);
532
 
532
 
533
                                         //养老金
533
                                         //养老金
534
-                                        $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']);
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,$group_order['group_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
                                         $this->fugou_user_log($spread_data['uid'],$fgj_amount_10,$store_order_data['order_id'],1,1);
538
                                         $this->fugou_user_log($spread_data['uid'],$fgj_amount_10,$store_order_data['order_id'],1,1);
539
 
539
 
@@ -565,7 +565,7 @@ class Notify
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);
566
                                         $this->score_log($spread_data['uid'],round($pv * 0.21,2),$store_order_data['order_id'],11,"推广会员专区商品赠送积分",1);
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,$group_order['group_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
 
@@ -591,9 +591,9 @@ class Notify
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);
593
                                     //养老金
593
                                     //养老金
594
-                                    $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']);
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,$group_order['group_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
                                     $this->fugou_user_log($spread_data['uid'],$fgj_amount_10,$store_order_data['order_id'],1,1);
598
                                     $this->fugou_user_log($spread_data['uid'],$fgj_amount_10,$store_order_data['order_id'],1,1);
599
 
599
 
@@ -636,7 +636,7 @@ class Notify
636
 
636
 
637
                                         //Db::name('user')->where('uid',$merchant_data['uid'])->update(['brokerage_price'=>$yj_amount,'fugou'=>$fgj_amount]);
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,$group_order['group_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
                                 }

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

@@ -311,14 +311,14 @@ class User extends BaseController
311
 
311
 
312
         if ($pm==0){
312
         if ($pm==0){
313
 
313
 
314
-            $data = DB::name('user_sign_gongxian')->where($where)->where('status', 1)->field('id,mark,number,addtime,order_id')->page($page, $limit)->order("id desc")->select();
314
+            $data = DB::name('user_sign_gongxian')->where($where)->where('status', 1)->where('number', '<>',0)->field('id,mark,number,addtime,order_id')->page($page, $limit)->order("id desc")->select();
315
         }
315
         }
316
 //        if($pm==1){
316
 //        if($pm==1){
317
 //            $data = DB::name('user_sign_gongxian')->where($where)->where('pm', 2)->field('id,mark,number,pm,addtime,order_id')->page($page, $limit)->order("id desc")->select();
317
 //            $data = DB::name('user_sign_gongxian')->where($where)->where('pm', 2)->field('id,mark,number,pm,addtime,order_id')->page($page, $limit)->order("id desc")->select();
318
 //
318
 //
319
 //        }
319
 //        }
320
         if($pm==2){
320
         if($pm==2){
321
-            $data = DB::name('user_sign_gongxian')->where($where)->where('status', -1)->field('id,mark,number,addtime,order_id')->page($page, $limit)->order("id desc")->select();
321
+            $data = DB::name('user_sign_gongxian')->where($where)->where('number', '<>',0)->where('status', -1)->field('id,mark,number,addtime,order_id')->page($page, $limit)->order("id desc")->select();
322
 
322
 
323
         }
323
         }
324
         log::info("=======date==={$data}");
324
         log::info("=======date==={$data}");
@@ -2287,7 +2287,7 @@ return app("json")->success($data);
2287
                 $paramStr = $userRepository->getTokenByCode($alinfo["authCode"], true);
2287
                 $paramStr = $userRepository->getTokenByCode($alinfo["authCode"], true);
2288
 //                \think\facade\Db::name('log')->insert(['data'=>'支付宝授权信息'.json_encode($paramStr)]);
2288
 //                \think\facade\Db::name('log')->insert(['data'=>'支付宝授权信息'.json_encode($paramStr)]);
2289
                 $nickname = empty($paramStr["nick_name"]) ? "al" . $alinfo["userId"] : $paramStr["nick_name"];
2289
                 $nickname = empty($paramStr["nick_name"]) ? "al" . $alinfo["userId"] : $paramStr["nick_name"];
2290
-                $avater = empty($paramStr["avatar"]) ? "http://app.bjtdba.com/uploads/def/20201118/5984361a2e00f5407776bcd6eaaae1ce.png" : $paramStr["avatar"];
2290
+                $avater = empty($paramStr["avatar"]) ? "https://cdn.bjtdba.com/vod/image/2025-01-21/20250121180855764.png" : $paramStr["avatar"];
2291
             }
2291
             }
2292
             $data2 = [
2292
             $data2 = [
2293
                 "type"     => $type,
2293
                 "type"     => $type,

+ 2 - 2
app/controller/api/user/UserMp.php

@@ -135,7 +135,7 @@ class UserMp extends BaseController
135
                     $unionData = [
135
                     $unionData = [
136
                         'unionid' => $data['unionid'],
136
                         'unionid' => $data['unionid'],
137
                         'nickname' => $data['nickname'] ? : time(),
137
                         'nickname' => $data['nickname'] ? : time(),
138
-                        'avatar' => $data['avatar'] ? : 'http://app.bjtdba.com/uploads/def/20201118/5984361a2e00f5407776bcd6eaaae1ce.png',
138
+                        'avatar' => $data['avatar'] ? : 'https://cdn.bjtdba.com/vod/image/2025-01-21/20250121180855764.png',
139
                         'is_lock' => 1,
139
                         'is_lock' => 1,
140
                         'lock_time' => date('Y-m-d H:i:s'),
140
                         'lock_time' => date('Y-m-d H:i:s'),
141
                         'balance' => 0,
141
                         'balance' => 0,
@@ -151,7 +151,7 @@ class UserMp extends BaseController
151
                     } else {
151
                     } else {
152
                         $updateData = [
152
                         $updateData = [
153
                             'nickname' => $data['nickname'] ? : time(),
153
                             'nickname' => $data['nickname'] ? : time(),
154
-                            'avatar' => $data['avatar'] ? : 'http://app.bjtdba.com/uploads/def/20201118/5984361a2e00f5407776bcd6eaaae1ce.png',
154
+                            'avatar' => $data['avatar'] ? : 'https://cdn.bjtdba.com/vod/image/2025-01-21/20250121180855764.png',
155
                             'update_time' => date('Y-m-d H:i:s')
155
                             'update_time' => date('Y-m-d H:i:s')
156
                         ];
156
                         ];
157
                         $unionUsersDao->update($unionUser->id, $updateData);
157
                         $unionUsersDao->update($unionUser->id, $updateData);

+ 9 - 3
app/controller/merchant/Common.php

@@ -57,9 +57,14 @@ class Common extends BaseController
57
     {
57
     {
58
         $merId = $this->merId;
58
         $merId = $this->merId;
59
 
59
 
60
-        $list['gongxian'] = Db::name('user_sign_gongxian')->where('mer_id', $merId)->sum('number');
60
+        // $list['gongxian'] = Db::name('user_sign_gongxian')->where('mer_id', $merId)->sum('number');
61
         $list['jingdou'] = Db::name('user_sign_jingdou')->where('mer_id', $merId)->sum('number');
61
         $list['jingdou'] = Db::name('user_sign_jingdou')->where('mer_id', $merId)->sum('number');
62
+        $list['fenrunzhi'] = Db::name('order_merchant')->where('mer_id', $merId)->where('paid', 1)->sum('available');
62
     
63
     
64
+        $list['xianxia'] = Db::name('order_merchant')->where('mer_id', $merId)->where('paid', 1)->count();
65
+        $list['xianshang'] = Db::name('store_order')->where('mer_id', $merId)->where('paid', 1)->count();
66
+
67
+
63
         return app('json')->success(compact('merId', 'list'));
68
         return app('json')->success(compact('merId', 'list'));
64
     }
69
     }
65
 
70
 
@@ -83,8 +88,9 @@ class Common extends BaseController
83
         $list = $query->page($pageNum, $pageSize)->order('id desc')->where('mer_id', $merId)->where('paid', 1)->select();
88
         $list = $query->page($pageNum, $pageSize)->order('id desc')->where('mer_id', $merId)->where('paid', 1)->select();
84
         $list = $list->toArray();
89
         $list = $list->toArray();
85
         foreach ($list as $k => $v) {
90
         foreach ($list as $k => $v) {
86
-            $list[$k]['pv'] = Db::name('user_sign_gongxian')->where('mer_id', $v['mer_id'])->where('order_id', $v['id'])->value('pv') ?? 0;
87
-            $list[$k]['gongxian'] = Db::name('user_sign_gongxian')->where('mer_id', $v['mer_id'])->where('order_id', $v['id'])->value('number') ?? 0;
91
+            $list[$k]['pv'] = Db::name('user_sign_gongxian')->where('order_id', $v['id'])->value('pv') ?? 0;
92
+            // $list[$k]['gongxian'] = Db::name('user_sign_gongxian')->where('mer_id', $v['mer_id'])->where('order_id', $v['id'])->value('number') ?? 0;
93
+            $list[$k]['fenrunzhi'] = $v['available'];
88
             $list[$k]['jingdou'] = Db::name('user_sign_jingdou')->where('mer_id', $v['mer_id'])->where('order_id', $v['id'])->value('number') ?? 0;
94
             $list[$k]['jingdou'] = Db::name('user_sign_jingdou')->where('mer_id', $v['mer_id'])->where('order_id', $v['id'])->value('number') ?? 0;
89
         }
95
         }
90
      
96
      

+ 1 - 0
config/console.php

@@ -22,6 +22,7 @@ return [
22
         'ln:import_user_cxb' => 'app\command\test\ln\ImportUser2',
22
         'ln:import_user_cxb' => 'app\command\test\ln\ImportUser2',
23
 //        'great_life_order_independent_account' => 'app\command\GreatLifeOrderIndependentAccount',
23
 //        'great_life_order_independent_account' => 'app\command\GreatLifeOrderIndependentAccount',
24
 //        'commercial-\_area_order_independent_account' => 'app\command\CommercialAreaOrderIndependentAccount',
24
 //        'commercial-\_area_order_independent_account' => 'app\command\CommercialAreaOrderIndependentAccount',
25
+        // 'huafei_order_independent_account' => 'app\command\HuafeiOrderIndependentAccount',
25
         'movie_city_area' => 'app\command\MovieCityAreaCommand',
26
         'movie_city_area' => 'app\command\MovieCityAreaCommand',
26
         'movie_cinema' => 'app\command\MovieCinemaCommand',
27
         'movie_cinema' => 'app\command\MovieCinemaCommand',
27
         'movie_film' => 'app\command\MovieFilmCommand',
28
         'movie_film' => 'app\command\MovieFilmCommand',