소스 검색

Merge branch 'master' of https://git.bjtdba.com/shop/php into dev-shichen

shichen 9 달 전
부모
커밋
c15057604c
26개의 변경된 파일1168개의 추가작업 그리고 11876개의 파일을 삭제
  1. 14 1
      app/common/dao/user/UserCertificationDao.php
  2. 1 0
      app/common/enum/CommonEnum.php
  3. 1 0
      app/common/enum/store/StoreOrderEnum.php
  4. 31 9
      app/common/repositories/merchant/order/OrderGzcRepository.php
  5. 110 57
      app/common/repositories/store/order/StoreOrderRepository.php
  6. 0 9137
      app/common/repositories/store/order/StoreOrderRepositoryCopy.php
  7. 4 0
      app/common/repositories/store/product/ProductRepository.php
  8. 2 0
      app/common/repositories/system/merchant/MerchantRepository.php
  9. 1 1
      app/common/repositories/user/UserPvLogRepository.php
  10. 13 3
      app/common/repositories/user/UserRepository.php
  11. 172 22
      app/controller/admin/order/Order.php
  12. 506 1
      app/controller/admin/order/ThirdOrder.php
  13. 40 23
      app/controller/admin/system/merchant/GzcLogs.php
  14. 15 3
      app/controller/api/Auth.php
  15. 7 2
      app/controller/api/Notify.php
  16. 4 1
      app/controller/api/store/merchant/TaskPartnerProfits.php
  17. 0 214
      app/controller/api/store/merchant/TaskZeroLineOrderLianc.php
  18. 40 62
      app/controller/api/store/merchant/Taskorderguquan.php
  19. 10 6
      app/controller/api/store/order/StoreOrder.php
  20. 0 2298
      app/controller/api/store/order/StoreOrderCopy.php
  21. 7 7
      app/controller/api/store/product/Other.php
  22. 95 17
      app/controller/api/user/User.php
  23. 72 10
      app/traits/GzcApiRequest.php
  24. 1 1
      extend/BaiduAi/controller/Ocr.php
  25. 13 0
      extend/BaiduAi/sdk/AipOcr.php
  26. 9 1
      route/admin.php

+ 14 - 1
app/common/dao/user/UserCertificationDao.php

@@ -85,5 +85,18 @@ class UserCertificationDao extends BaseDao
85 85
         return $entityList;
86 86
     }
87 87
 
88
-
88
+    /**
89
+     * @param $mobile
90
+     * @return array|\think\db\BaseQuery|\think\Model|null
91
+     * @throws DataNotFoundException
92
+     * @throws DbException
93
+     * @throws ModelNotFoundException
94
+     * @author 史晨
95
+     * @date 2025/10/20 17:21
96
+     * 获取用户实名信息
97
+     */
98
+    public function getUserCertification($mobile)
99
+    {
100
+        return $this->getModel()::getDB()->where('mobile', $mobile)->find();
101
+    }
89 102
 }

+ 1 - 0
app/common/enum/CommonEnum.php

@@ -137,6 +137,7 @@ class CommonEnum
137 137
                 'Basic' => [ // 售价 => 基础计算价格 (历史原因:原价是1000、2000...等,后来单间成本价上调了180,所以售价调整了,考虑到涨价前后的奖励应保持一致,所以设置了基础计算值)
138 138
                     '1180.00' => 1000.00,
139 139
                     '2360.00' => 2000.00,
140
+                    '5900.00' => 5000.00,
140 141
                     '9440.00' => 8000.00,
141 142
                     '10620.00' => 9000.00,
142 143
                     '11800.00' => 10000.00

+ 1 - 0
app/common/enum/store/StoreOrderEnum.php

@@ -40,6 +40,7 @@ class StoreOrderEnum extends CommonEnum
40 40
         'B3-VR+Jingdou' => ['code' => 'b3', 'name' => 'VR+京豆'],
41 41
         'B4-Cash+Jingdou' => ['code' => 'b4', 'name' => '现金+京豆'],
42 42
         'B5-VR' => ['code' => 'b5', 'name' => 'VR'],
43
+        'B6-Cash' => ['code' => 'b6', 'name' => '现金'],
43 44
         'A1-VR' => ['code' => 'a1', 'name' => 'VR'],
44 45
         'A2-Cash' => ['code' => 'a2', 'name' => '现金'],
45 46
         'A3-Cash+VR' => ['code' => 'a3', 'name' => '现金+VR'],

+ 31 - 9
app/common/repositories/merchant/order/OrderGzcRepository.php

@@ -356,20 +356,42 @@ class OrderGzcRepository extends BaseRepository
356 356
 
357 357
 
358 358
 
359
-    public function certification($uid, $mobile, $user_name, $user_card, $card_positive, $card_reverse)
359
+    public function certification($uid, $mobile, $user_name, $user_card, $card_positive, $card_reverse,$cardType,$birthday,$gender,$age)
360 360
     {
361 361
         $thirdKey = "xingfubao";
362 362
         $thirdsignKey = "xfb@86868.";
363 363
         $time = time();
364 364
 
365
-        $data = [
366
-            'uid'  => $uid,
367
-            'mobile' => $mobile,
368
-            'user_name' => $user_name,
369
-            'user_card' => $user_card,
370
-            'card_positive'=> $card_positive,
371
-            'card_reverse'=> $card_reverse,
372
-        ];
365
+        if ($cardType == 1) {
366
+            $data = [
367
+                'uid'  => $uid,
368
+                'mobile' => $mobile,
369
+                'user_name' => $user_name,
370
+                'user_card' => $user_card,
371
+                'card_positive'=> $card_positive,
372
+                'card_reverse'=> $card_reverse,
373
+            ];
374
+        }else{
375
+            $concertType = 0;
376
+            if ($cardType == 2) {
377
+                $concertType = 10;
378
+            }
379
+            if ($cardType == 3) {
380
+                $concertType = 11;
381
+            }
382
+            $data = [
383
+                'uid'  => $uid,
384
+                'mobile' => $mobile,
385
+                'user_name' => $user_name,
386
+                'user_card' => $user_card,
387
+                'card_positive'=> $card_positive,
388
+                'card_reverse'=> $card_reverse,
389
+                'conCertType' => strval($concertType),
390
+                'birthday' => strval($birthday),
391
+                'conSex' => strval($gender),
392
+                'age' => intval($age)
393
+            ];
394
+        }
373 395
 
374 396
         ksort($data);
375 397
         $params = '';

+ 110 - 57
app/common/repositories/store/order/StoreOrderRepository.php

@@ -1174,6 +1174,11 @@ class StoreOrderRepository extends BaseRepository
1174 1174
                                 $gx_jf = 1400;
1175 1175
                                 $yj1 = 200;
1176 1176
                                 $le_yw_amount = 600;
1177
+                            } else if ($array_fzone_paytype['price'] == 5900) {
1178
+                                $pv = 5000;
1179
+                                $gx_jf = 3500;
1180
+                                $yj1 = 500;
1181
+                                $le_yw_amount = 1500;
1177 1182
                             }
1178 1183
 
1179 1184
                             $ylj_pri = bcmul($pv, 0.035, 2);
@@ -2380,6 +2385,8 @@ class StoreOrderRepository extends BaseRepository
2380 2385
                 $num_yl = 2000;
2381 2386
             } else if ($orderpri == '9440') {
2382 2387
                 $num_yl = 8000;
2388
+            } else if ($orderpri == '5900') {
2389
+                $num_yl = 5000;
2383 2390
             }
2384 2391
 
2385 2392
             if ($store_product_datas['mer_id'] == 496) {
@@ -2419,7 +2426,7 @@ class StoreOrderRepository extends BaseRepository
2419 2426
 
2420 2427
                             ['type' => 'a1', 'price' => $orderpri, 'other' => 0, 'note' => "VR"],//VR支付
2421 2428
                             ['type' => 'a2', 'price' => $orderpri, 'other' => 0, 'note' => "现金"],//现金支付
2422
-                            ['type' => 'a3', 'price' => $vr_payment, 'other' => $cash_payment, 'note' => "现金+VR"],//现金支付
2429
+                            ['type' => 'a3', 'price' => strval($vr_payment), 'other' => strval($cash_payment), 'note' => "现金+VR"],//现金支付
2423 2430
                         ];
2424 2431
                     }
2425 2432
 
@@ -2665,26 +2672,62 @@ class StoreOrderRepository extends BaseRepository
2665 2672
      * @author xaboy
2666 2673
      * @day 2020/6/10
2667 2674
      */
2668
-    public function getDetail($id, $uid = null)
2675
+    public function getDetail($id)
2669 2676
     {
2670 2677
         $time = systemConfig('auto_take_order_timer') * 24 * 60 * 60;
2671
-
2678
+//
2672 2679
         $where = [];
2673
-        if ($uid) $where['uid'] = $uid;
2680
+//        if ($uid) $where['uid'] = $uid;
2674 2681
 
2675
-        $data = $this->dao->search($where)->where('group_order_id', $id)->where('is_del', 0)->with([
2682
+        $data = $this->dao->search($where)->where('order_sn', $id)->where('is_del', 0)->with([
2676 2683
             'orderProduct', 'merchant' => function ($query) {
2677 2684
                 return $query->field('mer_id,mer_name,mer_avatar,business_id');
2678 2685
             }
2679
-        ])->when(!$uid, function ($query) {
2680
-            $query->with([
2681
-                'user' => function ($query) {
2682
-                    return $query->field('uid,nickname');
2686
+        ])
2687
+//            ->when(!$uid, function ($query) {
2688
+//            $query->with([
2689
+//                'user' => function ($query) {
2690
+//                    return $query->field('uid,nickname');
2691
+//                }
2692
+//            ]);
2693
+//        })
2694
+            ->find();
2695
+//        $query = Db::name('store_order')->alias('o')
2696
+//            ->leftJoin('store_order_product p', 'p.order_id = o.order_id')
2697
+//            ->leftJoin('merchant m', 'm.mer_id = o.mer_id')
2698
+//            ->field('o.*, m.mer_name, m.mer_avatar, m.business_id, p.*')
2699
+//            ->where('o.order_sn', $id)
2700
+//            ->where('o.is_del', 0);
2701
+//        $data = $query->find();
2702
+//        if (!$data) {
2703
+//            return null;
2704
+//        }
2705
+//        $pay_time = isset($data->pay_time) ?? $data['pay_time'];
2706
+//        $data['take_order_time'] = strtotime($pay_time) + $time;
2707
+        if ($data) {
2708
+            foreach ($data as $k => $v) {
2709
+                if ($v === null) {
2710
+                    $data[$k] = 0;
2683 2711
                 }
2684
-            ]);
2685
-        })->find();
2686
-        $pay_time = isset($data->pay_time) ?? $data['pay_time'];
2687
-        $data['take_order_time'] = strtotime($pay_time) + $time;
2712
+            }
2713
+        }
2714
+        $data = $data ? $data->toArray() : null;
2715
+        $pay_time = isset($data['pay_time']) && $data['pay_time'] ? $data['pay_time'] : null;
2716
+        $data['take_order_time'] = $pay_time ? strtotime($pay_time) + $time : null;
2717
+//        if ($query->order_type == 1) {
2718
+//            $query->append(['take']);
2719
+//        }
2720
+        $auto_close_minutes = ((int) systemConfig('auto_close_order_timer')) ?: 15;
2721
+        $createTime = $data['create_time'] ?? $pay_time ?? date('Y-m-d H:i:s');
2722
+        $closeTime = date('Y-m-d H:i:s', strtotime($createTime) + $auto_close_minutes * 60);
2723
+        if (!empty($data['seckill']) && $data['seckill'] == 1) {
2724
+            $nextHourTimestamp = time() + 3600;
2725
+            $closeTime = date('Y-m-d H:00:00', $nextHourTimestamp);
2726
+        }
2727
+        if (!empty($data['is_day_pay']) && $data['is_day_pay'] == 1) {
2728
+            $closeTime = date('Y-m-d H:i:s', strtotime($createTime) + 3 * 60);
2729
+        }
2730
+        $data['close_time'] = $closeTime;
2688 2731
         return $data;
2689 2732
     }
2690 2733
 
@@ -5265,6 +5308,7 @@ class StoreOrderRepository extends BaseRepository
5265 5308
         $teshu_mer_id = implode(',', $teshu_mer_id);
5266 5309
         $query = $this->dao->search($where)->where('test_order', 0)->where('is_del', 0);
5267 5310
 //        $query = $this->dao->search($where)->where('is_del', 0);
5311
+//        $query = Db::name('store_order')->where('test_order', 0)->where('is_del', 0)->where('uid',$where['uid'])->where('paid',1)->where('status',$where['status']);
5268 5312
         $count = $query->count();
5269 5313
         $list = $query->with([
5270 5314
             'orderProduct', 'merchant' => function ($query) {
@@ -9844,7 +9888,8 @@ class StoreOrderRepository extends BaseRepository
9844 9888
                         $this->con_log($spread_data['uid'], $pv, $store_order_data['order_id'], 0, "推广精彩生活商品赠送贡献值");
9845 9889
                         //积分
9846 9890
                         $this->score_log($spread_data['uid'], bcmul($pv, $rate, 2), $store_order_data['order_id'], 0, "推广精彩生活商品赠送积分");
9847
-                        if($store_order_data['share_uid']){
9891
+                        // 1123 用户分享的商品不得分享佣金 先暂时这样写
9892
+                        if($store_order_data['share_uid'] && $store_order_data['share_uid'] != 1123){
9848 9893
                             $this->bill_user_log($store_order_data['share_uid'], bcmul($pv * 0.9, 0.03, 2), $store_order_data['order_id'], 20, $store_order_data['order_sn'], '分享获得佣金', $store_order_data['mer_id'], 0);
9849 9894
                             $this->fugou_user_log($store_order_data['share_uid'], bcmul($pv * 0.1, 0.03, 2), $store_order_data['order_id'], 1);
9850 9895
                         }
@@ -9863,7 +9908,8 @@ class StoreOrderRepository extends BaseRepository
9863 9908
                         $this->bill_user_log($spread_data['uid'], $yj_amount_90, $store_order_data['order_id'], 3, $store_order_data['order_sn'], '推广获得佣金', $store_order_data['mer_id'], 0);
9864 9909
                         //养老金
9865 9910
                         $this->bill_user_log($spread_data['uid'], bcmul($pv, 0.05, 2), $store_order_data['order_id'], 5, $store_order_data['order_sn'], '推广获得养老金' . bcmul($pv, 0.05, 2), $store_order_data['mer_id'], 0);
9866
-                        if($store_order_data['share_uid']){
9911
+                        // 1123 用户分享的商品不得分享佣金 先暂时这样写
9912
+                        if($store_order_data['share_uid'] && $store_order_data['share_uid'] != 1123){
9867 9913
                             $this->bill_user_log($store_order_data['share_uid'], bcmul($pv * 0.9, 0.03, 2), $store_order_data['order_id'], 20, $store_order_data['order_sn'], '分享获得佣金', $store_order_data['mer_id'], 0);
9868 9914
                             $this->fugou_user_log($store_order_data['share_uid'], bcmul($pv * 0.1, 0.03, 2), $store_order_data['order_id'], 1);
9869 9915
                         }
@@ -9917,6 +9963,11 @@ class StoreOrderRepository extends BaseRepository
9917 9963
                 $gx_jf = 1400;
9918 9964
                 $yj1 = 200;
9919 9965
                 $le_yw_amount = 600;
9966
+            } else if ($store_product_data['price'] == 5900) {
9967
+                $pv = 5000;
9968
+                $gx_jf = 3500;
9969
+                $yj1 = 500;
9970
+                $le_yw_amount = 1500;
9920 9971
             }
9921 9972
             // 如果是会员专区的商品 不仅要将奖励的状态设置为生效,还要将订单的 结算状态修改为已结算
9922 9973
             Db::name('store_order')->where('group_order_id', $group_order_id)->update(['is_settlement' => 1]);
@@ -10829,6 +10880,8 @@ class StoreOrderRepository extends BaseRepository
10829 10880
             // 执行 Vr 增减 操作
10830 10881
             $userSignVrRepository->execute($userSignVrEntity->getId());
10831 10882
             $paySuccess = true;
10883
+        } else if ($fzonePayTypeEntity->getType() == StoreOrderEnum::FZONE_PAY_TYPE['B6-Cash']['code']) {
10884
+
10832 10885
         } else if ($fzonePayTypeEntity->getType() == StoreOrderEnum::FZONE_PAY_TYPE['A1-VR']['code']) {
10833 10886
             if ($fzonePayTypeEntity->getPrice() > $userEntity->getVr()) {
10834 10887
                 throw new ValidateException('支付失败,VR不足!');
@@ -10910,7 +10963,7 @@ class StoreOrderRepository extends BaseRepository
10910 10963
                 UserBillEnum::ORDER_TYPE['SELF_OPERATED']['code'],
10911 10964
                 UserBillEnum::TYPE_SHOP['Platform']['code'],
10912 10965
                 $storeOrderEntity->getOrderId(),
10913
-                '购买精彩生活商品赠送养老金'
10966
+                '购买精彩生活商品获得养老金'
10914 10967
             );
10915 10968
 
10916 10969
             // 为用户初始胡 贡献值
@@ -10921,7 +10974,7 @@ class StoreOrderRepository extends BaseRepository
10921 10974
                 $storeOrderEntity->getUid(),
10922 10975
                 UserSignGongxianEnum::TYPE['Give']['code'],
10923 10976
                 $gongxian,
10924
-                '购买精彩生活商品赠送贡献值',
10977
+                '购买精彩生活商品获得贡献值',
10925 10978
                 UserSignGongxianEnum::ORDER_TYPE['Platform']['code'],
10926 10979
                 $storeOrderEntity->getOrderId()
10927 10980
             );
@@ -10933,7 +10986,7 @@ class StoreOrderRepository extends BaseRepository
10933 10986
             $userPvLogRepository->addUserPvLog(
10934 10987
                 $storeOrderEntity->getUid(),
10935 10988
                 $pv,
10936
-                '购买精彩生活商品赠送PV值',
10989
+                '购买精彩生活商品获得PV值',
10937 10990
                 UserPvLogEnum::ORDER_TYPE['Platform']['code'],
10938 10991
                 $storeOrderEntity->getOrderId()
10939 10992
             );
@@ -10947,7 +11000,7 @@ class StoreOrderRepository extends BaseRepository
10947 11000
                 UserSignScoreEnum::SOURCE_TYPE['SelfOrder']['code'],
10948 11001
                 UserSignScoreEnum::PM['Income']['code'],
10949 11002
                 $score,
10950
-                '购买精彩生活商品赠送积分',
11003
+                '购买精彩生活商品获得积分',
10951 11004
                 UserSignHongbaoEnum::ORDER_TYPE['Platform']['code'],
10952 11005
                 $storeOrderEntity->getOrderId()
10953 11006
             );
@@ -10961,7 +11014,7 @@ class StoreOrderRepository extends BaseRepository
10961 11014
                     $storeOrderEntity->getUid(),
10962 11015
                     UserSignHongbaoEnum::TYPE['ConsumptionGift']['code'],
10963 11016
                     $hongbao,
10964
-                    '购买精彩生活商品赠送红包',
11017
+                    '购买精彩生活商品获得红包',
10965 11018
                     UserSignHongbaoEnum::ORDER_TYPE['Platform']['code'],
10966 11019
                     $storeOrderEntity->getOrderId()
10967 11020
                 );
@@ -10986,7 +11039,7 @@ class StoreOrderRepository extends BaseRepository
10986 11039
                         UserSignFugouEnum::TYPE['Give']['code'],
10987 11040
                         $fugouBySpreadUid,
10988 11041
                         UserSignFugouEnum::COMMISSION_TYPE['DIRECT_REFERRAL']['code'],
10989
-                        '推广精彩生活区商品赠送复购金',
11042
+                        '推广精彩生活区商品获得复购金',
10990 11043
                         UserSignFugouEnum::ORDER_TYPE['Platform']['code'],
10991 11044
                         $storeOrderEntity->getOrderId()
10992 11045
                     );
@@ -11007,26 +11060,26 @@ class StoreOrderRepository extends BaseRepository
11007 11060
                         UserBillEnum::ORDER_TYPE['SELF_OPERATED']['code'],
11008 11061
                         UserBillEnum::TYPE_SHOP['Platform']['code'],
11009 11062
                         $storeOrderEntity->getOrderId(),
11010
-                        '推广精彩生活区商品赠送佣金'
11063
+                        '推广精彩生活区商品获得佣金'
11011 11064
                     );
