Przeglądaj źródła

Merge branch 'master' into sxb-dev

sunxiaobiao 1 rok temu
rodzic
commit
43b9b5a085

+ 35 - 33
app/command/CinemaSchedCommand.php

@@ -3,6 +3,7 @@
3 3
 namespace app\command;
4 4
 
5 5
 use app\common\repositories\movie\CinemaRepository;
6
+use app\common\repositories\movie\CinemaSchedRepository;
6 7
 use app\common\repositories\movie\FilmRepository;
7 8
 use app\common\repositories\movie\MovieRepository;
8 9
 use crmeb\services\ApiResponseService;
@@ -19,7 +20,7 @@ class CinemaSchedCommand extends Command
19 20
     protected function configure()
20 21
     {
21 22
         // 指令配置
22
-        $this->setName('cinema_sched')->setDescription('电影-影院场次列表');
23
+        $this->setName('cinema_film_sched')->setDescription('电影-影院场次列表');
23 24
     }
24 25
 
25 26
     protected function execute(Input $input, Output $output)
@@ -56,9 +57,7 @@ class CinemaSchedCommand extends Command
56 57
         $cinema_filmRepository = app()->make(MovieRepository::class);
57 58
         $cinema_sched = $cinema_filmRepository->getCinemaSched($film['film_sign'], $cinema['cinema_sign']);
58 59
 
59
-        if (isset($cinema_sched['code']) && ($cinema_sched['code'] == ApiResponseService::DEFAULT_SUCCESS_CODE)) {
60
-            $this->createCinemaSched($cinema_sched['data']['list'], $cinema);
61
-        }
60
+        $this->createCinemaSched($cinema_sched, $cinema);
62 61
     }
63 62
 
64 63
     /**
@@ -71,35 +70,38 @@ class CinemaSchedCommand extends Command
71 70
      */
72 71
     private function createCinemaSched($list, $cinema)