11012 11065
 
11013 11066
                     // 初始胡 贡献值
11014 11067
                     $gongxianBySpreadUid = bcmul($storeOrderEntity->getConPri(), CommonEnum::ORDER_EARNING_ALLOCATION['WonderfulLiving']['Spread']['Gongxian']['Ratio']['code'], CommonEnum::DECIMAL_PLACES_OF_THE_AMOUNT);
11015
-                    // 赠送贡献值
11068
+                    // 获得贡献值
11016 11069
                     /** @var UserSignGongxianRepository $userSignGongxianRepository */
11017 11070
                     $userSignGongxianRepository = app()->make(UserSignGongxianRepository::class);
11018 11071
                     $userSignGongxianRepository->addUserSingGongxian(
11019 11072
                         $userEntityBySpreadUid->getUid(),
11020 11073
                         UserSignGongxianEnum::TYPE['Give']['code'],
11021 11074
                         $gongxianBySpreadUid,
11022
-                        '推广精彩生活商品赠送贡献值',
11075
+                        '推广精彩生活商品获得贡献值',
11023 11076
                         UserSignGongxianEnum::ORDER_TYPE['Platform']['code'],
11024 11077
                         $storeOrderEntity->getOrderId()
11025 11078
                     );
11026 11079
 
11027 11080
                     // 计算积分值
11028 11081
                     $scoreBySpreadUid = bcmul($directReferralBonus, CommonEnum::ORDER_EARNING_ALLOCATION['WonderfulLiving']['Spread']['Score']['Ratio']['code'], CommonEnum::DECIMAL_PLACES_OF_THE_AMOUNT);
11029
-                    // 赠送积分
11082
+                    // 获得积分
11030 11083
                     /** @var UserSignScoreRepository $userSignScoreRepository */
11031 11084
                     $userSignScoreRepository = app()->make(UserSignScoreRepository::class);
11032 11085
                     $userSignScoreRepository->addUserSingScore(
@@ -11034,7 +11087,7 @@ class StoreOrderRepository extends BaseRepository
11034 11087
                         UserSignScoreEnum::SOURCE_TYPE['SelfOrder']['code'],
11035 11088
                         UserSignScoreEnum::PM['Income']['code'],
11036 11089
                         $scoreBySpreadUid,
11037
-                        '推广精彩生活区商品赠送积分',
11090
+                        '推广精彩生活区商品获得积分',
11038 11091
                         UserSignHongbaoEnum::ORDER_TYPE['Platform']['code'],
11039 11092
                         $storeOrderEntity->getOrderId()
11040 11093
                     );
@@ -11062,7 +11115,7 @@ class StoreOrderRepository extends BaseRepository
11062 11115
             }
11063 11116
 
11064 11117
             // 分享收益
11065
-            if (!empty($storeOrderEntity->getShareUid())) {
11118
+            if (!empty($storeOrderEntity->getShareUid()) && $storeOrderEntity->getShareUid() != 1123) {
11066 11119
                 $userEntityByShareUid = $userRepository->getUserEntityByUid($storeOrderEntity->getShareUid());
11067 11120
                 if (!empty($userEntityByShareUid->getUid()) && $userEntityByShareUid->getIsDel() == UserEnum::IS_DEL['No']['code']) {
11068 11121
                     // 计算 佣金
@@ -11081,7 +11134,7 @@ class StoreOrderRepository extends BaseRepository
11081 11134
                         UserBillEnum::ORDER_TYPE['SELF_OPERATED']['code'],
11082 11135
                         UserBillEnum::TYPE_SHOP['Platform']['code'],
11083 11136
                         $storeOrderEntity->getOrderId(),
11084
-                        '分享精彩生活区商品赠送佣金'
11137
+                        '分享精彩生活区商品获得佣金'
11085 11138
                     );
11086 11139
                     // 计算 复购金
11087 11140
                     $fugouByShareUid = bcmul($storeOrderEntity->getConPri(), CommonEnum::ORDER_EARNING_ALLOCATION['WonderfulLiving']['Share']['Fugou']['Ratio']['code'], CommonEnum::DECIMAL_PLACES_OF_THE_AMOUNT);
@@ -11093,7 +11146,7 @@ class StoreOrderRepository extends BaseRepository
11093 11146
                         UserSignFugouEnum::TYPE['Give']['code'],
11094 11147
                         $fugouByShareUid,
11095 11148
                         UserSignFugouEnum::COMMISSION_TYPE['SHARE_EARNINGS']['code'],
11096
-                        '分享精彩生活区商品赠送复购金',
11149
+                        '分享精彩生活区商品获得复购金',
11097 11150
                         UserSignFugouEnum::ORDER_TYPE['Platform']['code'],
11098 11151
                         $storeOrderEntity->getOrderId()
11099 11152
                     );
@@ -11122,7 +11175,7 @@ class StoreOrderRepository extends BaseRepository
11122 11175
                         UserBillEnum::ORDER_TYPE['SELF_OPERATED']['code'],
11123 11176
                         UserBillEnum::TYPE_SHOP['Platform']['code'],
11124 11177
                         $storeOrderEntity->getOrderId(),
11125
-                        '锁客佣金(精彩生活区商品赠送)'
11178
+                        '锁客佣金(精彩生活区商品获得)'
11126 11179
                     );
11127 11180
                     // 计算 复购金
11128 11181
                     $fugouByMerId = bcmul($storeOrderEntity->getConPri(), CommonEnum::ORDER_EARNING_ALLOCATION['WonderfulLiving']['Lock']['Fugou']['Ratio']['code'], CommonEnum::DECIMAL_PLACES_OF_THE_AMOUNT);
@@ -11134,7 +11187,7 @@ class StoreOrderRepository extends BaseRepository
11134 11187
                         UserSignFugouEnum::TYPE['Give']['code'],
11135 11188
                         $fugouByMerId,
11136 11189
                         UserSignFugouEnum::COMMISSION_TYPE['LOCKED_CUSTOMER']['code'],
11137
-                        '锁客复购金(精彩生活区商品赠送)',
11190
+                        '锁客复购金(精彩生活区商品获得)',
11138 11191
                         UserSignFugouEnum::ORDER_TYPE['Platform']['code'],
11139 11192
                         $storeOrderEntity->getOrderId()
11140 11193
                     );
@@ -11159,7 +11212,7 @@ class StoreOrderRepository extends BaseRepository
11159 11212
                     UserBillEnum::ORDER_TYPE['SELF_OPERATED']['code'],
11160 11213
                     UserBillEnum::TYPE_SHOP['Platform']['code'],
11161 11214
                     $storeOrderEntity->getOrderId(),
11162
-                    '购买会员专区商品赠送养老金'
11215
+                    '购买会员专区商品获得养老金'
11163 11216
                 );
11164 11217
 
11165 11218
                 // 为用户初始胡 贡献值
@@ -11170,7 +11223,7 @@ class StoreOrderRepository extends BaseRepository
11170 11223
                     $storeOrderEntity->getUid(),
11171 11224
                     UserSignGongxianEnum::TYPE['Give']['code'],
11172 11225
                     $gongxian,
11173
-                    '购买会员专区商品赠送贡献值',
11226
+                    '购买会员专区商品获得贡献值',
11174 11227
                     UserSignGongxianEnum::ORDER_TYPE['Platform']['code'],
11175 11228
                     $storeOrderEntity->getOrderId()
11176 11229
                 );
@@ -11182,7 +11235,7 @@ class StoreOrderRepository extends BaseRepository
11182 11235
                 $userPvLogRepository->addUserPvLog(
11183 11236
                     $storeOrderEntity->getUid(),
11184 11237
                     $pv,
11185
-                    '购买会员专区商品赠送PV值',
11238
+                    '购买会员专区商品获得PV值',
11186 11239
                     UserPvLogEnum::ORDER_TYPE['Platform']['code'],
11187 11240
                     $storeOrderEntity->getOrderId()
11188 11241
                 );
@@ -11196,7 +11249,7 @@ class StoreOrderRepository extends BaseRepository
11196 11249
                     UserSignScoreEnum::SOURCE_TYPE['SelfOrder']['code'],
11197 11250
                     UserSignScoreEnum::PM['Income']['code'],
11198 11251
                     $score,
11199
-                    '购买会员专区商品赠送积分',
11252
+                    '购买会员专区商品获得积分',
11200 11253
                     UserSignHongbaoEnum::ORDER_TYPE['Platform']['code'],
11201 11254
                     $storeOrderEntity->getOrderId()
11202 11255
                 );
@@ -11221,7 +11274,7 @@ class StoreOrderRepository extends BaseRepository
11221 11274
                                 UserSignFugouEnum::TYPE['Give']['code'],
11222 11275
                                 $fugouBySpreadUid,
11223 11276
                                 UserSignFugouEnum::COMMISSION_TYPE['DIRECT_REFERRAL']['code'],
11224
-                                '推广会员专区商品赠送复购金',
11277
+                                '推广会员专区商品获得复购金',
11225 11278
                                 UserSignFugouEnum::ORDER_TYPE['Platform']['code'],
11226 11279
                                 $storeOrderEntity->getOrderId()
11227 11280
                             );
@@ -11242,7 +11295,7 @@ class StoreOrderRepository extends BaseRepository
11242 11295
                                 UserBillEnum::ORDER_TYPE['SELF_OPERATED']['code'],
11243 11296
                                 UserBillEnum::TYPE_SHOP['Platform']['code'],
11244 11297
                                 $storeOrderEntity->getOrderId(),
11245
-                                '推广会员专区商品赠送佣金'
11298
+                                '推广会员专区商品获得佣金'
11246 11299
                             );
11247 11300
                         }
11248 11301
 
@@ -11254,14 +11307,14 @@ class StoreOrderRepository extends BaseRepository
11254 11307
                             $gongxianRatio = CommonEnum::ORDER_EARNING_ALLOCATION['MemberZone']['Spread']['Gongxian']['Ratio']['code'];
11255 11308
                         }
11256 11309
                         $gongxianBySpreadUid = bcmul($basePrice, $gongxianRatio, CommonEnum::DECIMAL_PLACES_OF_THE_AMOUNT);
11257
-                        // 赠送贡献值
11310
+                        // 获得贡献值
11258 11311
                         /** @var UserSignGongxianRepository $userSignGongxianRepository */
11259 11312
                         $userSignGongxianRepository = app()->make(UserSignGongxianRepository::class);
11260 11313
                         $userSignGongxianRepository->addUserSingGongxian(
11261 11314
                             $userEntityBySpreadUid->getUid(),
11262 11315
                             UserSignGongxianEnum::TYPE['Give']['code'],
11263 11316
                             $gongxianBySpreadUid,
11264
-                            '推广会员专区商品赠送贡献值',
11317
+                            '推广会员专区商品获得贡献值',
11265 11318
                             UserSignGongxianEnum::ORDER_TYPE['Platform']['code'],
11266 11319
                             $storeOrderEntity->getOrderId()
11267 11320
                         );
@@ -11271,7 +11324,7 @@ class StoreOrderRepository extends BaseRepository
11271 11324
                         $rate = static::getUserGroupRate($userEntityBySpreadUid->getUserGroup());
11272 11325
                         $scoreByUserGroupRate = bcmul($basePrice, $rate, CommonEnum::CALCULATE_THE_NUMBER_OF_DECIMAL_PLACES);
11273 11326
                         $scoreBySpreadUid = bcmul($scoreByUserGroupRate, CommonEnum::ORDER_EARNING_ALLOCATION['MemberZone']['Spread']['Score']['Ratio']['code'], CommonEnum::DECIMAL_PLACES_OF_THE_AMOUNT);
11274
-                        // 赠送积分
11327
+                        // 获得积分
11275 11328
                         /** @var UserSignScoreRepository $userSignScoreRepository */
11276 11329
                         $userSignScoreRepository = app()->make(UserSignScoreRepository::class);
11277 11330
                         $userSignScoreRepository->addUserSingScore(
@@ -11279,7 +11332,7 @@ class StoreOrderRepository extends BaseRepository
11279 11332
                             UserSignScoreEnum::SOURCE_TYPE['SelfOrder']['code'],
11280 11333
                             UserSignScoreEnum::PM['Income']['code'],
11281 11334
                             $scoreBySpreadUid,
11282
-                            '推广会员专区商品赠送积分',
11335
+                            '推广会员专区商品获得积分',
11283 11336
                             UserSignHongbaoEnum::ORDER_TYPE['Platform']['code'],
11284 11337
                             $storeOrderEntity->getOrderId()
11285 11338
                         );
@@ -11321,7 +11374,7 @@ class StoreOrderRepository extends BaseRepository
11321 11374
                 UserBillEnum::ORDER_TYPE['SELF_OPERATED']['code'],