73 72
     {
74
-        foreach ($list as $key => $value) {
75
-            $params = [
76
-                'relation_id' => $value['relation_id'],
77
-                'sched_sign' => $value['sched_sign'],
78
-                'film_sign' => $value['film_sign'],
79
-                'film_name' => $value['film_name'],
80
-                'show_date' => strtotime(date('Y') . '-' . $value['show_date']),
81
-                'show_time' => trim($value['show_time']),
82
-                'cinema_sign' => $cinema['cinema_sign'],
83
-                'cinema_name' => $cinema['cinema_name'],
84
-                'address' => $cinema['address'],
85
-                'longitude' => $cinema['longitude'],
86
-                'latitude' => $cinema['latitude'],
87
-                'hall_sign' => $value['hall_sign'],
88
-                'hall_name' => $value['hall_name'],
89
-                'stop_sell_time' => $value['stop_sell_time'],
90
-                'cost_price' => $value['cost_price'],
91
-                'channel_price' => json_encode($value['channel_price'], JSON_FORCE_OBJECT)
92
-            ];
93
-            $where = [
94
-                'relation_id' => $value['relation_id'], 'sched_sign' => $value['sched_sign'], 'film_sign' => $value['film_sign'], 'cinema_sign' => $params['cinema_sign']
95
-            ];
96
-            $model = Db::name('movie_cinema_sched')->where($where)->find();
97
-            if (empty($model)) {
98
-                $params['create_time'] = time();
99
-                Db::name('movie_cinema_sched')->insert($params);
100
-            } else {
101
-                $params['update_time'] = time();
102
-                Db::name('movie_cinema_sched')->where('id', $model['id'])->update($params);
73
+        foreach ($list as $key => $sched) {
74
+            foreach ($sched as $subKey => $value) {
75
+                $params = [
76
+                    'relation_id' => $value['relation_id'],
77
+                    'sched_sign' => $value['sched_sign'],
78
+                    'film_sign' => $value['film_sign'],
79
+                    'film_name' => $value['film_name'],
80
+                    'show_date' => strtotime(date('Y') . '-' . $value['show_date']),
81
+                    'show_time' => trim($value['show_time']),
82
+                    'cinema_sign' => $cinema['cinema_sign'],
83
+                    'cinema_name' => $cinema['cinema_name'],
84
+                    'address' => $cinema['address'],
85
+                    'longitude' => $cinema['longitude'],
86
+                    'latitude' => $cinema['latitude'],
87
+                    'hall_sign' => $value['hall_sign'],
88
+                    'hall_name' => $value['hall_name'],
89
+                    'stop_sell_time' => strtotime($value['stop_sell_time']),
90
+                    'price' => $value['price'], // 原价
91
+                    'cost_price' => $value['cost_price'], // 销售价
92
+                    'channel_price' => json_encode($value['channel_price'], JSON_FORCE_OBJECT)
93
+                ];
94
+                $where = [
95
+                    'relation_id' => $value['relation_id'], 'sched_sign' => $value['sched_sign'], 'film_sign' => $value['film_sign'], 'cinema_sign' => $params['cinema_sign']
96
+                ];
97
+                $model = Db::name('movie_cinema_sched')->where($where)->find();
98
+                if (empty($model)) {
99
+                    $params['create_time'] = time();
100
+                    Db::name('movie_cinema_sched')->insert($params);
101
+                } else {
102
+                    $params['update_time'] = time();
103
+                    Db::name('movie_cinema_sched')->where('id', $model['id'])->update($params);
104
+                }
103 105
             }
104 106
         }
105 107
     }

+ 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 473
             if (!$certification) {
474 474
                 Log::info($online['uid'] . '没有实名认证');
475 475
                 continue;
476
-            }
476
+            }   
477 477
             //查询养老金金额
478 478
             $UserBillRepository = app()->make(UserBillRepository::class);
479 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 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 492
             Db::transaction(function () use ($certification, $online, $pension, $OrderGzcRepository, $OrderMerchantRepository, $StoreOrderRepository) {
493 493
                 //新增入账明细记录

+ 2 - 2
app/common/model/movie/cinema/Cinema.php

@@ -24,8 +24,8 @@ class Cinema extends BaseModel
24 24
 
25 25
         return $model->when(isset($where['cinema_name']) && $where['cinema_name'], function ($query) use ($where) {
26 26
             $query->where('cinema_name', 'like', "%{$where['cinema_name']}%");
27
-        })->when(isset($where['cate_one_id']) && $where['cate_one_id'], function ($query) use ($where) {
28
-            $query->where('cate_one_id', $where['cate_one_id']);
27
+        })->when(isset($where['cinema_sign']) && $where['cinema_sign'], function ($query) use ($where) {
28
+            $query->where('cinema_sign', $where['cinema_sign']);
29 29
         })->when(isset($where['cate_two_id']) && $where['cate_two_id'], function ($query) use ($where) {
30 30
             $query->where('cate_two_id', $where['cate_two_id']);
31 31
         })->when(isset($where['city']) && $where['city'], function ($query) use ($where) {

+ 37 - 0
app/common/model/movie/cinema/CinemaSched.php

@@ -0,0 +1,37 @@
1
+<?php
2
+
3
+namespace app\common\model\movie\cinema;
4
+
5
+use app\model\BaseModel;
6
+
7
+class CinemaSched extends BaseModel
8
+{
9
+    protected $name = 'movie_cinema_sched';
10
+
11
+    public static function tablePk(): ?string
12
+    {
13
+        return 'id';
14
+    }
15
+
16
+    /**
17
+     * @param $model
18
+     * @param array $where
19
+     * @return CinemaSched
20
+     */
21
+    public function search($model = null, array $where = [])
22
+    {
23
+        $model = $model ?? new self();
24
+
25
+        return $model->when(isset($where['film_sign']) && $where['film_sign'], function ($query) use ($where) {
26
+            $query->where('film_sign', $where['film_sign']);
27
+        })->when(isset($where['cinema_sign']) && $where['cinema_sign'], function ($query) use ($where) {
28
+            $query->where('cinema_sign', $where['cinema_sign']);
29
+        })->when(isset($where['show_date']) && $where['show_date'], function ($query) use ($where) {
30
+            $query->where('show_date', $where['show_date']);
31
+        })->when(isset($where['relation_id']) && $where['relation_id'], function ($query) use ($where) {
32
+            $query->where('relation_id', $where['relation_id']);
33
+        })->when(isset($where['sched_sign']) && $where['sched_sign'], function ($query) use ($where) {
34
+            $query->where('sched_sign', $where['sched_sign']);
35
+        });
36
+    }
37
+}

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

@@ -359,7 +359,7 @@ class OrderMerchantRepository extends BaseRepository
359 359
                 }
360 360
             }
361 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 364
             $order = Db::transaction(function () use ($paramOrder) {
365 365
                 $merchantOrder = $this->dao->create($paramOrder);
@@ -425,7 +425,7 @@ class OrderMerchantRepository extends BaseRepository
425 425
         }
426 426
 //        Db::name('log')->insert(['data' => json_encode($paramOrder)]);
427 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 430
         $order = Db::transaction(function () use ($paramOrder) {
431 431
             $merchantOrder = $this->dao->create($paramOrder);
@@ -902,7 +902,7 @@ class OrderMerchantRepository extends BaseRepository
902 902
                     $unionData = [
903 903
                         'unionid' => $order->pay_user_id,
904 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 906
                         'is_lock' => 1,
907 907
                         'lock_mer_id' => $order->mer_id,
908 908
                         'lock_time' => date('Y-m-d H:i:s'),
@@ -917,7 +917,7 @@ class OrderMerchantRepository extends BaseRepository
917 917
                     } else {
918 918
                         $updateData = [
919 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 921
                             'balance' => Db::raw('balance+' . $order->money),
922 922
                             'give_money' => Db::raw('give_money+' . $order->give_money),
923 923
                             'pension' => Db::raw('pension+' . $order->pension),
@@ -1583,6 +1583,8 @@ class OrderMerchantRepository extends BaseRepository
1583 1583
         //可分总佣金
1584 1584
         $divisible_commission = bcmul($order['pay_price'], bcdiv($mer_fanyongbili, '100', 2), 2);//让利部分
1585 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 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 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 1662
         $jd = bcmul($divisible_commission, $mer_jd, 2);

+ 15 - 1
app/common/repositories/movie/CinemaRepository.php

@@ -16,7 +16,7 @@ use think\facade\Db;
16 16
  * Class CinemaRepository
17 17
  * @package app\common\repositories\movie
18 18
  * @author xaboy
19
- * @mixin MovieOrderDao
19
+ * @mixin Cinema
20 20
  */
21 21
 class CinemaRepository extends BaseRepository
22 22
 {
@@ -85,4 +85,18 @@ class CinemaRepository extends BaseRepository
85 85
         return "(round(6378137 * 2 * asin(sqrt(pow(sin(((latitude * pi()) / 180 - ({$latitude} * pi()) / 180) / 2), 2) 
86 86
         + cos(({$latitude} * pi()) / 180) * cos((latitude * pi()) / 180) * pow(sin(((longitude * pi()) / 180 - ({$longitude} * pi()) / 180) / 2), 2))))) AS distance";
87 87
     }
88
+
89
+    /**
90
+     * 获取影院信息
91
+     *
92
+     * @param $cinema_sign
93
+     * @return Cinema|array|\think\Model|null
94
+     * @throws \think\db\exception\DataNotFoundException
95
+     * @throws \think\db\exception\DbException
96
+     * @throws \think\db\exception\ModelNotFoundException
97
+     */
98
+    public function getCinemaInfo($cinema_sign)
99
+    {
100
+        return $this->dao->search(null, ['cinema_sign' => $cinema_sign])->find();
101
+    }
88 102
 }

+ 162 - 0
app/common/repositories/movie/CinemaSchedRepository.php

@@ -0,0 +1,162 @@
1
+<?php
2
+/**
3
+ * @package merchant
4
+ * @Author: Qinii
5
+ * @Date: 2020/5/8
6
+ */
7
+
8
+namespace app\common\repositories\movie;
9
+
10
+use app\common\model\movie\cinema\CinemaSched;
11
+use app\common\repositories\BaseRepository;
12
+use think\facade\Db;
13
+
14
+/**
15
+ * Class CinemaSchedRepository
16
+ * @package app\common\repositories\movie
17
+ * @author xaboy
18
+ * @mixin CinemaSched
19
+ */
20
+class CinemaSchedRepository extends BaseRepository
21
+{
22
+    protected $dao;
23
+
24
+    /**
25
+     * ProductRepository constructor.
26
+     * @param CinemaSched $dao
27
+     */
28
+    public function __construct(CinemaSched $dao)
29
+    {
30
+        $this->dao = $dao;
31
+    }
32
+
33
+    /**
34
+     * @param $film_sign
35
+     * @return array
36
+     * @throws \think\db\exception\DataNotFoundException
37
+     * @throws \think\db\exception\DbException
38
+     * @throws \think\db\exception\ModelNotFoundException
39
+     */
40
+    public function getFilmSchedDate($film_sign)
41
+    {
42
+        $field = 'show_date';
43
+        $where = ['film_sign' => $film_sign];
44
+
45
+        $show_date = $this->dao->search(null, $where)->field([$field])->order('show_date asc')->group('show_date')->select()->toArray();
46
+        foreach ($show_date as $key => $value) {
47
+            $show_date[$key]['date'] = date('m-d', $value['show_date']);
48
+        }
49
+
50
+        return $show_date;
51
+    }
52
+
53
+    /**
54
+     * @param $page
55
+     * @param $limit
56
+     * @param $longitude
57
+     * @param $latitude
58
+     * @param $show_date
59
+     * @param $with
60
+     * @param $order
61
+     * @return array
62
+     * @throws \think\db\exception\DataNotFoundException
63
+     * @throws \think\db\exception\DbException
64
+     * @throws \think\db\exception\ModelNotFoundException
65
+     */
66
+    public function getFilmSched($page, $limit, $film_sign, $longitude, $latitude, $show_date, $with = [], $order = 1)
67
+    {
68
+        $field = 'sched_sign,cinema_sign,cinema_name,address,show_date,price,longitude,latitude';
69
+        $where = ['film_sign' => $film_sign, 'show_date' => $show_date];
70
+
71
+        $cinema_sched = $this->dao->search(null, $where)->when($with, function ($query) use ($with) {
72
+            $query->with($with);
73
+        })->when($latitude && $longitude, function ($query) use ($field, $longitude, $latitude) {
74
+            $query->field([$field, $this->distance($latitude, $longitude)]);
75
+        })->when($page && $limit, function ($query) use ($page, $limit) {
76
+            $query->page($page, $limit);
77
+        })->when(!is_null($order), function ($query) use ($order) {
78
+            if ($order == 1) {//距离最近
79
+                $query->order('distance asc');
80
+            } else {//播放日期
81
+                $query->order('show_date desc');
82
+            }
83
+        })->field([$field])->select()->toArray();
84
+        foreach ($cinema_sched as $key => $value) {
85
+            $cinema_sched[$key]['distance'] = isset($value['distance']) ? round($value['distance'] / 1000, 2) : 0.00;
86
+            $cinema_sched[$key]['show_date'] = date('m-d', $value['show_date']);
87
+
88
+            $pcYanglaojinGongxian = MovieRepository::getPvYanglaojinScore($value['price']);
89
+            $cinema_sched[$key]['price'] = $pcYanglaojinGongxian['cost_price'];
90
+        }
91
+
92
+        $count = $this->dao->search(null, $where)->when($with, function ($query) use ($with) {
93
+            $query->with($with);
94
+        })->when($latitude && $longitude, function ($query) use ($field, $longitude, $latitude) {
95
+            $query->field([$field, $this->distance($latitude, $longitude)]);
96
+        })->count();
97
+
98
+        return compact('cinema_sched', 'count');
99
+    }
100
+
101
+    /**
102
+     * @param $page
103
+     * @param $limit
104
+     * @param $cinema_sign
105
+     * @param $film_sign
106
+     * @param $show_date
107
+     * @return array
108
+     * @throws \think\db\exception\DataNotFoundException
109
+     * @throws \think\db\exception\DbException
110
+     * @throws \think\db\exception\ModelNotFoundException
111
+     */
112
+    public function getCinemaFilmSched($page, $limit, $cinema_sign, $film_sign, $show_date)
113
+    {
114
+        $field = 'relation_id,sched_sign,film_sign,film_name,show_date,show_time,cinema_sign,cinema_name,hall_sign,hall_name,price';
115
+        $where = ['cinema_sign' => $cinema_sign, 'film_sign' => $film_sign, 'show_date' => strtotime($show_date)];
116
+
117
+        $cinema_sched = $this->dao->search(null, $where)
118
+            ->when($page && $limit, function ($query) use ($page, $limit) {
119
+                $query->page($page, $limit);
120
+            })->order('show_time asc')->field([$field])->select()->toArray();
121
+        foreach ($cinema_sched as $key => $value) {
122
+            $pcYanglaojinGongxian = MovieRepository::getPvYanglaojinScore($value['price']);
123
+
124
+            $cinema_sched[$key]['price'] = $pcYanglaojinGongxian['cost_price'];
125
+            $cinema_sched[$key]['yanglaojin'] = $pcYanglaojinGongxian['yanglaojin'];
126
+            $cinema_sched[$key]['pv'] = $pcYanglaojinGongxian['pv'];
127
+            $cinema_sched[$key]['score'] = $pcYanglaojinGongxian['score'];
128
+            $cinema_sched[$key]['gongxian'] = $pcYanglaojinGongxian['gongxian'];
129
+        }
130
+
131
+        $count = $this->dao->search(null, $where)->count();
132
+
133
+        return compact('cinema_sched', 'count');
134
+    }
135
+
136
+    /**
137
+     * 经纬度排序计算
138
+     * @param string $latitude
139
+     * @param string $longitude
140
+     * @return string
141
+     */
142
+    private function distance(string $latitude, string $longitude)
143
+    {
144
+        return "(round(6378137 * 2 * asin(sqrt(pow(sin(((latitude * pi()) / 180 - ({$latitude} * pi()) / 180) / 2), 2) 
145
+        + cos(({$latitude} * pi()) / 180) * cos((latitude * pi()) / 180) * pow(sin(((longitude * pi()) / 180 - ({$longitude} * pi()) / 180) / 2), 2))))) AS distance";
146
+    }
147
+
148
+    /**
149
+     * 获取影片场次详情
150
+     *
151
+     * @param $relation_id
152
+     * @param $sched_sign
153
+     * @return CinemaSched|array|\think\Model|null
154
+     * @throws \think\db\exception\DataNotFoundException
155
+     * @throws \think\db\exception\DbException
156
+     * @throws \think\db\exception\ModelNotFoundException
157
+     */
158
+    public function getCinemaSchedInfo($relation_id, $sched_sign)
159
+    {
160
+        return $this->dao->search(null, ['relation_id' => $relation_id, 'sched_sign' => $sched_sign])->find();
161
+    }
162
+}