11322 11375
                 UserBillEnum::TYPE_SHOP['Platform']['code'],
11323 11376
                 $storeOrderEntity->getOrderId(),
11324
-                '购买复购区赠送养老金'
11377
+                '购买复购区获得养老金'
11325 11378
             );
11326 11379
 
11327 11380
             // 给推荐人的奖励
@@ -11342,7 +11395,7 @@ class StoreOrderRepository extends BaseRepository
11342 11395
                         UserBillEnum::ORDER_TYPE['SELF_OPERATED']['code'],
11343 11396
                         UserBillEnum::TYPE_SHOP['Platform']['code'],
11344 11397
                         $storeOrderEntity->getOrderId(),
11345
-                        '推荐复购区商品赠送养老金'
11398
+                        '推荐复购区商品获得养老金'
11346 11399
                     );
11347 11400
 
11348 11401
                     // 给间接推荐人的奖励
@@ -11363,7 +11416,7 @@ class StoreOrderRepository extends BaseRepository
11363 11416
                                 UserBillEnum::ORDER_TYPE['SELF_OPERATED']['code'],
11364 11417
                                 UserBillEnum::TYPE_SHOP['Platform']['code'],
11365 11418
                                 $storeOrderEntity->getOrderId(),
11366
-                                '间推复购区商品赠送养老金'
11419
+                                '间推复购区商品获得养老金'
11367 11420
                             );
11368 11421
                         }
11369 11422
                     }
@@ -11389,7 +11442,7 @@ class StoreOrderRepository extends BaseRepository
11389 11442
                 UserBillEnum::ORDER_TYPE['SELF_OPERATED']['code'],
11390 11443
                 UserBillEnum::TYPE_SHOP['Platform']['code'],
11391 11444
                 $storeOrderEntity->getOrderId(),
11392
-                '购买商贸区商品赠送养老金'
11445
+                '购买商贸区商品获得养老金'
11393 11446
             );
11394 11447
 
11395 11448
             // 为用户初始胡 贡献值
@@ -11400,7 +11453,7 @@ class StoreOrderRepository extends BaseRepository
11400 11453
                 $storeOrderEntity->getUid(),
11401 11454
                 UserSignGongxianEnum::TYPE['Give']['code'],
11402 11455
                 $gongxian,
11403
-                '购买商贸区商品赠送贡献值',
11456
+                '购买商贸区商品获得贡献值',
11404 11457
                 UserSignGongxianEnum::ORDER_TYPE['Platform']['code'],
11405 11458
                 $storeOrderEntity->getOrderId()
11406 11459
             );
@@ -11412,7 +11465,7 @@ class StoreOrderRepository extends BaseRepository
11412 11465
             $userPvLogRepository->addUserPvLog(
11413 11466
                 $storeOrderEntity->getUid(),
11414 11467
                 $pv,
11415
-                '购买商贸区商品赠送PV值',
11468
+                '购买商贸区商品获得PV值',
11416 11469
                 UserPvLogEnum::ORDER_TYPE['Platform']['code'],
11417 11470
                 $storeOrderEntity->getOrderId()
11418 11471
             );
@@ -11426,7 +11479,7 @@ class StoreOrderRepository extends BaseRepository
11426 11479
                 UserSignScoreEnum::SOURCE_TYPE['SelfOrder']['code'],
11427 11480
                 UserSignScoreEnum::PM['Income']['code'],
11428 11481
                 $score,
11429
-                '购买商贸区商品赠送积分',
11482
+                '购买商贸区商品获得积分',
11430 11483
                 UserSignHongbaoEnum::ORDER_TYPE['Platform']['code'],
11431 11484
                 $storeOrderEntity->getOrderId()
11432 11485
             );
@@ -11453,7 +11506,7 @@ class StoreOrderRepository extends BaseRepository
11453 11506
                     $storeOrderEntity->getUid(),
11454 11507
                     UserSignHongbaoEnum::TYPE['ConsumptionGift']['code'],
11455 11508
                     $hongbao,
11456
-                    '购买商贸区商品赠送红包',
11509
+                    '购买商贸区商品获得红包',
11457 11510
                     UserSignHongbaoEnum::ORDER_TYPE['Platform']['code'],
11458 11511
                     $storeOrderEntity->getOrderId()
11459 11512
                 );
@@ -11478,7 +11531,7 @@ class StoreOrderRepository extends BaseRepository
11478 11531
                         UserSignFugouEnum::TYPE['Give']['code'],
11479 11532
                         $fugouBySpreadUid,
11480 11533
                         UserSignFugouEnum::COMMISSION_TYPE['DIRECT_REFERRAL']['code'],
11481
-                        '推广商贸区商品赠送复购金',
11534
+                        '推广商贸区商品获得复购金',
11482 11535
                         UserSignFugouEnum::ORDER_TYPE['Platform']['code'],
11483 11536
                         $storeOrderEntity->getOrderId()
11484 11537
                     );
@@ -11499,25 +11552,25 @@ class StoreOrderRepository extends BaseRepository
11499 11552
                         UserBillEnum::ORDER_TYPE['SELF_OPERATED']['code'],
11500 11553
                         UserBillEnum::TYPE_SHOP['Platform']['code'],
11501 11554
                         $storeOrderEntity->getOrderId(),
11502
-                        '推广商贸区商品赠送佣金'
11555
+                        '推广商贸区商品获得佣金'
11503 11556
                     );
11504 11557
                     // 初始胡 贡献值
11505 11558
                     $gongxianBySpreadUid = bcmul($storeOrderEntity->getConPri(), CommonEnum::ORDER_EARNING_ALLOCATION['CommercialDistrict']['Spread']['Gongxian']['Ratio']['code'], CommonEnum::DECIMAL_PLACES_OF_THE_AMOUNT);
11506
-                    // 赠送贡献值
11559
+                    // 获得贡献值
11507 11560
                     /** @var UserSignGongxianRepository $userSignGongxianRepository */
11508 11561
                     $userSignGongxianRepository = app()->make(UserSignGongxianRepository::class);
11509 11562
                     $userSignGongxianRepository->addUserSingGongxian(
11510 11563
                         $userEntityBySpreadUid->getUid(),
11511 11564
                         UserSignGongxianEnum::TYPE['Give']['code'],
11512 11565
                         $gongxianBySpreadUid,
11513
-                        '推广商贸区商品赠送贡献值',
11566
+                        '推广商贸区商品获得贡献值',
11514 11567
                         UserSignGongxianEnum::ORDER_TYPE['Platform']['code'],
11515 11568
                         $storeOrderEntity->getOrderId()
11516 11569
                     );
11517 11570
 
11518 11571
                     // 计算积分值
11519 11572
                     $scoreBySpreadUid = bcmul($directReferralBonus, CommonEnum::ORDER_EARNING_ALLOCATION['CommercialDistrict']['Spread']['Score']['Ratio']['code'], CommonEnum::DECIMAL_PLACES_OF_THE_AMOUNT);
11520
-                    // 赠送积分
11573
+                    // 获得积分
11521 11574
                     /** @var UserSignScoreRepository $userSignScoreRepository */
11522 11575
                     $userSignScoreRepository = app()->make(UserSignScoreRepository::class);
11523 11576
                     $userSignScoreRepository->addUserSingScore(
@@ -11525,7 +11578,7 @@ class StoreOrderRepository extends BaseRepository
11525 11578
                         UserSignScoreEnum::SOURCE_TYPE['SelfOrder']['code'],
11526 11579
                         UserSignScoreEnum::PM['Income']['code'],
11527 11580
                         $scoreBySpreadUid,
11528
-                        '推广商贸区商品赠送积分',
11581
+                        '推广商贸区商品获得积分',
11529 11582
                         UserSignHongbaoEnum::ORDER_TYPE['Platform']['code'],
11530 11583
                         $storeOrderEntity->getOrderId()
11531 11584
                     );
@@ -11574,7 +11627,7 @@ class StoreOrderRepository extends BaseRepository
11574 11627
                         UserBillEnum::ORDER_TYPE['SELF_OPERATED']['code'],
11575 11628
                         UserBillEnum::TYPE_SHOP['Platform']['code'],
11576 11629
                         $storeOrderEntity->getOrderId(),
11577
-                        '锁客佣金(精彩生活区商品赠送)'
11630
+                        '锁客佣金(精彩生活区商品获得)'
11578 11631
                     );
11579 11632
 
11580 11633
                     // 计算 复购金
@@ -11587,7 +11640,7 @@ class StoreOrderRepository extends BaseRepository
11587 11640
                         UserSignFugouEnum::TYPE['Give']['code'],
11588 11641
                         $fugouByMerId,
11589 11642
                         UserSignFugouEnum::COMMISSION_TYPE['LOCKED_CUSTOMER']['code'],
11590
-                        '锁客复购金(精彩生活区商品赠送)',
11643
+                        '锁客复购金(精彩生活区商品获得)',
11591 11644
                         UserSignFugouEnum::ORDER_TYPE['Platform']['code'],
11592 11645
                         $storeOrderEntity->getOrderId()
11593 11646
                     );

파일 크기가 너무 크기때문에 변경 상태를 표시하지 않습니다.
+ 0 - 9137
app/common/repositories/store/order/StoreOrderRepositoryCopy.php


+ 4 - 0
app/common/repositories/store/product/ProductRepository.php

@@ -1043,6 +1043,8 @@ class ProductRepository extends BaseRepository
1043 1043
                 $s= 2000;
1044 1044
             }else if($res['price'] == 9440){
1045 1045
                 $s = 8000;
1046
+            }else if($res['price'] == 5900){
1047
+                $s = 5000;
1046 1048
             }
1047 1049
 
1048 1050
             $res['yanglao'] = bcmul($s, 0.035, 2);
@@ -1717,6 +1719,8 @@ class ProductRepository extends BaseRepository
1717 1719
                 $num_yl = 2000;
1718 1720
             }else if($product['price'] == '9440'){
1719 1721
                 $num_yl = 8000;
1722
+            }else if($product['price'] == '5900'){
1723
+                $num_yl = 5000;
1720 1724
             }
1721 1725
 
1722 1726
             if($product['mer_id'] == 496){

+ 2 - 0
app/common/repositories/system/merchant/MerchantRepository.php

@@ -453,6 +453,8 @@ class MerchantRepository extends BaseRepository
453 453
                 $num_yl = 2000;
454 454
             }else if($v['price'] == '9440'){
455 455
                 $num_yl = 8000;
456
+            }else if($v['price'] == '5900'){
457
+                $num_yl = 5000;
456 458
             }
457 459
 
458 460
             if($productMerId == 496){

+ 1 - 1
app/common/repositories/user/UserPvLogRepository.php

@@ -186,7 +186,7 @@ class UserPvLogRepository extends BaseRepository
186 186
                 );
187 187
             }
188 188
 