+ 8 - 3
app/common/repositories/movie/DouHuoMallFilmApiRequest.php

@@ -203,11 +203,15 @@ class DouHuoMallFilmApiRequest
203 203
     /**
204 204
      * 锁座订单
205 205
      *
206
-     * @param $relation_id
206
+     * @param $phone
207
+     * @param $channel_type
207 208
      * @param $sched_sign
209
+     * @param $seat_sign
210
+     * @param $third_order
211
+     * @param $order_price
208 212
      * @return mixed|string
209 213
      */
210
-    public static function submitOrder($phone, $channel_type, $sched_sign, $third_order, $order_price)
214
+    public static function submitOrder($phone, $channel_type, $sched_sign, $seat_sign, $third_order, $order_price)
211 215
     {
212 216
         $url = '/openapi/Movie/submitOrder';
213 217
         $body = [
@@ -216,7 +220,8 @@ class DouHuoMallFilmApiRequest
216 220
             'sched_sign' => $sched_sign,
217 221
             'third_order' => $third_order,
218 222
             'order_price' => $order_price,
219
-            'phone' => $phone
223
+            'phone' => $phone,
224
+            'seat_sign' => $seat_sign
220 225
         ];
221 226
 
222 227
         $res = self::curl_post(self::$path . $url, $body);

+ 100 - 49
app/common/repositories/movie/MovieRepository.php

@@ -28,10 +28,10 @@ class MovieRepository extends BaseRepository
28 28
 
29 29
     protected $dao;
30 30
 
31
-    private $premium_ratio = 0.2;//溢价比例
32
-    private $yanglaojin_ratio = 0.3;
31
+    const premium_ratio = 0.2;//溢价比例
32
+    const yanglaojin_ratio = 0.3;
33 33
 
34
-    private $pv_ratio = 0.7;
34
+    const pv_ratio = 0.7;
35 35
 
36 36
     /**
37 37
      * ProductRepository constructor.
@@ -99,15 +99,15 @@ class MovieRepository extends BaseRepository
99 99
             ? $result['data']['list'] : [];
100 100
         foreach ($cinemaSchedList as $dateDay => &$fileSchedValue) {
101 101
             foreach ($fileSchedValue as $key => $value) {
102
-                $premium = round($value['cost_price'] * $this->premium_ratio, 2);
102
+                $pcYanglaojinGongxian = static::getPvYanglaojinScore($value['cost_price']);
103 103
 
104
-                $fileSchedValue[$key]['cost_price'] = bcadd((string)$value['cost_price'], (string)$premium, 2);
104
+                $fileSchedValue[$key]['price'] = $pcYanglaojinGongxian['cost_price'];
105
+                $fileSchedValue[$key]['yanglaojin'] = $pcYanglaojinGongxian['yanglaojin'];
106
+                $fileSchedValue[$key]['pv'] = $pcYanglaojinGongxian['pv'];
107
+                $fileSchedValue[$key]['score'] = $pcYanglaojinGongxian['score'];
108
+                $fileSchedValue[$key]['gongxian'] = $pcYanglaojinGongxian['gongxian'];
105 109
 
106
-                $pv = bcmul((string)$premium, $this->pv_ratio, 2);
107
-                $fileSchedValue[$key]['yanglaojin'] = bcmul((string)$premium, $this->yanglaojin_ratio, 2);
108
-                $fileSchedValue[$key]['pv'] = $fileSchedValue[$key]['score'] = $fileSchedValue[$key]['gongxian'] = $pv;
109
-
110
-                unset($fileSchedValue[$key]['channel_price']);
110
+//                unset($fileSchedValue[$key]['channel_price']);
111 111
             }
112 112
         }
113 113
 
@@ -121,18 +121,45 @@ class MovieRepository extends BaseRepository
121 121
      */
122 122
     public function getSchedSeat($relation_id = '', $sched_sign = '')
123 123
     {
124
-        return DouHuoMallFilmApiRequest::getSchedSeat($relation_id, $sched_sign);
124
+        $result = DouHuoMallFilmApiRequest::getSchedSeat($relation_id, $sched_sign);
125
+
126
+        $schedSeatList = (isset($result['code']) && ($result['code'] == ApiResponseService::DEFAULT_SUCCESS_CODE))
127
+            ? $result['data']['list'] : [];
128
+        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;
138
+            }
139
+            unset($schedSeatList[$key]['price']);
140
+
141
+            $pcYanglaojinGongxian = self::getPvYanglaojinScore($price);
142
+            $schedSeatList[$key]['price'] = $pcYanglaojinGongxian['cost_price'];
143
+            $schedSeatList[$key]['yanglaojin'] = $pcYanglaojinGongxian['yanglaojin'];
144
+            $schedSeatList[$key]['pv'] = $pcYanglaojinGongxian['pv'];
145
+            $schedSeatList[$key]['score'] = $pcYanglaojinGongxian['score'];
146
+            $schedSeatList[$key]['gongxian'] = $pcYanglaojinGongxian['gongxian'];
147
+            $schedSeatList[$key]['relation_id'] = $relation_id; // 场次ID
148
+            $schedSeatList[$key]['sched_sign'] = $sched_sign; // 场次编码
149
+        }
150
+
151
+        return $schedSeatList;
125 152
     }