189
-            if (!empty($updateUserBillEntityList)) {
189
+            if (!empty($updateUserPvLogEntityList)) {
190 190
                 $this->batchUpdateUserPvLogDataByDataList(
191 191
                     array_map(function (UserPvLogEntity $updateUserPvLogEntity) {
192 192
                         return $updateUserPvLogEntity->toUnderlineArray();

+ 13 - 3
app/common/repositories/user/UserRepository.php

@@ -2911,7 +2911,14 @@ class UserRepository extends BaseRepository
2911 2911
             //            $birth = strtotime(substr($certification["user_card"], 6, 8));
2912 2912
             $old_age = $this->getSex($certification["user_card"])?60:55;
2913 2913
             //            $age = $this->howOld($birth);
2914
-            $age=$this->calculateAge($birth_data);
2914
+
2915
+
2916
+            // 兼容港澳台证件号
2917
+            if ($certification['card_type'] == 1){
2918
+                $age=$this->calculateAge($birth_data);
2919
+            }else{
2920
+                $age=$this->calculateAge($certification['birthday']);
2921
+            }
2915 2922
 
2916 2923
             if ($age < $old_age) {
2917 2924
                 //                $yes = $old_age - $age;
@@ -2932,8 +2939,11 @@ class UserRepository extends BaseRepository
2932 2939
             $data['annuity_yiqu'] = 123;
2933 2940
 
2934 2941
 
2935
-
2936
-            $data["birthday60"] =  $this->getFutureBirthday($birth_data,$old_age);
2942
+            if ($certification['card_type'] == 1) {
2943
+                $data["birthday60"] =  $this->getFutureBirthday($birth_data,$old_age);
2944
+            }else{
2945
+                $data["birthday60"] =  $this->getFutureBirthday($certification['birthday'],$old_age);
2946
+            }
2937 2947
         }
2938 2948
         $order_merchant_price= OrderMerchant::getInstance()->where('paid', 1)
2939 2949
             ->where(function ($query) use ($data) {

+ 172 - 22
app/controller/admin/order/Order.php

@@ -346,18 +346,18 @@ class Order extends BaseController
346 346
             Db::startTrans();
347 347
             //查找是否有推荐人
348 348
             $spreadUid = Db::name('user')->where('uid', $uid)->value('spread_uid');
349
-            //取出并删除 pv
349
+            //取出pv
350 350
             $pv = $this->getValue('user_pv_log', [['order_id', '=', $order_id], ['status', '=', 1],], 'pv');
351
-            //取出 vr 消耗
351
+            //取出 vr
352 352
             $payVr = $this->getValue('user_sign_vr', [['order_id', '=', $order_id], ['type', '=', 2],], 'number');
353 353
             //取出购买赠送积分 / 支出积分
354 354
             $score = $this->getValue('user_sign_score', [['order_id', '=', $order_id], ['status', '=', 1], ['source_type', '=', 3], ['uid', '=', $uid], ['pm', '=', 1],], 'reward_socre');
355 355
             $payScore = $this->getValue('user_sign_score', [['order_id', '=', $order_id], ['status', '=', 1], ['pm', '=', 2], ['uid', '=', $uid],], 'reward_socre');
356 356
             // 贡献值
357 357
             $gongXian = $this->getValue('user_sign_gongxian', [['order_id', '=', $order_id], ['status', '=', 1], ['type', '=', 1], ['uid', '=', $uid],], 'number');
358
-            // 养老金 / 推广养老金 / 推广佣金
358
+            // 养老金
359 359
             $yangLaoJin = $this->getValue('user_bill', [['link_id', '=', $order_id], ['status', '=', 1], ['pm', '=', 1], ['uid', '=', $uid],], 'number');
360
-            if($spreadUid){
360
+            if($spreadUid){  //如果有推荐人就执行
361 361
                 $spreadScore = 0;
362 362
                 $spreadGongXian = 0;
363 363
                 $spreadYlj = 0;
@@ -367,39 +367,79 @@ class Order extends BaseController
367 367
                 $spreadYlj = $this->getValue('user_bill', [['link_id', '=', $order_id], ['commission_type', '=', 5], ['uid', '=', $spreadUid],], 'number'); //推荐获得养老金
368 368
                 $spreadYongJin = $this->getValue('user_bill', [['link_id', '=', $order_id], ['commission_type', '=', 3], ['uid', '=', $spreadUid],], 'number');  //推荐获得佣金
369 369
                 $spreadUser = Db::name('user')->where('uid', $spreadUid)->find();
370
-                Db::name('backup_user')->insert($spreadUser);
371
-                Db::name('user')->where('uid', $spreadUid)->dec('score', $spreadScore)->update();
372
-                Db::name('user')->where('uid', $spreadUid)->dec('per_contribute', $spreadGongXian)->update();
373
-                Db::name('user')->where('uid', $spreadUid)->dec('annuity', $spreadYlj)->update();
374
-                Db::name('user')->where('uid', $spreadUid)->dec('brokerage_price', $spreadYongJin)->update();
370
+                Db::name('backup_user')->insert($spreadUser);  //插入备份表
371
+                Db::name('user')->where('uid', $spreadUid)   //更新数据
372
+                    ->update([
373
+                        'score' => Db::raw("score - {$spreadScore}"),
374
+                        'per_contribute' => Db::raw("per_contribute - {$spreadGongXian}"),
375
+                        'brokerage_price' => Db::raw("brokerage_price - {$spreadYongJin}"),
376
+                        'annuity' => Db::raw("annuity - {$spreadYlj}"),
377
+                    ]);
378
+                $userhjm1 =[
379
+                    'uid' => $spreadUid,
380
+                    'order_id' => $order_id,
381
+                    'score' => $spreadScore??0,
382
+                    'per_contribute' => $spreadGongXian??0,
383
+                    'brokerage_price' => $spreadYongJin??0,
384
+                    'user' => 2,
385
+                ];
386
+                Db::name('backup_user_change')->insert($userhjm1);   //插入更新数据记录表
375 387
             }
376 388
             //扫吗消费
377 389
             $smSpreadUid = $this->getValue('user_sign_score', [['order_id', '=', $order_id], ['mark','like','%扫码%'], ['status', '=', 1],], 'uid');
378 390
             $smSpreadScore = $this->getValue('user_sign_score', [['order_id', '=', $order_id], ['uid','=',$smSpreadUid], ['status', '=', 1],], 'reward_socre');
379 391
             //第二推荐
380
-            $spreadYongJinTwo = $this->getValue('user_bill', [['link_id', '=', $order_id], ['commission_type', '=', 3], ['uid', '<>', $spreadUid],], 'number');
381
-            $spreadYongJinTwoUid = $this->getValue('user_bill', [['link_id', '=', $order_id], ['commission_type', '=', 3], ['uid', '<>', $spreadUid],], 'uid');
382
-            //更新对应的user表
392
+            $spreadYongJinTwoUid = $this->getValue('user_bill', [['link_id', '=', $order_id], ['commission_type', '=', 3], ['uid', 'not in', [$uid, $spreadUid]],], 'uid');
393
+            $spreadYongJinTwo = $this->getValue('user_bill', [['link_id', '=', $order_id], ['commission_type', '=', 3], ['uid', '=', $spreadYongJinTwoUid],], 'number');
394
+            //更新购买用户的user表
395
+            $uscore = $payScore - $score;
383 396
             $user = Db::name('user')->where('uid', $uid)->find();
384 397
             Db::name('backup_user')->insert($user);
385
-            Db::name('user')->where('uid', $uid)->dec('pv', $pv)->update();
386
-            Db::name('user')->where('uid', $uid)->inc('vr', $payVr)->update();
387
-            Db::name('user')->where('uid', $uid)->inc('score', $payScore)->update();
388
-            Db::name('user')->where('uid', $uid)->dec('score', $score)->update();
389
-            Db::name('user')->where('uid', $uid)->dec('contribute', $gongXian)->update();
390
-            Db::name('user')->where('uid', $uid)->dec('annuity', $yangLaoJin)->update();
398
+            Db::name('user')->where('uid', $uid)
399
+                ->update([
400
+                    'pv'         => Db::raw("pv - {$pv}"),
401
+                    'vr'         => Db::raw("vr + {$payVr}"),
402
+                    'score'      => Db::raw("score + {$uscore}"),
403
+                    'contribute' => Db::raw("contribute - {$gongXian}"),
404
+                    'annuity'    => Db::raw("annuity - {$yangLaoJin}"),
405
+                ]);
406
+            $userhjm =[
407
+                'uid' => $uid,
408
+                'order_id' => $order_id,
409
+                'pv' => $pv??0,
410
+                'vr' => $payVr??0,
411
+                'score' => $uscore??0,
412
+                'contribute' => $gongXian??0,
413
+                'annuity' => $yangLaoJin??0,
414
+                'user' => 1,
415
+            ];
416
+            Db::name('backup_user_change')->insert($userhjm);//具体修改插入对应表
391 417
             //第二推荐
392 418
             if($spreadYongJinTwoUid) {
393 419
                 $spreadUserTwo = Db::name('user')->where('uid', $spreadYongJinTwoUid)->find();
394 420
                 Db::name('backup_user')->insert($spreadUserTwo);
395 421
                 Db::name('user')->where('uid', $spreadYongJinTwoUid)->dec('brokerage_price', $spreadYongJinTwo)->update();
396
-            }
422
+                $userhjm2 =[
423
+                    'uid' => $spreadYongJinTwoUid,
424
+                    'order_id' => $order_id,
425
+                    'brokerage_price' => $spreadYongJinTwo??0,
426
+                    'user' => 3,
427
+                ];
428
+                Db::name('backup_user_change')->insert($userhjm2);
429
+            }//扫码消费
397 430
             if($smSpreadUid){
398 431
                 $smUserTwo = Db::name('user')->where('uid', $smSpreadUid)->find();
399 432
                 Db::name('backup_user')->insert($smUserTwo);
400 433
                 Db::name('user')->where('uid', $smSpreadUid)->dec('score', $smSpreadScore)->update();
434
+                $userhjm3 =[
435
+                    'uid' => $smSpreadUid,
436
+                    'order_id' => $order_id,
437
+                    'score' => $smSpreadScore??0,
438
+                    'user' => 4,
439
+                ];
440
+                Db::name('backup_user_change')->insert($userhjm3);
401 441
             }
402
-            // 删除订单相关表
442
+            // 删除订单相关表p;
403 443
             $this->backupAndDelete('store_order', ['group_order_id' => $group_order_id]);
404 444
             $this->backupAndDelete('store_group_order', ['group_order_id' => $group_order_id]);
405 445
             $this->backupAndDelete('user_pv_log', ['order_id' => $order_id]);
@@ -416,7 +456,7 @@ class Order extends BaseController
416 456
         return app('json')->success('操作成功');
417 457
     }
418 458
 
419
-    private function backupAndDelete($table, array $where)
459
+    private function backupAndDelete($table, array $where)//备份并删除
420 460
     {
421 461
         $backupTable = 'backup_' . $table;
422 462
         $rows = Db::name($table)->where($where)->select()->toArray();
@@ -425,9 +465,119 @@ class Order extends BaseController
425 465
             Db::name($table)->where($where)->delete();
426 466
         }
427 467
     }
428
-    private function getValue($table, array $where, string $field, $default = 0)
468
+    private function getValue($table, array $where, string $field, $default = 0)//查找
429 469
     {
430 470
         $value = Db::name($table)->where($where)->value($field);
431 471
         return $value ?? $default;
432 472
     }
473
+
474
+    /**
475
+     * 展示撤回订单列表,恢复订单
476
+     */
477
+    public function killOrderLst()  //撤回订单的列表
478
+    {
479
+        $query = Db::name('backup_store_order')->paginate(20)->toArray();
480
+        return app('json')->success($query, '获取成功');
481
+    }
482
+    public function easterKillOrder(){   //恢复订单
483
+        $group_order_id = request()->param('group_order_id');
484
+        $order_id = request()->param('order_id');
485
+        if (empty($order_id) || empty($group_order_id)) {
486
+            return app('json')->fail('参数缺失');
487
+        }
488
+        try {
489
+            Db::startTrans();
490
+            // 恢复订单相关表
491
+            $this->easterOrder('store_order', ['group_order_id' => $group_order_id]);
492
+            $this->easterOrder('store_group_order', ['group_order_id' => $group_order_id]);
493
+            // 恢复 pv
494
+            $this->easterOrder('user_pv_log', ['order_id' => $order_id]);
495
+            // 恢复 vr
496
+            $this->easterOrder('user_sign_vr', ['order_id' => $order_id]);
497
+            // 恢复 积分
498
+            $this->easterOrder('user_sign_score', ['order_id' => $order_id]);
499
+            // 恢复 贡献值
500
+            $this->easterOrder('user_sign_gongxian', ['order_id' => $order_id]);
501
+            // 恢复 佣金/养老金等
502
+            $this->easterOrder('user_bill', ['link_id' => $order_id]);
503
+            // 恢复 公证处
504
+            $this->easterOrder('gzc_logs', ['link_id' => $order_id]);
505
+            //恢复用户奖励
506
+            $this->easterUserAward(['order_id' => $order_id]);
507
+            Db::commit();
508
+        } catch (\Exception $e) {
509
+            Db::rollback();
510
+            return app('json')->fail('撤回失败: '.$e->getMessage());
511
+        }
512
+        return app('json')->success('撤回成功');
513
+    }
514
+    private function easterOrder($table, array $where)  //恢复表数据
515
+    {
516
+        $backupTable = 'backup_' . $table;
517
+        $rows = Db::name($backupTable)->where($where)->select()->toArray();
518
+
519
+        if ($rows) {
520
+            foreach ($rows as &$row) {
521
+                if (isset($row['del_time'])) unset($row['del_time']);
522
+            }
523
+            unset($row);
524
+            Db::name($table)->insertAll($rows);
525
+            Db::name($backupTable)->where($where)->delete();
526
+        }
527
+    }
528
+    private function easterUserAward(array $where){  //恢复奖励
529
+        $row = Db::name('backup_user_change')->where($where)->where('user', 1)->field('pv, vr, score, contribute, annuity,uid')->find();
530
+        $uid = $row['uid'];
531
+        $pv   = $row['pv'];
532
+        $vr   = $row['vr'];
533
+        $score= $row['score'];
534
+        $contribute = $row['contribute'];
535
+        $annuity = $row['annuity'];
536
+        Db::name('user') //更新订单用户
537
+            ->where('uid', $uid)
538
+            ->update([
539
+                'pv'         => Db::raw("pv + {$pv}"),
540
+                'vr'         => Db::raw("vr - {$vr}"),
541
+                'score'      => Db::raw("score - {$score}"),
542
+                'contribute' => Db::raw("contribute + {$contribute}"),
543
+                'annuity'    => Db::raw("annuity + {$annuity}"),
544
+            ]);
545
+        $row2 = Db::name('backup_user_change')->where($where)->where('user', 2)->field('brokerage_price, score, per_contribute, annuity,uid')->find();
546
+        if ($row2) {
547
+            $spreadUid = $row2['uid'];
548
+            $spreadScore = $row2['score'];
549
+            $per_contribute = $row2['per_contribute'];
550
+            $spreadAnnuity = $row2['annuity'];
551
+            $spreadYongJin = $row2['brokerage_price'];
552
+            Db::name('user')     //更新推荐人
553
+            ->where('uid', $spreadUid)
554
+                ->update([
555
+                    'score' => Db::raw("score + {$spreadScore}"),
556
+                    'contribute' => Db::raw("contribute + {$per_contribute}"),
557
+                    'annuity' => Db::raw("annuity + {$spreadAnnuity}"),
558
+                    'brokerage_price' => Db::raw("brokerage_price + {$spreadYongJin}"),
559
+                    'per_contribute'=> Db::raw("per_contribute + {$per_contribute}"),
560
+                ]);
561
+        }
562
+        $row3 = Db::name('backup_user_change')->where($where)->where('user', 3)->field('brokerage_price,uid')->find();
563
+        if ($row3) {
564
+            $spreadUidTwo = $row3['uid']; //第二推荐人
565
+            $spreadYongJin2 = $row3['brokerage_price'];
566
+            Db::name('user')
567
+                ->where('uid', $spreadUidTwo)
568
+                ->update([
569
+                    'brokerage_price' => Db::raw("brokerage_price + {$spreadYongJin2}"),
570
+                ]);
571
+        }
572
+        $row4 = Db::name('backup_user_change')->where($where)->where('user', 4)->field('score,uid')->find();
573
+        if ($row4) {
574
+            $spreadUidThree = $row4['uid'];   //扫码
575
+            $spreadScore3 = $row4['score'];
576
+            Db::name('user')
577
+                ->where('uid', $spreadUidThree)
578
+                ->update([
579
+                    'score' => Db::raw("score + {$spreadScore3}"),
580
+                ]);
581
+        }
582
+    }
433 583
 }

+ 506 - 1
app/controller/admin/order/ThirdOrder.php

@@ -3,6 +3,7 @@ namespace app\controller\admin\order;
3 3
 
4 4
 use app\common\repositories\user\UserThirdRepository;
5 5
 use crmeb\basic\BaseController;
6
+use crmeb\services\SpreadsheetExcelService;
6 7
 use think\App;
7 8
 
8 9
 class ThirdOrder extends BaseController
@@ -71,5 +72,509 @@ class ThirdOrder extends BaseController
71 72
         return app('json')->success($this->repository->GetThirdDetail($id,$table['table']));
72 73
     }
73 74
 
74
-
75
+    /**
76
+     * 导出第三方订单
77
+     */
78
+    public function getJdOrder()
79
+    {
80
+        $where = $this->request->params(['date','order_sn','status','keywords','bill_status']);//筛选条件
81
+        $page = 1;
82
+        $limit = 9999999;
83
+        $temporaryData = $this->repository->GetJdOrder($where,$page,$limit);
84
+        $data = $temporaryData['list'];
85
+        $arr = [];
86
+        foreach ($data as $item) {
87
+            $arr[] = [
88
+                $item['order_jd_id'] ?? '',       // 订单表ID
89
+                $item['uid'] ?? '',               // 用户ID
90
+                $item['commission'] ?? '',        // 佣金 actualFee
91
+                $item['commission_share'] ?? '',  // 佣金比例 finalRate
92
+                $item['jd_id'] ?? '',             // 订单id
93
+                $item['order_sn'] ?? '',          // 订单号
94
+                $item['pay_money'] ?? '',         // 实际计算佣金的金额
95
+                $item['create_time'] ?? '',       // 创建时间
96
+                $item['finish_time'] ?? '',       // 完成时间
97
+                $item['modify_time'] ?? '',       // 更新时间
98
+                $item['sku_num'] ?? '',           // 数量
99
+                $item['sku_id'] ?? '',            // 商品id
100
+                $item['sku_name'] ?? '',          // 商品名称
101
+                $item['price'] ?? '',             // 单价
102
+                $item['sub_union_id'] ?? '',      // 子渠道id-用户pid
103
+                $item['image_url'] ?? '',         // 商品图片
104
+                $item['shop_name'] ?? '',         // 店铺名称
105
+                $item['shop_id'] ?? '',           // 店铺id
106
+                $item['status'] ?? '',            // 订单状态 validCode
107
+                $item['bill_status'] ?? '',       // 结算状态
108
+                $item['bill_create_time'] ?? '',  // 平台结算时间
109
+                $item['bill_end_time'] ?? '',     // 可结算日期
110
+                $item['gzc'] ?? '',               // 公证处标记
111
+                $item['user_address_ids'] ?? '',  // 详细地址串
112
+                $item['type'] ?? '',              // 订单类型
113
+                $item['pv'] ?? '',                // PV值
114
+            ];
115
+        }
116
+        $header = [
117
+            '订单表ID',
118
+            '用户ID',
119
+            '佣金 (actualFee)',
120
+            '佣金比例 (finalRate)',
121
+            '订单ID',
122
+            '订单号',
123
+            '实际计算佣金的金额',
124
+            '创建时间',
125
+            '完成时间',
126
+            '更新时间',
127
+            '数量',
128
+            '商品ID',
129
+            '商品名称',
130
+            '单价',
131
+            '子渠道ID (用户PID)',
132
+            '商品图片',
133
+            '店铺名称',
134
+            '店铺ID',
135
+            '订单状态 (validCode)',
136
+            '0平台未结算1已结算2失效',
137
+            '平台结算时间',
138
+            '可结算日期',
139
+            '公证处IN10是否发起0否1是',
140
+            '详细地址串',
141
+            '1京推推订单 2京东联盟订单',
142
+            'PV值',
143
+        ];
144
+        $filename = '京东订单导出_' . date('YmdHis') . '_' . rand(10000,99999);
145
+        $_instance = SpreadsheetExcelService::instance_xin();
146
+        $_path = $_instance
147
+            ->createOrActive()
148
+            ->setExcelHeader($header)
149
+            ->setExcelTile('京东订单明细', $filename, '生成时间: ' . date('Y-m-d H:i:s'))
150
+            ->setExcelContent($arr)
151
+            ->excelSave($filename, 'xlsx', 'extract');
152
+        $domain = request()->domain();
153
+        return [
154
+            'name' => $filename . '.xlsx',
155
+            'status' => 200,
156
+            'path' => $domain . '/' . $_path
157
+        ];
158
+    }
159
+    public function  getWphOrder()
160
+    {
161
+        $where = $this->request->params(['date','order_sn','order_status','keywords','bill_status','settled']);
162
+        $page = 1;
163
+        $limit = 9999999;
164
+        $temporaryData = $this->repository->GetVipOrder($where,$page,$limit);
165
+        $data = $temporaryData['list'];
166
+        $arr = [];
167
+        foreach ($data as $item) {
168
+            $arr[] = [
169
+                $item['order_vip_id'],
170
+                $item['uid'],
171
+                $item['pid'],
172
+                $item['order_sn'],
173
+                $item['pay_money'],
174
+                $item['status'],
175
+                $item['new_customer'],
176
+                $item['order_time'],
177
+                $item['sign_time'],
178
+                $item['settled_time'],
179
+                $item['goods_id'],
180
+                $item['goods_name'],
181
+                $item['goods_thumb'],
182
+                $item['goods_count'],
183
+                $item['commission_total'],
184
+                $item['commission_rate'],
185
+                $item['commission'],
186
+                $item['commission_time'],
187
+                $item['order_source'],
188
+                $item['last_update_time'],
189
+                $item['settled'],
190
+                $item['self_buy'],
191
+                $item['order_status'],
192
+                $item['after_commission'],
193
+                $item['after_count'],
194
+                $item['bill_status'],
195
+                $item['bill_end_time'],
196
+                $item['create_time'],
197
+                $item['gzc'],
198
+                $item['bill_create_time'],
199
+                $item['user_address_ids'],
200
+                $item['pv'],
201
+            ];
202
+        }
203
+        $header = [
204
+            '订单表ID',
205
+            '用户ID',
206
+            '关联PID',
207
+            '订单号',
208
+            '订单支付金额',
209
+            '订单状态(0不合格1待定2已完结)',
210
+            '新老客(0待定1新客2老客)',
211
+            '下单时间',
212
+            '签收时间',
213
+            '结算时间',
214
+            '商品ID',
215
+            '商品名称',
216
+            '商品缩略图',
217
+            '商品数量',
218
+            '商品计佣金额',
219
+            '商品佣金比例(%)',
220
+            '商品佣金金额',
221
+            '入账时间',
222
+            '订单来源',
223
+            '上次更新时间',
224
+            '结算状态(0未结算1已结算)',
225
+            '是否自推自买(0否1是)',
226
+            '订单子状态',
227
+            '售后佣金变动',
228
+            '售后数量变动',
229
+            '结算标记(0未结算1已结算2失效)',
230
+            '可结算日期(时间戳)',
231
+            '订单创建时间',
232
+            '公证处标记(0否1是)',
233
+            '平台结算时间',
234
+            '详细地址串',
235
+            'PV值',
236
+        ];
237
+        $filename = '唯品会订单导出_' . date('YmdHis') . '_' . rand(10000,99999);
238
+        $_instance = SpreadsheetExcelService::instance_xin();
239
+        $_path = $_instance
240
+            ->createOrActive()
241
+            ->setExcelHeader($header)
242
+            ->setExcelTile('唯品会订单明细', $filename, '生成时间: ' . date('Y-m-d H:i:s'))
243
+            ->setExcelContent($arr)
244
+            ->excelSave($filename, 'xlsx', 'extract');
245
+        $domain = request()->domain();
246
+        return [
247
+            'name' => $filename . '.xlsx',
248
+            'status' => 200,
249
+            'path' => $domain . '/' . $_path
250
+        ];
251
+    }
252
+    public function  getPddOrder()
253
+    {
254
+        $where = $this->request->params(['date','order_sn','pin_order_status','keywords','bill_status']);
255
+        $page = 1;
256
+        $limit = 9999999;
257
+        $temporaryData = $this->repository->GetPddOrder($where,$page,$limit);
258
+        $data = $temporaryData['list'];
259
+        $arr = [];
260
+        foreach ($data as $item) {
261
+            $arr[] = [
262
+                $item['order_pdd_id'],
263
+                $item['uid'],
264
+                $item['goods_id'],
265
+                $item['goods_sign'],
266
+                $item['order_sn'],
267
+                $item['goods_num'],
268
+                $item['goods_img'],
269
+                $item['goods_name'],
270
+                $item['goods_price'],
271
+                $item['order_type'],
272
+                $item['pin_order_status'],
273
+                $item['pin_order_status_desc'],
274
+                $item['order_money'],
275
+                $item['pay_money'],
276
+                $item['create_time'],
277
+                $item['group_time'],
278
+                $item['pay_time'],
279
+                $item['receive_time'],
280
+                $item['settle_time'],
281
+                $item['last_modify_time'],
282
+                $item['p_id'],
283
+                $item['commission_rate'],
284
+                $item['commission'],
285
+                $item['bill_status'],
286
+                $item['bill_create_time'],
287
+                $item['bill_end_time'],
288
+                $item['gzc'],
289
+                $item['user_address_ids'],
290
+                $item['pv'],
291
+            ];
292
+        }
293
+        $header = [
294
+            '订单ID',
295
+            '用户ID',
296
+            '商品ID',
297
+            '商品sign',
298
+            '订单号',
299
+            '商品数量',
300
+            '商品图片',
301
+            '商品名称',
302
+            '商品单价',
303
+            '订单类型',
304
+            '订单状态码',
305
+            '订单状态描述',
306
+            '订单金额',
307
+            '实付金额',
308
+            '创建时间',
309
+            '成团时间',
310
+            '支付时间',
311
+            '收货时间',
312
+            '结算时间',
313
+            '最后更新时间',
314
+            'PID',
315
+            '佣金比例',
316
+            '佣金金额',
317
+            '结算状态',
318
+            '平台结算时间',
319
+            '可结算日期',
320
+            '公证处IN10是否发起0否1是',
321
+            '地址详情',
322
+            'PV值',
323
+        ];
324
+        $filename = '拼多多订单导出_' . date('YmdHis') . '_' . rand(10000,99999);
325
+        $_instance = SpreadsheetExcelService::instance_xin();
326
+        $_path = $_instance
327
+            ->createOrActive()
328
+            ->setExcelHeader($header)
329
+            ->setExcelTile('拼多多订单明细', $filename, '生成时间: ' . date('Y-m-d H:i:s'))
330
+            ->setExcelContent($arr)
331
+            ->excelSave($filename, 'xlsx', 'extract');
332
+        $domain = request()->domain();
333
+        return [
334
+            'name' => $filename . '.xlsx',
335
+            'status' => 200,
336
+            'path' => $domain . '/' . $_path
337
+        ];
338
+    }
339
+    public function getSuOrder()
340
+    {
341
+        $where = $this->request->params(['date','order_sn','status','keywords','bill_status']);
342
+        $page = 1;
343
+        $limit = 9999999;
344
+        $temporaryData = $this->repository->GetSuOrder($where,$page,$limit);
345
+        $data = $temporaryData['list'];
346
+        $arr = [];
347
+        foreach ($data as $item) {
348
+            $arr[] = [
349
+                $item['uid'],
350
+                $item['order_sn'],
351
+                $item['pid'],
352
+                $item['status'],
353
+                $item['goods_id'],
354
+                $item['goods_name'],
355
+                $item['goods_thumb'],
356
+                $item['goods_count'],
357
+                $item['cust_no'],
358
+                $item['order_time'],
359
+                $item['pay_time'],
360
+                $item['change_time'],
361
+                $item['settled_time'],
362
+                $item['refund_time'],
363
+                $item['total_amount'],
364
+                $item['pay_amount'],
365
+                $item['commission_rate'],
366
+                $item['commission'],
367
+                $item['pre_commission'],
368
+                $item['bill_status'],
369
+                $item['bill_create_time'],
370
+                $item['bill_end_time'],
371
+                $item['create_time'],
372
+                $item['gzc'],
373
+                $item['user_address_ids'],
374
+                $item['pv'],
375
+            ];
376
+        }
377
+        $header = [
378
+            '用户ID',
379
+            '订单行号',
380
+            '第三方标示',
381
+            '订单状态名称',
382
+            '商品ID',
383
+            '商品名称',
384
+            '商品图片',
385
+            '数量',
386
+            '推广会员编码',
387
+            '下单时间',
388
+            '支付时间',
389
+            '变动时间',
390
+            '结算时间',
391
+            '退款时间',
392
+            '订单金额',
393
+            '实付金额',
394
+            '佣金比例',
395
+            '佣金金额',
396
+            '预估佣金',
397
+            '结算状态',
398
+            '平台结算时间',
399
+            '可结算日期',
400
+            '创建时间',
401
+            '公证处IN10是否发起0否1是',
402
+            '详细地址串',
403
+            'PV值',
404
+        ];
405
+        $filename = '苏宁订单导出_' . date('YmdHis') . '_' . rand(10000,99999);
406
+        $_instance = SpreadsheetExcelService::instance_xin();
407
+        $_path = $_instance
408
+            ->createOrActive()
409
+            ->setExcelHeader($header)
410
+            ->setExcelTile('苏宁订单明细', $filename, '生成时间: ' . date('Y-m-d H:i:s'))
411
+            ->setExcelContent($arr)
412
+            ->excelSave($filename, 'xlsx', 'extract');
413
+        $domain = request()->domain();
414
+        return [
415
+            'name' => $filename . '.xlsx',
416
+            'status' => 200,
417
+            'path' => $domain . '/' . $_path
418
+        ];
419
+    }
420
+    public function getTbOrder()
421
+    {
422
+        $where = $this->request->params(['date','order_sn','tk_status','keywords','bill_status']);
423
+        $page = 1;
424
+        $limit = 9999999;
425
+        $temporaryData = $this->repository->GetTbOrder($where,$page,$limit);
426
+        $data = $temporaryData['list'];
427
+        $arr = [];
428
+        foreach ($data as $item) {
429
+            $arr[] = [
430
+                $item['order_tb_id'],
431
+                $item['uid'],
432
+                $item['pid'],
433
+                $item['type'],
434
+                $item['order_sn'],
435
+                $item['trade_id'],
436
+                $item['pub_id'],
437
+                $item['item_id'],
438
+                $item['item_img'],
439
+                $item['item_title'],
440
+                $item['item_num'],
441
+                $item['item_price'],
442
+                $item['seller_shop_title'],
443
+                $item['pay_price'],
444
+                $item['alipay_total_price'],
445
+                $item['tk_status'],
446
+                $item['create_time'],
447
+                $item['tk_earning_time'],
448
+                $item['pub_share_rate'],
449
+                $item['tk_total_rate'],
450
+                $item['income_rate'],
451
+                $item['commission_rate'],
452
+                $item['commission'],
453
+                $item['bill_status'],
454
+                $item['bill_create_time'],
455
+                $item['bill_end_time'],
456
+                $item['gzc'],
457
+                $item['user_address_ids'],
458
+                $item['pv'],
459
+            ];
460
+        }
461
+        $header = [
462
+            '订单表ID',
463
+            '用户ID',
464
+            'PID',
465
+            '类型',
466
+            '订单号',
467
+            '交易号',
468
+            '推广者ID',
469
+            '商品ID',
470
+            '商品图片',
471
+            '商品名称',
472
+            '数量',
473
+            '单价',
474
+            '店铺名称',
475
+            '支付金额',
476
+            '拍下付款金额',
477
+            '订单状态',
478
+            '下单时间',
479
+            '订单确认收货后且商家完成佣金支付的时间',
480
+            '从结算佣金中分得的收益比率',
481
+            '提成=收入比率*分成比率。指实际获得收益的比率',
482
+            '订单结算的佣金比率+平台的补贴比率',
483
+            '佣金比率',
484
+            '佣金金额=结算金额*佣金比率',
485
+            '0平台未结算1已结算2失效',
486
+            '平台结算时间',
487
+            '平台可结算日期',
488
+            '公证处IN10是否发起0否1是',
489
+            '详细地址串',
490
+            'PV值',
491
+        ];
492
+        $filename = '淘宝订单导出_' . date('YmdHis') . '_' . rand(10000,99999);
493
+        $_instance = SpreadsheetExcelService::instance_xin();
494
+        $_path = $_instance
495
+            ->createOrActive()
496
+            ->setExcelHeader($header)
497
+            ->setExcelTile('淘宝订单明细', $filename, '生成时间: ' . date('Y-m-d H:i:s'))
498
+            ->setExcelContent($arr)
499
+            ->excelSave($filename, 'xlsx', 'extract');
500
+        $domain = request()->domain();
501
+        return [
502
+            'name' => $filename . '.xlsx',
503
+            'status' => 200,
504
+            'path' => $domain . '/' . $_path
505
+        ];
506
+    }
507
+    public function getHfOrder()
508
+    {
509
+        $where = $this->request->params(['date','order_sn','status','keywords','bill_status']);
510
+        $page = 1;
511
+        $limit = 9999999;
512
+        $temporaryData = $this->repository->GetHfOrder($where,$page,$limit);
513
+        $data = $temporaryData['list'];
514
+        $arr = [];
515
+        foreach ($data as $item) {
516
+            $arr[] = [
517
+                $item['order_huafei_id'],
518
+                $item['uid'],
519
+                $item['mobile'],
520
+                $item['commission'],
521
+                $item['commission_share'],
522
+                $item['order_number'],
523
+                $item['order_sn'],
524
+                $item['amount_price'],
525
+                $item['fanli_price'],
526
+                $item['cost_price'],
527
+                $item['arrived_amount'],
528
+                $item['pay_money'],
529
+                $item['create_time'],
530
+                $item['finish_time'],
531
+                $item['modify_time'],
532
+                $item['status'],
533
+                $item['bill_status'],
534
+                $item['bill_create_time'],
535
+                $item['bill_end_time'],
536
+                $item['gzc'],
537
+                $item['pv'],
538
+                $item['is_independentaccount'],
539
+            ];
540
+        }
541
+        $header = [
542
+            '订单ID',
543
+            '用户ID',
544
+            '充值手机号',
545
+            '佣金',
546
+            '佣金比例',
547
+            '平台订单号',
548
+            '本地订单号',
549
+            '充值金额',
550
+            '返利金额',
551
+            '成本金额',
552
+            '到账金额',
553
+            '实际金额',
554
+            '创建时间',
555
+            '完成时间',
556
+            '更新时间',
557
+            '订单状态',
558
+            '结算状态',
559
+            '平台结算时间',
560
+            '可结算日期',
561
+            '公证处IN10是否发起0否1是',
562
+            'PV值',
563
+            '是否分账0否1是',
564
+        ];
565
+        $filename = '话费订单导出_' . date('YmdHis') . '_' . rand(10000,99999);
566
+        $_instance = SpreadsheetExcelService::instance_xin();
567
+        $_path = $_instance
568
+            ->createOrActive()
569
+            ->setExcelHeader($header)
570
+            ->setExcelTile('话费订单明细', $filename, '生成时间: ' . date('Y-m-d H:i:s'))
571
+            ->setExcelContent($arr)
572
+            ->excelSave($filename, 'xlsx', 'extract');
573
+        $domain = request()->domain();
574
+        return [
575
+            'name' => $filename . '.xlsx',
576
+            'status' => 200,
577
+            'path' => $domain . '/' . $_path
578
+        ];
579
+    }
75 580
 }

+ 40 - 23
app/controller/admin/system/merchant/GzcLogs.php

@@ -14,8 +14,10 @@ use app\common\repositories\merchant\order\OrderGzcRepository;
14 14
 use app\common\repositories\merchant\order\OrderMerchantRepository;
15 15
 use crmeb\basic\BaseController;
16 16
 use app\common\repositories\store\ExcelRepository;
17
+use Nette\Utils\DateTime;
17 18
 use think\App;
18 19
 use think\facade\Db;
20
+use think\facade\Log;
19 21
 
20 22
 class GzcLogs extends BaseController
21 23
 {
@@ -69,7 +71,7 @@ class GzcLogs extends BaseController
69 71
      * created: 2021/3/24 13:56
70 72
      */
71 73
     public function inGzc()
72
-    { 
74
+    {
73 75
         $id = intval($this->request->param('id'));
74 76
         $log = Db::table('rrx_gzc_logs')
75 77
             ->where('id', $id)
@@ -77,16 +79,19 @@ class GzcLogs extends BaseController
77 79
             ->where('success', 0)
78 80
             ->where('pension', '>', 0)
79 81
             ->find();
80
-        
82
+
81 83
         if(!$log){
82
-            return app('json')->fail('请选择未入账的记录', );
84
+            return app('json')->fail('请选择未入账的记录');
83 85
         }
84
-            
86
+
85 87
         $mobile= $log['mobile'];
86 88
         $user_name =  Db::name('user_certification')->where('uid',$log['uid'])->value('user_name');
87 89
         $user_card =  Db::name('user_certification')->where('uid',$log['uid'])->value('user_card');
88 90
         $card_positive = Db::name('user_certification')->where('uid',$log['uid'])->value('card_positive');
89 91
         $card_reverse = Db::name('user_certification')->where('uid',$log['uid'])->value('card_reverse');
92
+        $cardType = Db::name('user_certification')->where('uid',$log['uid'])->value('card_type');
93
+        $gender = Db::name('user_certification')->where('uid',$log['uid'])->value('gender');
94
+        $birthday = Db::name('user_certification')->where('uid',$log['uid'])->value('birthday');
90 95
         if(!$mobile || !$user_name || !$user_card || !$card_positive || !$card_reverse){
91 96
             return app('json')->fail('存在实名数据缺失');
92 97
         }
@@ -97,7 +102,12 @@ class GzcLogs extends BaseController
97 102
         if($register['status'] != 200) return app('json')->fail('入账失败:'.$register['message']);
98 103
         $uid = $register['data']['uid'] ?? 0;
99 104
         if(!$uid) return app('json')->fail('创建或获取用户失败');
100
-        $certification = $OrderGzcRepository->certification($uid, $mobile, $user_name, $user_card, $card_positive, $card_reverse);
105
+        // 兼容港澳台用户认证
106
+        $age = (new DateTime())->diff(
107
+            DateTime::createFromFormat('Ymd', strval($birthday))
108
+        )->y;
109
+        $certification = $OrderGzcRepository->certification($uid, $mobile, $user_name, $user_card, $card_positive, $card_reverse,$cardType,$birthday,$gender,$age);
110
+        Log::info('pcpc认证结果' . json_encode($certification));
101 111
         if($certification['status'] != 200) return app('json')->fail('实名认证失败:'.$certification['message']);
102 112
         $gzc = $OrderGzcRepository->gzc($uid,$log['pension']);
103 113
         if($gzc['status'] != 200) return app('json')->fail('入账失败:'.$gzc['message']);
@@ -106,18 +116,18 @@ class GzcLogs extends BaseController
106 116
         $OrderMerchantRepository = app()->make(OrderMerchantRepository::class);
107 117
         $orderId = $OrderMerchantRepository->getNewOrderId('IN10');
108 118
         Db::table('rrx_gzc_logs')
109
-        ->where('id', $id)
110
-        ->where('gzc', 0)
111
-        ->where('success', 0)
112
-        ->where('pension', '>', 0)
113
-        ->update([
114
-            'gzc' => 1,
115
-            'platform_no' => $orderId,
116
-            'gzc_deposit_no' => $gzc_deposit_no,
117
-            'gzc_confirm_result' => $gzc_confirm_result,
118
-            'success' => 1,
119
-            'update_time' => date('Y-m-d H:i:s')
120
-        ]);
119
+            ->where('id', $id)
120
+            ->where('gzc', 0)
121
+            ->where('success', 0)
122
+            ->where('pension', '>', 0)
123
+            ->update([
124
+                'gzc' => 1,
125
+                'platform_no' => $orderId,
126
+                'gzc_deposit_no' => $gzc_deposit_no,
127
+                'gzc_confirm_result' => $gzc_confirm_result,
128
+                'success' => 1,
129
+                'update_time' => date('Y-m-d H:i:s')
130
+            ]);
121 131
 
122 132
         //发起成功更新记录值
123 133
         $order_id = Db::name('store_order')->where('order_sn', $log['out_trade_no'])->value('order_id');
@@ -125,13 +135,13 @@ class GzcLogs extends BaseController
125 135
             $bill = Db::name('user_bill')->where('link_id', $order_id)->where('commission_type', 5)->where('is_gzc', 'in', [0, 1])->find();
126 136
             if($bill){
127 137
                 Db::name('user_bill')
128
-                ->where('bill_id', $bill['bill_id'])
129
-                ->update([
130
-                    'is_gzc' => 2
131
-                ]);
138
+                    ->where('bill_id', $bill['bill_id'])
139
+                    ->update([
140
+                        'is_gzc' => 2
141
+                    ]);
132 142
             }
133 143
         }
134
-        
144
+
135 145
         return app('json')->success('发起成功', $log);
136 146
     }
137 147
 
@@ -167,6 +177,9 @@ class GzcLogs extends BaseController
167 177
             $user_card =  Db::name('user_certification')->where('uid',$log['uid'])->value('user_card');
168 178
             $card_positive = Db::name('user_certification')->where('uid',$log['uid'])->value('card_positive');
169 179
             $card_reverse = Db::name('user_certification')->where('uid',$log['uid'])->value('card_reverse');
180
+            $cardType = Db::name('user_certification')->where('uid',$log['uid'])->value('card_type');
181
+            $gender = Db::name('user_certification')->where('uid',$log['uid'])->value('gender');
182
+            $birthday = Db::name('user_certification')->where('uid',$log['uid'])->value('birthday');
170 183
             if(!$mobile || !$user_name || !$user_card || !$card_positive || !$card_reverse){
171 184
                 return app('json')->fail('存在实名数据缺失');
172 185
             }
@@ -177,7 +190,11 @@ class GzcLogs extends BaseController
177 190
             if($register['status'] != 200) return app('json')->fail('入账失败:'.$register['message']);
178 191
             $uid = $register['data']['uid'] ?? 0;
179 192
             if(!$uid) return app('json')->fail('创建或获取用户失败');
180
-            $certification = $OrderGzcRepository->certification($uid, $mobile, $user_name, $user_card, $card_positive, $card_reverse);
193
+            // 兼容港澳台用户认证
194
+            $age = (new DateTime())->diff(
195
+                DateTime::createFromFormat('Ymd', strval($birthday))
196
+            )->y;
197
+            $certification = $OrderGzcRepository->certification($uid, $mobile, $user_name, $user_card, $card_positive, $card_reverse,$cardType,$birthday,$gender,$age);
181 198
             if($certification['status'] != 200) return app('json')->fail('实名认证失败:'.$certification['message']);
182 199
             $gzc = $OrderGzcRepository->gzc($uid,$log['pension']);
183 200
             if($gzc['status'] != 200) return app('json')->fail('入账失败:'.$gzc['message']);

+ 15 - 3
app/controller/api/Auth.php

@@ -12,7 +12,9 @@ namespace app\controller\api;
12 12
 
13 13
 use AlibabaCloud\Client\AlibabaCloud;
14 14
 use app\common\dao\store\order\StoreOrderDao;
15
+use app\common\dao\user\UserCertificationDao;
15 16
 use app\common\model\user\User;
17
+use app\common\model\user\UserCertification;
16 18
 use app\common\repositories\merchant\order\OrderGzcRepository;
17 19
 use app\common\repositories\merchant\order\OrderMerchantRepository;
18 20
 use app\common\repositories\store\order\StoreGroupOrderRepository;
@@ -403,7 +405,7 @@ class Auth extends BaseController
403 405
         $type = $this->request->param('type',1);
404 406
 //        $where['mer_id']=$this->merId;
405 407
         $where['type']=$type;
406
-        $data=Db::name('enterprise_agreement')->where($where)->find();
408
+        $data=Db::name('user_agreement')->where($where)->find();
407 409
         if(!$data){
408 410
             $data['title']='';
409 411
             $data['content']='';
@@ -476,6 +478,13 @@ class Auth extends BaseController
476 478
         if (!$useragree){
477 479
             $repository->createUserOperatingRecord($user->uid, 1, 1, '用户同意用户协议记录');
478 480
         }
481
+        // 登录增加是否实名字段
482
+        $userCertificationDao = new UserCertificationDao();
483
+        $isCertification = $userCertificationDao->getUserCertification($account);
484
+        $user['is_ertification'] = 0;
485
+        if (!empty($isCertification)) {
486
+            $user['is_ertification'] = 1;
487
+        }
479 488
         return app('json')->success($repository->returnToken($user, $tokenInfo));
480 489
     }
481 490
 
@@ -1425,7 +1434,7 @@ class Auth extends BaseController
1425 1434
         }
1426 1435
 
1427 1436
         if ($data['type']=="register"){
1428
-            $count=Db::name("user")->where("phone", $data["phone"])->count();
1437
+            $count=Db::name("user")->where("phone", $data["phone"])->where('is_del','=',0)->count();
1429 1438
             if ($count){
1430 1439
                 return app('json')->make(405, '该手机号已注册,请直接登录');
1431 1440
             }
@@ -1441,6 +1450,8 @@ class Auth extends BaseController
1441 1450
         $sms_key = 'api.auth.sms.' . $data['phone'];
1442 1451
         $sms_code = str_pad(random_int(1, 9999), 4, 0, STR_PAD_LEFT);
1443 1452
         $sms_time = systemConfig('sms_time') ? systemConfig('sms_time') : 30 ;
1453
+        // 兼容香港手机号
1454
+        if (strlen($data['phone']) != 11) $data['phone'] = '+852' . $data['phone'];
1444 1455
         $res = app()->make(AliYunSmsService::class)->send($data['phone'],  $sms_code);
1445 1456
         if($res['Code']!='OK'){
1446 1457
             Db::name('log')->insert(['data'=>'幸福保短信发送失败:'.json_encode($res,256)]);
@@ -2094,12 +2105,13 @@ class Auth extends BaseController
2094 2105
                 return app('json')->fail('没有获取到手机号1');
2095 2106
             }
2096 2107
 //            dump($data);
2108
+            Db::name('log')->insert(['data'=>'一键登录获取的数据:' .$data]);
2097 2109
             $data=json_decode($data,true);
2098 2110
             $phone=$data['purePhoneNumber']??'';
2099 2111
             if($phone==''){
2100 2112
                 return app('json')->fail('没有获取到手机号2');
2101 2113
             }
2102
-            if (!preg_match("/^1[3456789]{1}\d{9}$/", $phone)){
2114
+            if (!preg_match("/^1[3456789]{1}\d{9}$/", $phone) && !preg_match("/^[569]\d{7}$/",$phone)){
2103 2115
                 return app('json')->fail('手机号格式错误');
2104 2116
             }
2105 2117
             $user_res=Db::name('user')->where('account',$phone)->find();

+ 7 - 2
app/controller/api/Notify.php

@@ -242,7 +242,7 @@ class Notify
242 242
                                         $this->con_log($spread_data['uid'], $pv, $store_order_data['order_id'], 0, "推广精彩生活商品赠送贡献值");
243 243
                                         //积分
244 244
                                         $this->score_log($spread_data['uid'], bcmul($pv, $rate, 2), $store_order_data['order_id'], 0, "推广精彩生活商品赠送积分");
245
-                                        if($store_order_data['share_uid']){
245
+                                        if($store_order_data['share_uid'] && $store_order_data['share_uid'] != 1123){
246 246
                                             $this->bill_user_log($store_order_data['share_uid'], bcmul($pv * 0.9, 0.03, 2), $store_order_data['order_id'], 20, $store_order_data['order_sn'], '分享获得佣金', $store_order_data['mer_id'], 0);
247 247
                                             $this->fugou_user_log($store_order_data['share_uid'], bcmul($pv * 0.1, 0.03, 2), $store_order_data['order_id'], 1);
248 248
                                         }
@@ -261,7 +261,7 @@ class Notify
261 261
                                         $this->bill_user_log($spread_data['uid'], $yj_amount_90, $store_order_data['order_id'], 3, $store_order_data['order_sn'], '推广获得佣金', $store_order_data['mer_id'], 0);
262 262
                                         //养老金
263 263
                                         $this->bill_user_log($spread_data['uid'], bcmul($pv, 0.05, 2), $store_order_data['order_id'], 5, $store_order_data['order_sn'], '推广获得养老金' . bcmul($pv, 0.05, 2), $store_order_data['mer_id'], 0);
264
-                                        if($store_order_data['share_uid']){
264
+                                        if($store_order_data['share_uid'] && $store_order_data['share_uid'] != 1123){
265 265
                                             $this->bill_user_log($store_order_data['share_uid'], bcmul($pv * 0.9, 0.03, 2), $store_order_data['order_id'], 20, $store_order_data['order_sn'], '分享获得佣金', $store_order_data['mer_id'], 0);
266 266
                                             $this->fugou_user_log($store_order_data['share_uid'], bcmul($pv * 0.1, 0.03, 2), $store_order_data['order_id'], 1);
267 267
                                         }
@@ -333,6 +333,11 @@ class Notify
333 333
                                     $gx_jf = 1400;
334 334
                                     $yj1 = 200;
335 335
                                     $le_yw_amount = 600;
336
+                                }else if($store_product_data['price'] == 5900){
337
+                                    $pv = 5000;
338
+                                    $gx_jf = 3500;
339
+                                    $yj1 = 500;
340
+                                    $le_yw_amount = 1500;
336 341
                                 }
337 342
 
338 343
                                 $ylj_pri = bcmul($pv, 0.035,2);

+ 4 - 1
app/controller/api/store/merchant/TaskPartnerProfits.php

@@ -708,7 +708,7 @@ class TaskPartnerProfits
708 708
             ->where('mer_id', 496)
709 709
             ->whereIn('uid', $userIdList)
710 710
             ->whereIn('status', [0, 1, 2, 3]) // TODO 之前橙汁先生 这么定义的,感觉有问题,也就是现在 会员专区 下单 不允许退款,不然肯定有问题 注意调整
711
-            ->whereIn("total_price", [1180, 11800, 10620, 2360, 9440])
711
+            ->whereIn("total_price", [1180, 11800, 10620, 2360, 9440, 5900])
712 712
             ->whereNotNull("pay_time") // 排除 pay_time 为 NULL 的订单
713 713
             ->select();
714 714
 
@@ -731,6 +731,9 @@ class TaskPartnerProfits
731 731
                 case 9440:
732 732
                     $totalPv += 5600;
733 733
                     break;
734
+                case 5900:
735
+                    $totalPv += 3500;
736
+                    break;
734 737
             }
735 738
         }
736 739
         return $totalPv;

+ 0 - 214
app/controller/api/store/merchant/TaskZeroLineOrderLianc.php

@@ -13,220 +13,6 @@ use think\Request;
13 13
 class TaskZeroLineOrderLianc
14 14
 {
15 15
 
16
-    /**
17
-     * 会员升级
18
-     */
19
-    public function member_update($orderInfo, $goods_of_info, $user_id)
20
-    {
21
-        //
22
-        //$user_id = $userInfo['id'];
23
-        $order_id = $orderInfo['id'];
24
-
25
-        //code...
26
-        $pay_gb = round($orderInfo['num'] * $orderInfo['gb_num'], 2);
27
-        //$pay_vr =  round($orderInfo['num'] * $orderInfo['vr_num'],2);
28
-        //付款按照700的VR付款 start
29
-        $vr_num = 0;
30
-        if ($orderInfo['price'] == 1180) {
31
-            $vr_num = 700;
32
-        } elseif ($orderInfo['price'] == 11800) {
33
-            $vr_num = 7000;
34
-        } elseif ($orderInfo['price'] == 11800) {
35
-            $vr_num = 2100;
36
-        } elseif ($orderInfo['price'] == 10620) {
37
-            $vr_num = 6300;
38
-        }
39
-
40
-
41
-        $pay_gb1 = $vr_num;
42
-        $pay_vr1 = $orderInfo['price'];//记录VR值
43
-
44
-
45
-        // $result = Db::name("old_user_jbp")->where("id",$user_id)->dec("vr",$orderInfo['price'])->save();//1.0jbp旧表
46
-        // Db::name("user")->where("uid",$user_id)->dec("vr",$orderInfo['price'])->save();//2.0新表
47
-
48
-
49
-        $result = true;
50
-        if ($result) {
51
-            $invite_id = $goods_of_info['spread_id'];
52
-
53
-
54
-            $zs_ylj = 0; //养老金赋值
55
-
56
-
57
-            if ($goods_of_info['money'] == 1180) {
58
-                //修改订单到账状态
59
-                $zs_ylj = round(700 * 0.05, 2);//计算的养老金 金额
60
-            } elseif ($goods_of_info['money'] == 11800) {
61
-                $zs_ylj = round(7000 * 0.05, 2);//计算的养老金 金额
62
-            } elseif ($goods_of_info['money'] == 3540) {
63
-                $zs_ylj = round(2100 * 0.05, 2);//计算的养老金 金额
64
-            } elseif ($goods_of_info['money'] == 10620) {
65
-                $zs_ylj = round(6300 * 0.05, 2);//计算的养老金 金额
66
-            } elseif ($goods_of_info['money'] == 9440) {
67
-                $zs_ylj = round(5600 * 0.05, 2);//八单计算的养老金 金额
68
-            } elseif ($goods_of_info['money'] == 2360) {
69
-                $zs_ylj = round(1400 * 0.05, 2);//两单计算的养老金 金额
70
-            }
71
-
72
-
73
-            $uid = $user_id;
74
-            $new_user_id = $uid;
75
-            if (empty($new_user_id)) {
76
-                abort(0, "当前绑定会员查询错误");
77
-            }
78
-
79
-            $new_nums = Db::name("old_user_of_goods")->where("user_id", $uid)->sum("money");
80
-
81
-            //增加过后权益对比 获取当前权益等级
82
-            $old_level_id = Db::name("old_user_jbp")->where("id", $uid)->find();
83
-
84
-            $old_level_info = Db::name("old_user_level")->where("id", $old_level_id['user_level_id'])->find();
85
-
86
-
87
-            $level_info = [];
88
-            $level_list = Db::name("old_user_level")->order("money desc")->select();
89
-
90
-
91
-            //计算会员等级 升级
92
-            foreach ($level_list as $key => $value) {
93
-                # code...
94
-                if ($new_nums >= $value['money']) {
95
-                    $level_info = $value;
96
-                    break;
97
-                }
98
-            }
99
-
100
-            $zs_gb = $orderInfo['price'] * 3;
101
-            $zs_withdraw_quota = $orderInfo['price'];
102
-
103
-
104
-            if ($old_level_info['id'] == $level_info['id']) {
105
-                //未到达升级权益 不改变用户等级
106
-                $update_status = false;
107
-            } else {
108
-                $update_status = true;
109
-                $user_level = $level_info['id'];
110
-                //var_dump( $user_level);
111
-                Db::name("old_user_jbp")->where("id", $new_user_id)->save(['user_level_id' => $user_level]);//1.0jbp旧表
112
-                Db::name("user")->where("uid", $new_user_id)->save(['user_level_id_old' => $user_level]);//2.0新表
113
-
114
-                // todo 同时改变他的权益
115
-            }
116
-
117
-
118
-            // Db::name("old_user_jbp")->where("id",$new_user_id)->inc("withdraw_quota",$zs_withdraw_quota)->save();//1.0jbp旧表
119
-            // Db::name("user")->where("uid",$new_user_id)->save(['withdraw_quota_old'=>$zs_withdraw_quota]);//2.0新表
120
-
121
-            // 下发邀请人赠送的GB
122
-            // $zs_invite_gb = round($orderInfo['price']*0.3,2);
123
-            // //todo
124
-            // Db::name("old_user_jbp")->where("id",$invite_id)->inc("gb",$zs_invite_gb)->save();//1.0jbp旧表
125
-            // Db::name("user")->where("uid",$invite_id)->inc("score",$zs_invite_gb)->save();//2.0新表
126
-
127
-            //$old_have_pension = Db::name("old_user_jbp")->where("id",$invite_id)->value("have_pension");
128
-
129
-
130
-            //检查是不是订单价格是1180或者11800,更改VR
131
-            if ($goods_of_info['money'] == 1180 || $goods_of_info['money'] == 11800 || $goods_of_info['money'] == 3540 || $goods_of_info['money'] == 10620 || $goods_of_info['money'] == 9440 || $goods_of_info['money'] == 2360) {
132
-                //修改订单到账状态
133
-
134
-
135
-                Db::name("old_user_of_goods")->where("order_id", $goods_of_info1['id'])->save(['status' => 1, 'pay_gb' => 0, 'pay_vr' => $pay_vr1, 'pay_bt' => 0, 'create_time' => time()]);
136
-
137
-
138
-            }
139
-        }
140
-
141
-
142
-        if ($result) {
143
-            //更改订单状态
144
-
145
-            Db::commit();
146
-            $new_user_name = Db::name("old_user_jbp")->where("id", $new_user_id)->value("user_name");
147
-            $new_user_name = empty($new_user_name) ? "" : $new_user_name;
148
-
149
-            //记录日志信息
150
-
151
-            if ($user_id == $invite_id) {
152
-                //报单中心=推荐人 GB记录日志有问题需要传入指定参数去计算
153
-                //$money = Db::name("old_user_jbp")->where("id",$user_id)->value("gb");
154
-                //$appoint_money = $money - $zs_invite_gb;
155
-
156
-                if ($goods_of_info['money'] == 1180 || $goods_of_info['money'] == 11800 || $goods_of_info['money'] == 3540 || $goods_of_info['money'] == 10620 || $goods_of_info['money'] == 9440 || $goods_of_info['money'] == 2360) {
157
-
158
-
159
-                    $this->change_user_log66($user_id, "vr", 2, $pay_vr1, "declare_expend", '权益消费VR-' . $new_user_name);
160
-
161
-                }
162
-            } else {
163
-
164
-                if ($goods_of_info['money'] == 1180 || $goods_of_info['money'] == 11800 || $goods_of_info['money'] == 3540 || $goods_of_info['money'] == 10620 || $goods_of_info['money'] == 9440 || $goods_of_info['money'] == 2360) {
165
-
166
-
167
-                    $this->change_user_log66($user_id, "vr", 2, $pay_vr1, "declare_expend", '权益消费VR-' . $new_user_name);
168
-
169
-                }
170
-            }
171
-            // $this->change_user_log66($new_user_id,'gb',1,$zs_gb,"levle_update_zs","权益升级达标赠送");
172
-            $this->change_user_log66($new_user_id, 'withdraw_quota_old', 1, $zs_withdraw_quota, "levle_update_zs", "权益升级达标赠送");
173
-            // $this->change_user_log66($invite_id,'gb',1,$zs_invite_gb,"levle_update_zs","邀请-".$new_user_name);
174
-            // echo 123;return;
175
-            //处理查看是否有待发放佣金
176
-            // $zs_withdraw_quota
177
-            Db::name("old_user_jbp")->where("id", $new_user_id)->inc("total_withdraw_quota", $zs_withdraw_quota)->save();//1.0jbp旧表
178
-            Db::name("user")->where("uid", $new_user_id)->inc("total_withdraw_quota_old", $zs_withdraw_quota)->save();
179
-            // $this->releaseTobeAmount($new_user_id,$zs_withdraw_quota);
180
-            // $this->success("支付成功",['is_cash'=>0]);
181
-        }
182
-        Db::rollback();
183
-        // $this->error("操作失败");
184
-    }
185
-
186
-    function change_user_log66($user_id, $type, $change_status, $money, $routine, $remark = "", $is_admin = 1, $appoint_money = 0)
187
-    {
188
-        $transition = [
189
-            'pv' => 1,
190
-            "gb" => 2,
191
-            "df" => 3,
192
-            "vr" => 4,
193
-            "bt" => 5,
194
-            "withdraw_quota_old" => 6,
195
-            "unsettled_pension" => 7,
196
-            "amount_old" => 8
197
-        ];
198
-        $routineInfo = Db::name("old_routine_log_of_key")->where("key", $routine)->find();
199
-        if (empty($routineInfo)) {
200
-            return false;
201
-        }
202
-        $key_id = isset($routineInfo['id']) ? $routineInfo['id'] : 0;
203
-        //再去查询变更前的 金额
204
-        if ($appoint_money > 0) {
205
-            $alter_money = $appoint_money;
206
-        } else {
207
-            //再去查询变更前的 金额
208
-            $alter_money = Db::name("user")->where('uid', $user_id)->value($type);
209
-        }
210
-        if ($change_status == 1) {
211
-            //新增前
212
-            $alter_money = $alter_money - $money;
213
-        } else if ($change_status == 2) {
214
-            //减少前
215
-            $alter_money = $alter_money + $money;
216
-        }
217
-        $inser_data = [];
218
-        $inser_data['user_id'] = $user_id;
219
-        $inser_data['type'] = $transition[$type];
220
-        $inser_data['change_status'] = $change_status;
221
-        $inser_data['money'] = $money;
222
-        $inser_data['routine_log_of_key_id'] = $key_id;
223
-        $inser_data['remark'] = $remark;
224
-        $inser_data['is_admin'] = $is_admin;
225
-        $inser_data['create_time'] = time();
226
-        $inser_data['alter_money'] = isset($alter_money) ? $alter_money : 0;
227
-        Db::name("old_user_log")->insert($inser_data);
228
-    }
229
-
230 16
     //添加推广佣金/养老金日志(养老金金额)
231 17
     public function bill_user_log($uid, $name, $num, $mark)
232 18
     {

+ 40 - 62
app/controller/api/store/merchant/Taskorderguquan.php

@@ -19,69 +19,47 @@ class Taskorderguquan
19 19
 
20 20
         /**
21 21
         补贴下面人员
22
-        13231658486周行体600
23
-        13333069689魏   新600
24
-        13959100621周金花300
25
-        13701061395李素红300
26
-        17501006833邢艳丽300
27
-        15631982690魏震洪200
28
-        18603401312黄金花200
29
-        13521438652徐立苹300
30
-        15832971815孟晓玮300
31
-        18600200909陈冠霖300
32
-        15810064711 王   玲 300
33
-        13932925303会强200
34
-        13901074090陈玉刚300
35
-        13381085923王建军50
36
-        13601071082隋彩云200
37
-        18001316701闫旭200
38
-        13601179856陈瑞元50
39
-        13161909228刘银霞50
40
-        18760167163刘春梅50
41
-        13215917919李小秋50
42
-        13801358713金波50
43
-        15321221558李伟 200
44
-        15332507711张传莲50
45
-        15960349667吕丽娣50
46
-        13231658486周军市场补贴600
47
-        18513005403王培50
48
-        18612051372李金俭 50
49
-        15803242611王志敏50
50
-        13701059062王金权50
51
-        13331043787张吉良115
52
-        18715313601大饼300
53
-        */
22
+        13231658486周行体200
23
+        13333069689魏   新200
24
+        13959100621周金花100
25
+        13701061395李素红100
26
+        17501006833邢艳丽50
27
+        15631982690魏震洪50
28
+        18603401312黄金花50
29
+        13521438652徐立苹100
30
+        15832971815孟晓玮100
31
+        15810064711 王   玲 100
32
+        13932925303会强50
33
+        13601071082隋彩云100
34
+        13601179856陈瑞元20
35
+        13161909228刘银霞20
36
+        18760167163刘春梅20
37
+        13215917919李小秋20
38
+        15532683963李玉芝20
39
+        13231658486周军市场补贴300
40
+        13331043787张吉良55
41
+        18715313601大饼100
42
+         */
54 43
         $data = [
55
-            '13231658486' => 1200,
56
-            '13333069689' => 600,
57
-            '13959100621' => 300,
58
-            '13701061395' => 300,
59
-            '17501006833' => 300,
60
-            '15631982690' => 200,
61
-            '18603401312' => 200,
62
-            '13521438652' => 300,
63
-            '15832971815' => 300,
64
-            '18600200909' => 300,
65
-            '15810064711' => 300,
66
-            '13932925303' => 200,
67
-            '13901074090' => 300,
68
-            '13381085923' => 50,
69
-            '13601071082' => 200,
70
-            '18001316701' => 200,
71
-            '13601179856' => 50,
72
-            '13161909228' => 50,
73
-            '18760167163' => 50,
74
-            '13215917919' => 50,
75
-            '13801358713' => 50,
76
-            '15321221558' => 200,
77
-            '15332507711' => 50,
78
-            '15960349667' => 50,
79
-            '18513005403' => 50,
80
-            '18612051372' => 50,
81
-            '15803242611' => 50,
82
-            '13701059062' => 50,
83
-            '13331043787' => 115,
84
-            '18715313601' => 300
44
+            '13231658486' => 500,
45
+            '13333069689' => 200,
46
+            '13959100621' => 100,
47
+            '13701061395' => 100,
48
+            '17501006833' => 50,
49
+            '15631982690' => 50,
50
+            '18603401312' => 50,
51
+            '13521438652' => 100,
52
+            '15832971815' => 100,
53
+            '15810064711' => 100,
54
+            '13932925303' => 50,
55
+            '13601071082' => 100,
56
+            '13601179856' => 20,
57
+            '13161909228' => 20,
58
+            '18760167163' => 20,
59
+            '13215917919' => 20,
60
+            '15532683963' => 20,
61
+            '13331043787' => 55,
62
+            '18715313601' => 100
85 63
         ];
86 64
 
87 65
         $result = Db::name("user")

+ 10 - 6
app/controller/api/store/order/StoreOrder.php

@@ -951,7 +951,6 @@ class StoreOrder extends BaseController
951 951
         ], $page, $limit));
952 952
     }
953 953
 
954
-
955 954
     /**
956 955
      * @param $id
957 956
      * @return mixed
@@ -960,14 +959,19 @@ class StoreOrder extends BaseController
960 959
      */
961 960
     public function detail($id)
962 961
     {
963
-        $order = $this->repository->getDetail((int)$id);
962
+        $order = $this->repository->getDetail($id);
964 963
 //        $order = $this->repository->getDetail((int)$id, $this->request->uid());
965 964
         if (!$order)
966 965
             return app('json')->fail('订单不存在');
967
-        if ($order->order_type == 1) {
968
-            $order->append(['take']);
969
-        }
970
-        return app('json')->success($order->toArray());
966
+//        if ($order->order_type == 1) {
967
+//            $order->append(['take']);
968
+//        }
969
+        return app('json')->success($order);
970
+//        $query = Db::name('store_order')
971
+//            ->where('order_sn', $id)
972
+//            ->select()
973
+//            ->toArray();
974
+//        return app('json')->success($query, '获取成功');
971 975
     }
972 976
 
973 977
     /**

파일 크기가 너무 크기때문에 변경 상태를 표시하지 않습니다.
+ 0 - 2298
app/controller/api/store/order/StoreOrderCopy.php


+ 7 - 7
app/controller/api/store/product/Other.php

@@ -395,7 +395,7 @@ class Other extends BaseController
395 395
         switch ($params['type']) {
396 396
             case 1://多多进宝
397 397
                 $list = Db::name('user_bill')
398
-                    ->field('number,order_sn,status')
398
+                    ->field('number,order_sn,status,bill_id,commission_type')
399 399
                     ->where('uid', $userId)
400 400
                     ->where('commission_type',5)
401 401
                     ->where('type_shop',1)
@@ -431,7 +431,7 @@ class Other extends BaseController
431 431
                 break;
432 432
             case 2://唯品会(没有商品价格)
433 433
                 $list = Db::name('user_bill')
434
-                    ->field('number,order_sn,status')
434
+                    ->field('number,order_sn,status,bill_id,commission_type')
435 435
                     ->where('uid', $userId)
436 436
                     ->where('commission_type',5)
437 437
                     ->where('type_shop',2)
@@ -466,7 +466,7 @@ class Other extends BaseController
466 466
                 break;
467 467
             case 3://苏宁订单列表
468 468
                 $list = Db::name('user_bill')
469
-                    ->field('number,order_sn,status')
469
+                    ->field('number,order_sn,status,bill_id,commission_type')
470 470
                     ->where('uid', $userId)
471 471
                     ->where('commission_type',5)
472 472
                     ->where('type_shop',3)
@@ -497,7 +497,7 @@ class Other extends BaseController
497 497
                 break;
498 498
             case 5://淘宝客
499 499
                 $list = Db::name('user_bill')
500
-                    ->field('number,order_sn,status')
500
+                    ->field('number,order_sn,status,bill_id,commission_type')
501 501
                     ->where('uid', $userId)
502 502
                     ->where('commission_type',5)
503 503
                     ->where('type_shop',5)
@@ -531,7 +531,7 @@ class Other extends BaseController
531 531
                 break;
532 532
             case 6://京东订单
533 533
                 $list = Db::name('user_bill')
534
-                    ->field('number,order_sn,status')
534
+                    ->field('number,order_sn,status,bill_id,commission_type')
535 535
                     ->where('uid', $userId)
536 536
                     ->where('commission_type',5)
537 537
                     ->where('type_shop',6)
@@ -563,7 +563,7 @@ class Other extends BaseController
563 563
                 break;
564 564
             case 9: //抖音
565 565
                 $list = Db::name('user_bill')
566
-                    ->field('number,order_sn,status')
566
+                    ->field('number,order_sn,status,bill_id,commission_type')
567 567
                     ->where('uid', $userId)
568 568
                     ->where('commission_type',5)
569 569
 //                    ->where('type_shop',9)
@@ -596,7 +596,7 @@ class Other extends BaseController
596 596
                 break;
597 597
             case 10: //话费
598 598
                 $list = Db::name('user_bill')
599
-                    ->field('number,order_sn,status')
599
+                    ->field('number,order_sn,status,bill_id,commission_type')
600 600
                     ->where('uid', $userId)
601 601
                     ->where('commission_type',5)
602 602
                     ->where('type_shop',9)

+ 95 - 17
app/controller/api/user/User.php

@@ -44,6 +44,7 @@ use app\common\common;
44 44
 use phpseclib3\Math\BigInteger\Engines\BCMath;
45 45
 
46 46
 class User extends BaseController
47
+// class User
47 48
 {
48 49
     use HuiPay;
49 50
 
@@ -56,6 +57,17 @@ class User extends BaseController
56 57
         -1 => '失效'
57 58
     ];
58 59
 
60
+    // private $request;
61
+    //
62
+    // public function __construct(App $app, UserRepository $repository)
63
+    // {
64
+    //     $this->request = $app->request;
65
+    //     // parent::__construct($app);
66
+    //     $this->repository = $repository;
67
+    //     $this->source = $this->request->header('source');
68
+    //     $this->merId = $this->request->header('merId');
69
+    // }
70
+
59 71
     public function __construct(App $app, UserRepository $repository)
60 72
     {
61 73
         parent::__construct($app);
@@ -927,6 +939,7 @@ class User extends BaseController
927 939
     {
928 940
         $member_id = $this->request->uid();
929 941
         $type = input("type", 0);
942
+        $cardType = input('card_type',1);
930 943
         if ($type == 1) {
931 944
             $data = $this->repository->get_cer(["uid" => $member_id]);
932 945
             return app('json')->success($data);
@@ -942,19 +955,47 @@ class User extends BaseController
942 955
         $params['create_time'] = time();
943 956
         $params['uid'] = $member_id;
944 957
         $baidu = new Ocr();
945
-        $image = file_get_contents($params['card_positive']);
946
-        $idCardSide = "front";
947
-        $result = $baidu->idcard($image, $idCardSide);
948
-        $real_user_name = $result['words_result']['姓名']['words'] ?? '';
949
-        $real_user_card = $result['words_result']['公民身份号码']['words'] ?? '';
950
-        if ($real_user_name != $params['user_name']) {
951
-            return app('json')->fail('姓名或身份证号输入有误~');
952
-        }
953
-        if ($real_user_card != $params['user_card']) {
954
-            return app('json')->fail('姓名或身份证号输入有误~');
955
-        }
956
-        if ($result['image_status'] == "normal" && $result['idcard_number_type'] == 1) {
958
+        // 兼容港澳台证件
959
+        if ($cardType != 1) {
960
+            // 设置exitentrypermit_type
961
+            $exType = '';
962
+            if ($cardType == 2) {
963
+                $exType = 'hk_mc_return_passport_front'; //返乡证
964
+            }
965
+            if ($cardType == 3) {
966
+                $exType = 'tw_return_passport_front'; // 台胞证
967
+            }
968
+
969
+            if (empty($exType)) {
970
+                return app('json')->fail('证件号类型错误~');
971
+            }
972
+
973
+            $postData['url'] = $params['card_positive'];
974
+            $postData['exitentrypermit_type'] = $exType;
975
+            $result = $baidu->hkMacauTaiwan($postData);
976
+            Log::info('hkMacauTaiwan:' . json_encode($result));
977
+            $real_user_name = $result['words_result']['name_chn'][0]['word']??'';
978
+            $real_user_card = $result['words_result']['card_number'][0]['word']??'';
979
+            if ($real_user_name != $params['user_name']) {
980
+                return app('json')->fail('姓名或身份证号输入有误~');
981
+            }
982
+            if ($real_user_card != $params['user_card']) {
983
+                return app('json')->fail('姓名或身份证号输入有误~');
984
+            }
985
+
986
+            $params['reason'] = '';
987
+            $params['audit_time'] = 0;
988
+            $params['update_time'] = 0;
957 989
             $params['status'] = 1;
990
+            $params['card_type'] = $cardType;
991
+            if ($result['words_result']['sex'][0]['word'] == '男') {
992
+                $gender = 1;
993
+            }else{
994
+                $gender = 2;
995
+            }
996
+            $params['gender'] = $gender;
997
+            $birthday = $result['words_result']['birthday'][0]['word']??'';
998
+            $params['birthday'] = str_replace('.','',$birthday);
958 999
             $res = $this->repository->add_cer($params, $member_id);
959 1000
             if ($res) {
960 1001
                 $userRepository = app()->make(UserRepository::class);
@@ -973,8 +1014,43 @@ class User extends BaseController
973 1014
             } else {
974 1015
                 return app('json')->fail('认证失败');
975 1016
             }
976
-        } else {
977
-            return app('json')->fail('认证失败,请重新认证');
1017
+        }else{
1018
+            $image = file_get_contents($params['card_positive']);
1019
+            $idCardSide = "front";
1020
+            $result = $baidu->idcard($image, $idCardSide);
1021
+            Log::info('hkMacauTaiwan:' . json_encode($result));
1022
+            $real_user_name = $result['words_result']['姓名']['words'] ?? '';
1023
+            $real_user_card = $result['words_result']['公民身份号码']['words'] ?? '';
1024
+            if ($real_user_name != $params['user_name']) {
1025
+                return app('json')->fail('姓名或身份证号输入有误~');
1026
+            }
1027
+            if ($real_user_card != $params['user_card']) {
1028
+                return app('json')->fail('姓名或身份证号输入有误~');
1029
+            }
1030
+            if ($result['image_status'] == "normal" && $result['idcard_number_type'] == 1) {
1031
+                $params['status'] = 1;
1032
+                $params['card_type'] = $cardType;
1033
+                $res = $this->repository->add_cer($params, $member_id);
1034
+                if ($res) {
1035
+                    $userRepository = app()->make(UserRepository::class);
1036
+                    // 赠送积分 完善实名送90个积分,同时送邀请人50个积分
1037
+                    $userRepository->sign_add($member_id, 90,1,'完善实名系统赠送90个积分','','', '', 1, '', 1);
1038
+                    $member_info = Db::name('user')->where( array('uid' => $member_id) )->find();
1039
+                    Db::name('user')
1040
+                        ->where('uid', $member_id)
1041
+                        ->update(['real_name' => $params['user_name'], 'nickname' => $params['user_name']]);
1042
+                    if($member_info['spread_uid']){
1043
+                        // 好友完善实名系统赠送50个积分
1044
+                        $spreadUid = $member_info['spread_uid'];
1045
+                        $userRepository->sign_add($spreadUid, 50,1,'好友完善实名系统赠送50个积分','','', '', 1, '', 1);
1046
+                    }
1047
+                    return app('json')->success($res);
1048
+                } else {
1049
+                    return app('json')->fail('认证失败');
1050
+                }
1051
+            } else {
1052
+                return app('json')->fail('认证失败,请重新认证');
1053
+            }
978 1054
         }
979 1055
 
980 1056
     }
@@ -3298,10 +3374,12 @@ class User extends BaseController
3298 3374
     public function getAmountFromGzc()
3299 3375
     {
3300 3376
         $uid = $this->request->uid();
3301
-        $userInfo = Db::name('UserCertification')->where('uid', $uid)->field('user_name,user_card')->find();
3377
+        $userInfo = Db::name('UserCertification')->where('uid', $uid)->field('user_name,user_card,card_type')->find();
3302 3378
         $res = GzcApiRequest::checkAmount($userInfo);
3303
-
3304
-        return app('json')->success(['amount' => sprintf("%01.2f", $res['extendData']['amount'] * 0.01)]);
3379
+        if(is_string($res)) {
3380
+            return app('json')->fail($res);
3381
+        }
3382
+        return app('json')->success(['amount' => sprintf("%01.2f", $res * 0.01)]);
3305 3383
     }
3306 3384
 
3307 3385
     public function check_user_annual_fee()

+ 72 - 10
app/traits/GzcApiRequest.php

@@ -18,7 +18,7 @@ trait GzcApiRequest
18 18
      * @author php迷途小书童
19 19
      * @created 2021/1/14 14:34
20 20
      */
21
-    public static function request(string $method, string $url, array $params = [], array $options = [])
21
+    public static function request(string $method, string $url, array $params = [], array $options = [], $type = 1)
22 22
     {
23 23
         $base_uri = env('GZC.HOSTNAME');
24 24
         $request_uri = $base_uri.$url;
@@ -29,7 +29,7 @@ trait GzcApiRequest
29 29
                 "Accept:application/json"
30 30
             );
31 31
             if ($url != '/v1/api/third/auth/token') {
32
-                $Token = self::getTokenFromServer();
32
+                $Token = self::getTokenFromServer($type);
33 33
                 $accessToken = $Token['extendData']['accessToken'];
34 34
                 array_push($headerArray, "token:".$accessToken);
35 35
             }
@@ -56,14 +56,68 @@ trait GzcApiRequest
56 56
      */
57 57
     public static function checkAmount($user)
58 58
     {
59
-        $data = [
59
+        $cardType = $user['card_type'] ? $user['card_type'] : 10;
60
+        $cxbData = [
60 61
             'platformNo' => env('GZC.PLATFORM_NO'),
61 62
             'appNo' => env('GZC.APP_NO'),
62 63
             'conName' => $user['user_name'],
63
-            'conCertType' => 1,
64
+            'conCertType' => $cardType,
65
+            'conCertNo' => $user['user_card'],
66
+        ];
67
+        Log::info('储蓄保养老金请求参数:' . json_encode($cxbData));
68
+        $cxbResponseData = self::request('POST', '/v1/api/third/in/in30', $cxbData, [], 1);
69
+        Log::info('储蓄保养老金请求返回:' . json_encode($cxbResponseData));
70
+        if($cxbResponseData['code'] != 0) {
71
+            return $cxbResponseData['message'];
72
+        }
73
+
74
+        $xfbData = [
75
+            'platformNo' => env('XINGFUBAO.PLATFORM_NO'),
76
+            'appNo' => env('XINGFUBAO.APP_NO'),
77
+            'conName' => $user['user_name'],
78
+            'conCertType' => $cardType,
64 79
             'conCertNo' => $user['user_card'],
65 80
         ];
66
-        return self::request('POST', '/v1/api/third/in/in30', $data);
81
+        Log::info('幸福保养老金请求参数:' . json_encode($xfbData));
82
+        $xfbResponseData = self::request('POST', '/v1/api/third/in/in30', $xfbData, [], 2);
83
+        Log::info('幸福保养老金请求返回:' . json_encode($xfbResponseData));
84
+        if($xfbResponseData['code'] != 0) {
85
+            return $xfbResponseData['message'];
86
+        }
87
+
88
+        $amount = $cxbResponseData['extendData']['amount'] + $xfbResponseData['extendData']['amount'];
89
+        return $amount;
90
+    }
91
+    public function getAmountFromGzc()
92
+    {
93
+        $uid = $this->request->uid();
94
+        $userInfo = Db::name('UserCertification')->where('uid', $uid)->field('user_name,user_card')->find();
95
+
96
+        if (empty($userInfo['user_name']) || empty($userInfo['user_card'])) {
97
+            Log::error('[getAmountFromGzc] 用户实名信息缺失', ['uid' => $uid, 'userInfo' => $userInfo]);
98
+            return app('json')->fail('未找到用户实名信息');
99
+        }
100
+
101
+        try {
102
+            $res = GzcApiRequest::checkAmount($userInfo);
103
+        } catch (\Throwable $e) {
104
+            Log::error('[getAmountFromGzc] 调用异常', ['uid' => $uid, 'error' => $e->getMessage()]);
105
+            return app('json')->fail('查询失败(第三方异常)');
106
+        }
107
+
108
+        // 提取 amount(兼容多种字段位置)
109
+        $amountCents = $res['extendData']['amount'] ?? $res['data']['amount'] ?? $res['amount'] ?? null;
110
+        $amount = $amountCents === null ? 0.0 : floatval($amountCents) * 0.01;
111
+        $formatted = sprintf('%.2f', $amount);
112
+
113
+        // 从 checkAmount 返回的 debug(若存在)
114
+        $debug = $res['debug'] ?? null;
115
+
116
+        // 返回 amount 与 debug 给调用方(前端 / 调试)
117
+        return app('json')->success([
118
+            'amount' => $formatted,
119
+            'debug'  => $debug
120
+        ]);
67 121
     }
68 122
     /**
69 123
      * 获取TOKEN
@@ -71,13 +125,17 @@ trait GzcApiRequest
71 125
      * @author php迷途小书童
72 126
      * @created 2021/1/14 14:38
73 127
      */
74
-    public static function getTokenFromServer()
128
+    public static function getTokenFromServer($type = 1)
75 129
     {
76 130
         $timestamp = (int)(microtime(true) * 1000);
77
-        $appid = env('GZC.APP_ID');
131
+        if ($type == 1) {
132
+            $appid = env('GZC.APP_ID');
133
+        }else{
134
+            $appid = env('XINGFUBAO.APP_ID');
135
+        }
78 136
         $data = [
79 137
             'appid' => $appid,
80
-            'sign' => self::getSignContent($timestamp, $appid),
138
+            'sign' => self::getSignContent($timestamp, $appid, $type),
81 139
             'timestamp' => $timestamp
82 140
         ];
83 141
         return self::request('POST', '/v1/api/third/auth/token', $data);
@@ -88,8 +146,12 @@ trait GzcApiRequest
88 146
      * @author php迷途小书童
89 147
      * @created 2020/10/29 9:35
90 148
      */
91
-    public static function getSignContent(int $timestamp, string $appid) {
92
-        $appsecret = md5(env('GZC.APP_SECRET'));
149
+    public static function getSignContent(int $timestamp, string $appid, $type = 1) {
150
+        if ($type == 1) {
151
+            $appsecret = md5(env('GZC.APP_SECRET'));
152
+        }else{
153
+            $appsecret = md5(env('XINGFUBAO.APP_SECRET'));
154
+        }
93 155
         $stringToBeSigned = "appid={$appid}&secret={$appsecret}&timestamp={$timestamp}";
94 156
         return md5($stringToBeSigned);
95 157
     }

+ 1 - 1
extend/BaiduAi/controller/Ocr.php

@@ -23,7 +23,7 @@ class Ocr
23 23
 
24 24
     public function __construct()
25 25
     {
26
-        $this->client = new \AipOcr('24267127', 'Utg2bxLY4is7h5DPehVZ63Q4', 'yfGMEAO6YQXIE2pqYMiH4MNBE1DcNhyO ');
26
+        $this->client = new \AipOcr('24267127', 'Utg2bxLY4is7h5DPehVZ63Q4', 'yfGMEAO6YQXIE2pqYMiH4MNBE1DcNhyO');
27 27
     }
28 28
 
29 29
     public function setConnectionTimeoutInMillis($ms)

+ 13 - 0
extend/BaiduAi/sdk/AipOcr.php

@@ -61,6 +61,8 @@ class AipOcr extends AipBase {
61 61
      */
62 62
     private $idcardUrl = 'https://aip.baidubce.com/rest/2.0/ocr/v1/idcard';
63 63
 
64
+    private $hkMacauTaiwanUrl = 'https://aip.baidubce.com/rest/2.0/ocr/v1/hk_macau_taiwan_exitentrypermit';
65
+
64 66
     /**
65 67
      * 银行卡识别 bankcard api url
66 68
      * @var string
@@ -368,6 +370,17 @@ class AipOcr extends AipBase {
368 370
         return $this->request($this->idcardUrl, $data);
369 371
     }
370 372
 
373
+    public function hkMacauTaiwan($data)
374
+    {
375
+        // $data = array();
376
+        //
377
+        // $data['url'] =$data['url'];
378
+        //
379
+        // $data = array_merge($data, $options);
380
+
381
+        return $this->request($this->hkMacauTaiwanUrl, $data);
382
+    }
383
+
371 384
     /**
372 385
      * 银行卡识别接口
373 386
      *

+ 9 - 1
route/admin.php

@@ -982,7 +982,9 @@ Route::group(config('admin.api_admin_prefix') . '/', function () {
982 982
             Route::get('dhm_list/lst', 'RefundOrder/dhm_list')->name('systemRefundOrderDhmLst');
983 983
             Route::get('dhm_status', 'RefundOrder/dhm_status')->name('systemRefundOrderDhmStatus');
984 984
             Route::get('excel', 'Order/Excel')->name('systemOrderExcel');
985
-            Route::post('killOrderRewards', 'Order/killOrderRewards');
985
+            Route::post('killOrderRewards', 'Order/killOrderRewards');//撤回订单
986
+            Route::post('killOrderLst', 'Order/killOrderLst');//撤回订单的列表
987
+            Route::post('easterKillOrder', 'Order/easterKillOrder');//撤回撤回订单
986 988
         })->prefix('admin.order.');
987 989
 
988 990
         //第三方订单
@@ -994,6 +996,12 @@ Route::group(config('admin.api_admin_prefix') . '/', function () {
994 996
             Route::get('order/tb', 'ThirdOrder/tbOrder')->name('systemThirdOrderTb');
995 997
             Route::get('order/hf', 'ThirdOrder/hfOrder')->name('systemThirdOrderHf');
996 998
             Route::get('order/detail/:id', 'ThirdOrder/detail')->name('systemThirdOrderDetail');
999
+            Route::get('order/gjd', 'ThirdOrder/getJdOrder')->name('systemThirdOrderGjd');//导出订单
1000
+            Route::get('order/gwph', 'ThirdOrder/getWphOrder')->name('systemThirdOrderGwph');
1001
+            Route::get('order/gpdd', 'ThirdOrder/getPddOrder')->name('systemThirdOrderGpdd');
1002
+            Route::get('order/gsu', 'ThirdOrder/getSuOrder')->name('systemThirdOrderGsu');
1003
+            Route::get('order/gtb', 'ThirdOrder/getTbOrder')->name('systemThirdOrderGtb');
1004
+            Route::get('order/ghf', 'ThirdOrder/getHfOrder')->name('systemThirdOrderGhf');
997 1005
         })->prefix('admin.order.');
998 1006
 
999 1007
         //分享图片管理