126 153
 
127 154
     /**
128 155
      * 锁座订单
129
-     * @param $sched_sign
130
-     * @param $seat_sign
131
-     * @param $channel_type
132
-     * @param $third_order
133
-     * @param $order_price
134
-     * @param $phone
135
-     * @return mixed|string
156
+     *
157
+     * @param $userinfo
158
+     * @param $params
159
+     * @return mixed
160
+     * @throws \think\db\exception\DataNotFoundException
161
+     * @throws \think\db\exception\DbException
162
+     * @throws \think\db\exception\ModelNotFoundException
136 163
      */
137 164
     public function submitOrder($userinfo, $params)
138 165
     {
@@ -140,49 +167,57 @@ class MovieRepository extends BaseRepository
140 167
         $storeOrder = app()->make(StoreOrderRepository::class);
141 168
         $order_sn = $storeOrder->getNewOrderId() . '0';
142 169
 
143
-        $order_price = round($params['number'] * $params['price'], 2);
144
-        $submitOrder = DouHuoMallFilmApiRequest::submitOrder($userinfo->phone, $params['channel_type'], $params['sched_sign'], $order_sn, $order_price);
145
-        if (!empty($submitOrder) && isset($submitOrder['code']) && ($submitOrder['code'] == 200) && isset($submitOrder['data']['plat_order'])) {
170
+        /** @var CinemaSchedRepository $cinemaSchedRepository */
171
+        $cinemaSchedRepository = app()->make(CinemaSchedRepository::class);
172
+        $sched = $cinemaSchedRepository->getCinemaSchedInfo($params['relation_id'], $params['sched_sign']);
173
+        if (empty($sched)) throw new ValidateException('观影场次不存在');
174
+
175
+        $seat_sign = json_decode($params['seat_sign'], true);
176
+        $order_price = round($sched['price'] * count($seat_sign), 2);
177
+        $submitOrder = DouHuoMallFilmApiRequest::submitOrder($userinfo->phone, $params['channel_type'], $params['sched_sign'], $seat_sign, $order_sn, $order_price);
178
+        if (!empty($submitOrder) && isset($submitOrder['code']) && ($submitOrder['code'] == ApiResponseService::DEFAULT_SUCCESS_CODE) && isset($submitOrder['data']['plat_order'])) {
179
+            /** @var CinemaRepository $cinemaRepository */
180
+            $cinemaRepository = app()->make(CinemaRepository::class);
181
+            $cinema = $cinemaRepository->getCinemaInfo($sched['cinema_sign']);
182
+
146 183
             $_order = [
147 184
                 'uid' => $userinfo->uid,
148 185
                 'mobile' => $userinfo->phone,
149 186
                 'order_sn' => $order_sn,
150 187
                 'plat_order' => $submitOrder['data']['plat_order'],
151
-                'price' => $params['price'],
152
-                'number' => $params['number'],
188
+                'price' => $sched['price'],
189
+                'number' => count($seat_sign),
153 190
                 'order_price' => $order_price,
154 191
                 'channel_type' => $params['channel_type'],
155
-                'pay_type' => $params['pay_type'],
156
-                'city_sign' => $params['city_sign'],
157
-                'city_name' => $params['city_name'],
158
-                'area_code' => $params['area_code'],
159
-                'area_name' => $params['area_name'],
160
-                'cinema_sign' => $params['cinema_sign'],
161
-                'cinema_name' => $params['cinema_name'],
162
-                'address' => $params['address'],
163
-                'longitude' => $params['longitude'],
164
-                'latitude' => $params['latitude'],
165
-                'hall_sign' => $params['hall_sign'],
166
-                'hall_name' => $params['hall_name'],
167
-                'relation_id' => $params['relation_id'],
168
-                'sched_sign' => $params['sched_sign'],
169
-                'film_sign' => $params['film_sign'],
170
-                'film_name' => $params['film_name'],
171
-                'show_date' => $params['show_date'],
172
-                'show_time' => $params['show_time'],
173
-                'sched_seat' => $params['sched_seat'],
192
+                'city_sign' => $cinema['city_sign'],
193
+                'city_name' => $cinema['city_name'],
194
+                'area_code' => $cinema['area_sign'],
195
+                'area_name' => $cinema['area_name'],
196
+                'cinema_sign' => $cinema['cinema_sign'],
197
+                'cinema_name' => $cinema['cinema_name'],
198
+                'address' => $cinema['address'],
199
+                'longitude' => $cinema['longitude'],
200
+                'latitude' => $cinema['latitude'],
201
+                'hall_sign' => $sched['hall_sign'],
202
+                'hall_name' => $sched['hall_name'],
203
+                'relation_id' => $sched['relation_id'],
204
+                'sched_sign' => $sched['sched_sign'],
205
+                'film_sign' => $sched['film_sign'],
206
+                'film_name' => $sched['film_name'],
207
+                'show_date' => $sched['show_date'],
208
+                'show_time' => $sched['show_time'],
209
+                'sched_seat' => $sched['sched_seat'],
174 210
                 'create_time' => time()
175 211
             ];
176 212
 
177
-            $group = Db::transaction(function () use ($userinfo, $_order) {
213
+            $order_sn = Db::transaction(function () use ($userinfo, $_order) {
178 214
                 $_order = $this->dao->create($_order);
179
-                if ($_order) return ['code' => ApiResponseService::DEFAULT_SUCCESS_CODE, 'msg' => '下单成功', 'data' => ['order_sn' => $_order['order_sn']]];
180
-
181
-                throw new ValidateException('下单失败');
215
+                if ($_order) return $_order['order_sn'];
216
+                throw new ValidateException('锁座下单失败');
182 217
             });
183
-            return $group;
218
+            return $order_sn;
184 219
         } else {
185
-            return $submitOrder;
220
+            throw new ValidateException('锁座下单失败');
186 221
         }
187 222
     }
188 223
 
@@ -202,7 +237,7 @@ class MovieRepository extends BaseRepository
202 237
 //                return $this->pay(
203 238
 //                    $_order['pay_type'], $userinfo->wechat_user_id, $_order, $_order['film_name'], env('APP_URL') . "/api/hf_notify/movie",
204 239
 //                    'delay');
205
-        return DouHuoMallFilmApiRequest::confirmOrder($third_order, $order_price);
240
+        return DouHuoMallFilmApiRequest::confirmOrder($orderinfo['order_sn'], $orderinfo['order_price']);
206 241
     }
207 242
 
208 243
     /**
@@ -315,4 +350,20 @@ class MovieRepository extends BaseRepository
315 350
 
316 351
         return compact('city_name', 'initial');
317 352
     }
353
+
354
+    /**
355
+     * 获取pv、养老金、售价、积分
356
+     *
357
+     * @param $cost_price
358
+     * @return array
359
+     */
360
+    public static function getPvYanglaojinScore($cost_price)
361
+    {
362
+        $premium = round($cost_price * self::premium_ratio, 2);
363
+        $cost_price = bcadd((string)$cost_price, (string)$premium, 2);
364
+        $pv = $gongxian = $score = bcmul((string)$premium, self::pv_ratio, 2);
365
+        $yanglaojin = bcmul((string)$premium, self::yanglaojin_ratio, 2);
366
+
367
+        return compact('premium', 'cost_price', 'pv', 'yanglaojin', 'gongxian', 'score');
368
+    }
318 369
 }

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

@@ -1134,14 +1134,7 @@ class StoreOrderRepository extends BaseRepository
1134 1134
                             /** @var UserThirdRepository $orderThird */
1135 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 1139
                             $orderThird->repurchaseAreaEstimateAnnuityOrder(
1147 1140
                                 $_order->order_id,
@@ -9553,7 +9546,7 @@ class StoreOrderRepository extends BaseRepository
9553 9546
 
9554 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 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 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 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 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 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 9771
             $this->con_log($user_data['uid'], $gx_jf, $store_order_data['order_id'], 11, "购买会员专区商品赠送贡献值", 1);
9780 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 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 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 9897
                     $gx_jf = $spread_data['contribute'] + round($pv * 0.21, 2);
@@ -9917,7 +9909,7 @@ class StoreOrderRepository extends BaseRepository
9917 9909
                     $this->con_log($spread_data['uid'], round($pv * 0.21, 2), $store_order_data['order_id'], 11, "推广会员专区商品赠送贡献值", 1);
9918 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 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 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 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 10007
                     $yj_amount_90 = round($pv * 0.035, 2) * 0.9;
10016 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 10012
                     $this->fugou_user_log($merchant_data['uid'], $fgj_amount_10, $store_order_data['order_id'], 1, 1);
10021 10013
 
10022 10014
 
10023 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 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 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 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 2882
         $paramStr =  $paramStr.'sign='.urlencode($sign);
2883 2883
         return $paramStr;
2884
-
2885 2884
     }
2886 2885
 
2887 2886
     /*
@@ -3013,7 +3012,7 @@ class UserRepository extends BaseRepository
3013 3012
             $request->setGrantType("authorization_code");
3014 3013
             $request->setCode($authorization_code);
3015 3014
             $result = $aop->execute($request);
3016
-
3015
+            Db::name('log')->insert(['data'=>'支付宝相关信息']);
3017 3016
             if (isset($result->alipay_system_oauth_token_response->user_id)) {
3018 3017
                 $return['user_id'] = $result->alipay_system_oauth_token_response->user_id;
3019 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 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 182
                                     $this->con_log($user_data['uid'],$pv,$store_order_data['order_id'],11,"购买精彩生活商品赠送贡献值");
183 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 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 322
                                             $this->con_log($spread_data['uid'],round($pv * 0.21,2),$store_order_data['order_id'],11,"推广精彩生活区商品赠送贡献值");
323 323
                                             $this->score_log($spread_data['uid'],round($pv * 0.21,2),$store_order_data['order_id'],11,"推广精彩生活区商品赠送积分");
324 324
 
@@ -352,7 +352,7 @@ class Notify
352 352
 
353 353
                                             //Db::name('user')->where('uid',$merchant_data['uid'])->update(['brokerage_price'=>$yj_amount,'fugou'=>$fgj_amount]);
354 354
                                             //推广佣金
355
-                                            $this->bill_user_log($merchant_data['uid'],  $yj_amount_90,$store_order_data['order_id'],3,$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 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 415
                                 $this->con_log($user_data['uid'],$gx_jf,$store_order_data['order_id'],11,"购买会员专区商品赠送贡献值",1);
416 416
                                 $this->score_log($user_data['uid'],$gx_jf,$store_order_data['order_id'],11,"购买会员专区商品赠送积分",1);
@@ -531,9 +531,9 @@ class Notify
531 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 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 565
                                         $this->con_log($spread_data['uid'],round($pv * 0.21,2),$store_order_data['order_id'],11,"推广会员专区商品赠送贡献值",1);
566 566
                                         $this->score_log($spread_data['uid'],round($pv * 0.21,2),$store_order_data['order_id'],11,"推广会员专区商品赠送积分",1);
567 567
                                         //推广佣金
568
-                                        $this->bill_user_log($spread_data['uid'],$yj_amount_90,$store_order_data['order_id'],3,$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 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 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 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
                                 }

+ 68 - 37
app/controller/api/movie/Movie.php

@@ -8,11 +8,13 @@
8 8
 namespace app\controller\api\movie;
9 9
 
10 10
 use app\common\repositories\movie\CinemaRepository;
11
+use app\common\repositories\movie\CinemaSchedRepository;
11 12
 use app\common\repositories\movie\FilmRepository;
12 13
 use app\common\repositories\movie\MovieRepository;
13 14
 use app\common\repositories\system\groupData\GroupDataRepository;
14 15
 use app\controller\merchant\user\User;
15 16
 use crmeb\basic\BaseController;
17
+use crmeb\services\ApiResponseService;
16 18
 use think\App;
17 19
 
18 20
 class Movie extends BaseController
@@ -95,19 +97,64 @@ class Movie extends BaseController
95 97
     }
96 98
 
97 99
     /**
98
-     * 获取影院场次列表
100
+     * 获取影片场次日期列表
99 101
      *
100 102
      * @return mixed
101 103
      */
102
-    public function getCinemaSched()
104
+    public function getFilmSchedDate()
103 105
     {
104
-        $cinema_sign = $this->request->param('cinema_sign', '');
105
-        if (empty($cinema_sign)) return app('json')->fail('请选择影院');
106
+        $film_sign = $this->request->param('film_sign', '');
107
+        if (empty($film_sign)) return app('json')->fail('请选择要观看的影片');
108
+
109
+        /** @var CinemaSchedRepository $cinemaSchedRepository */
110
+        $cinemaSchedRepository = app()->make(CinemaSchedRepository::class);
111
+        return app('json')->success($cinemaSchedRepository->getFilmSchedDate($film_sign));
112
+    }
106 113
 
114
+    /**
115
+     * 获取影片场次列表
116
+     *
117
+     * @return mixed
118
+     */
119
+    public function getFilmSched()
120
+    {
121
+        [$page, $limit] = $this->getPage();
107 122
         $film_sign = $this->request->param('film_sign', '');
108
-        if (empty($film_sign)) return app('json')->fail('请选择影片');
123
+        $longitude = $this->request->param('longitude', '');// 经度
124
+        $latitude = $this->request->param('latitude', '');// 纬度
125
+        $show_date = $this->request->param('show_date', '');
109 126
 
110
-        return app('json')->success($this->repository->getCinemaSched($film_sign, $cinema_sign));
127
+        if (empty($film_sign)) return app('json')->fail('请选择要观看的影片');
128
+        if (empty($longitude) || empty($latitude)) return app('json')->fail('请授权应用开启定位');
129
+        if (empty($show_date)) return app('json')->fail('请选择观影日期');
130
+
131
+        /** @var CinemaSchedRepository $cinemaSchedRepository */
132
+        $cinemaSchedRepository = app()->make(CinemaSchedRepository::class);
133
+        return app('json')->success($cinemaSchedRepository->getFilmSched($page, $limit, $film_sign, $longitude, $latitude, $show_date));
134
+    }
135
+
136
+    /**
137
+     * 影院影片场次列表
138
+     *
139
+     * @return mixed
140
+     */
141
+    public function getCinemaFilmSched()
142
+    {
143
+        [$page, $limit] = $this->getPage();
144
+        $cinema_sign = $this->request->param('cinema_sign', '');
145
+        $film_sign = $this->request->param('film_sign', '');
146
+//        $longitude = $this->request->param('longitude', '');// 经度
147
+//        $latitude = $this->request->param('latitude', '');// 纬度
148
+        $show_date = $this->request->param('show_date', '');
149
+
150
+        if (empty($cinema_sign)) return app('json')->fail('请选择观影影院');
151
+        if (empty($film_sign)) return app('json')->fail('请选择观影影片');
152
+//        if (empty($longitude) || empty($latitude)) return app('json')->fail('请授权应用开启定位');
153
+        if (empty($show_date)) return app('json')->fail('请选择观影日期');
154
+
155
+        /** @var CinemaSchedRepository $cinemaSchedRepository */
156
+        $cinemaSchedRepository = app()->make(CinemaSchedRepository::class);
157
+        return app('json')->success($cinemaSchedRepository->getCinemaFilmSched($page, $limit, $cinema_sign, $film_sign, date('Y') . '-' . $show_date));
111 158
     }
112 159
 
113 160
     /**
@@ -118,10 +165,10 @@ class Movie extends BaseController
118 165
     public function getSchedSeat()
119 166
     {
120 167
         $relation_id = $this->request->param('relation_id', '');
121
-        if (empty($cinema_sign)) return app('json')->fail('请选择场次');
168
+        if (empty($relation_id)) return app('json')->fail('请选择观影场次');
122 169
 
123 170
         $sched_sign = $this->request->param('sched_sign', '');
124
-        if (empty($film_sign)) return app('json')->fail('请选择场次');
171
+        if (empty($sched_sign)) return app('json')->fail('请选择观影场次');
125 172
 
126 173
         return app('json')->success($this->repository->getSchedSeat($relation_id, $sched_sign));
127 174
     }
@@ -134,39 +181,21 @@ class Movie extends BaseController
134 181
     public function submitOrder()
135 182
     {
136 183
         $params = $this->request->params(
137
-            ['price', 0.00],
138
-            ['number', 0],
139
-            ['channel_type', ''],
140
-            ['pay_type', ''],
141
-            ['city_sign', ''],
142
-            ['city_name', ''],
143
-            ['area_code', ''],
144
-            ['area_name', ''],
145
-            ['cinema_sign', ''],
146
-            ['cinema_name', ''],
147
-            ['address', ''],
148
-            ['longitude', ''],
149
-            ['latitude', ''],
150
-            ['hall_sign', ''],
151
-            ['hall_name', ''],
152
-            ['relation_id', ''],
153
-            ['sched_sign', ''],
154
-            ['film_sign', ''],
155
-            ['film_name', ''],
156
-            ['show_date', ''],
157
-            ['show_time', ''],
158
-            ['sched_seat', '']
184
+            ['channel_type', 'P2'],
185
+            ['relation_id', ''], // 场次ID
186
+            ['sched_sign', ''], // 场次编码
187
+            ['seat_no', ''], // 座位
188
+            ['seat_sign', ''] // 座位编码
159 189
         );
160 190
 
161
-        if (empty($params['sched_sign'])) return app('json')->fail('请选择场次');
162
-        if (empty($params['seat_sign'])) return app('json')->fail('请选择座位');
163
-        if (empty($params['channel_type'])) return app('json')->fail('请选择购票类型');
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('请选择座位');
164 193
 
165 194
         $result = $this->repository->submitOrder($this->request->userInfo(), $params);
166
-        if ($result['code'] == 200) {
167
-            return app('json')->success($result);
195
+        if (!empty($result)) {
196
+            return app('json')->success(['order_sn' => $result]);
168 197
         } else {
169
-            return app('json')->fail($result);
198
+            return app('json')->fail('锁座下单失败');
170 199
         }
171 200
     }
172 201
 
@@ -177,8 +206,10 @@ class Movie extends BaseController
177 206
      */
178 207
     public function confirmOrder()
179 208
     {
180
-        $order_sn = $this->request->param(['order_sn']);
209
+        $order_sn = $this->request->param('order_sn', '');
181 210
         if (empty($order_sn)) return app('json')->fail('订单不存在');
211
+        $pay_type = $this->request->param('pay_type', '');
212
+        if (empty($pay_type)) return app('json')->fail('请选择支付方式');
182 213
 
183 214
         return app('json')->success($this->repository->confirmOrder($this->request->userInfo(), $order_sn));
184 215
     }

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

@@ -311,14 +311,14 @@ class User extends BaseController
311 311
 
312 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 316
 //        if($pm==1){
317 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 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 324
         log::info("=======date==={$data}");
@@ -2287,7 +2287,7 @@ return app("json")->success($data);
2287 2287
                 $paramStr = $userRepository->getTokenByCode($alinfo["authCode"], true);
2288 2288
 //                \think\facade\Db::name('log')->insert(['data'=>'支付宝授权信息'.json_encode($paramStr)]);
2289 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 2292
             $data2 = [
2293 2293
                 "type"     => $type,

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

@@ -135,7 +135,7 @@ class UserMp extends BaseController
135 135
                     $unionData = [
136 136
                         'unionid' => $data['unionid'],
137 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 139
                         'is_lock' => 1,
140 140
                         'lock_time' => date('Y-m-d H:i:s'),
141 141
                         'balance' => 0,
@@ -151,7 +151,7 @@ class UserMp extends BaseController
151 151
                     } else {
152 152
                         $updateData = [
153 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 155
                             'update_time' => date('Y-m-d H:i:s')
156 156
                         ];
157 157
                         $unionUsersDao->update($unionUser->id, $updateData);

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

@@ -57,9 +57,14 @@ class Common extends BaseController
57 57
     {
58 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 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 68
         return app('json')->success(compact('merId', 'list'));
64 69
     }
65 70
 
@@ -83,8 +88,9 @@ class Common extends BaseController
83 88
         $list = $query->page($pageNum, $pageSize)->order('id desc')->where('mer_id', $merId)->where('paid', 1)->select();
84 89
         $list = $list->toArray();
85 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 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
      

+ 6 - 6
app/view/index/index.html

@@ -4,7 +4,7 @@
4 4
     <meta charset="UTF-8" />
5 5
     <meta name="viewport" content="width=device-width, initial-scale=1.0" />
6 6
     <meta http-equiv="X-UA-Compatible" content="ie=edge" />
7
-    <title>储蓄保</title>
7
+    <title>幸福保</title>
8 8
     <link rel="stylesheet" href="index/css/all.min.css" />
9 9
     <link rel="stylesheet" href="index/css/slick.css">
10 10
     <link rel="stylesheet" href="index/css/slick-theme.css">
@@ -21,7 +21,7 @@
21 21
     <nav class="navbar navbar-expand-md tm-navbar" id="tmNav">
22 22
         <div class="container">
23 23
             <div class="tm-next">
24
-                <a href="#hero" class="navbar-brand">储蓄保</a>
24
+                <a href="#hero" class="navbar-brand">幸福保</a>
25 25
             </div>
26 26
 
27 27
             <button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#navbarSupportedContent"
@@ -46,7 +46,7 @@
46 46
 
47 47
     <div class="text-center tm-hero-text-container">
48 48
         <div class="tm-hero-text-container-inner">
49
-            <h2 class="tm-hero-title">储蓄保</h2>
49
+            <h2 class="tm-hero-title">幸福保</h2>
50 50
             <!-- <p class="tm-hero-subtitle">
51 51
                 Parallax Bootstrap Theme
52 52
                 <br />by TemplateMo
@@ -71,7 +71,7 @@
71 71
                 <div class="tm-intro-text-container">
72 72
                     <h2 class="tm-text-primary mb-4 tm-section-title">介绍</h2>
73 73
                     <p class="mb-4 tm-intro-text">
74
-						储蓄保让您轻松实现“互联网+养老”,专业可依赖的实力技术研发团队,成员分别来自移动互联网公司,通讯设计制造商、增值应用提供商、游戏设计公司,储蓄保APP致力于帮助百姓利用日常消费获取养老金,提升全国百姓养老、防老的生活品质;同时帮助商家引流,商家还可以用储蓄保移动互联网+广告,实现精准营销,高效获取目标客户,提高营业收入。
74
+						幸福保让您轻松实现“互联网+养老”,专业可依赖的实力技术研发团队,成员分别来自移动互联网公司,通讯设计制造商、增值应用提供商、游戏设计公司,幸福保APP致力于帮助百姓利用日常消费获取养老金,提升全国百姓养老、防老的生活品质;同时帮助商家引流,商家还可以用幸福保移动互联网+广告,实现精准营销,高效获取目标客户,提高营业收入。
75 75
                     </p>
76 76
                     <p class="mb-5 tm-intro-text">
77 77
 
@@ -204,13 +204,13 @@
204 204
                     <div class="tm-underline-inner"></div>
205 205
                 </div>
206 206
                 <p class="mb-5">
207
-					储蓄保让您轻松实现“互联网+养老”,专业可依赖的实力技术研发团队,成员分别来自移动互联网公司,通讯设计制造商、增值应用提供商、游戏设计公司,储蓄保APP致力于帮助百姓利用日常消费获取养老金,提升全国百姓养老、防老的生活品质;同时帮助商家引流,商家还可以用储蓄保移动互联网+广告,实现精准营销,高效获取目标客户,提高营业收入。
207
+					幸福保让您轻松实现“互联网+养老”,专业可依赖的实力技术研发团队,成员分别来自移动互联网公司,通讯设计制造商、增值应用提供商、游戏设计公司,幸福保APP致力于帮助百姓利用日常消费获取养老金,提升全国百姓养老、防老的生活品质;同时帮助商家引流,商家还可以用幸福保移动互联网+广告,实现精准营销,高效获取目标客户,提高营业收入。
208 208
 				</p>
209 209
         </div>
210 210
     </div>
211 211
     <a class="text-center small tm-footer gogoggg" href="http://www.beian.miit.gov.cn/" style="color: #fff;">
212 212
         <p class="mb-0">
213
-            京ICP备2020038339号-1
213
+            冀ICP备2025100336号-1
214 214
         </p>
215 215
     </a>
216 216
 </section>

+ 1 - 0
config/console.php

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

+ 8 - 6
route/api.php

@@ -1271,12 +1271,14 @@ Route::group('api/', function () {
1271 1271
 
1272 1272
     //电影
1273 1273
     Route::group('movie', function () {
1274
-        Route::get('city', '/getMovieCity');
1275
-        Route::get('area', '/getArea');
1276
-        Route::get('cinema', '/getCinema');
1277
-        Route::get('film', '/getFilm');
1278
-        Route::get('cinema_sched', '/getCinemaSched');
1279
-        Route::get('sched_seat', '/getSchedSeat');
1274
+        Route::get('city', '/getMovieCity'); // 城市列表
1275
+        Route::get('area', '/getArea'); // 城区列表
1276
+        Route::get('cinema', '/getCinema'); // 影院列表
1277
+        Route::get('film', '/getFilm'); // 影片列表
1278
+        Route::get('filmsched_date', '/getFilmSchedDate'); // 影片场次日期
1279
+        Route::get('film_sched', '/getFilmSched'); // 根据影片排片日期查询排片影院
1280
+        Route::get('cinemafilm_sched', '/getCinemaFilmSched'); // 根据影院影片场次日期查询场次列表
1281
+        Route::get('sched_seat', '/getSchedSeat'); // 获取场次座位
1280 1282
     })->prefix('api.movie.Movie');
1281 1283
 
1282 1284
     //电影 - 下单业务