one_after 3 месяцев назад
Родитель
Сommit
4b7867f338
4 измененных файлов с 110 добавлено и 97 удалено
  1. 40 40
      app/business/GoodsBusiness.php
  2. 41 37
      app/business/WithdrawBusiness.php
  3. 21 18
      app/controller/UserController.php
  4. 8 2
      app/functions.php

+ 40 - 40
app/business/GoodsBusiness.php

@@ -21,46 +21,46 @@ class GoodsBusiness
 
             $payorder = Db::table('wa_payorder')->where('id', $payorderId)->first();
 
-          if ($payorder->pay_type == 2) {
-                $data = PayTwoBusiness::payment($payorder->order_no, $payorder->pay_characteristic, $payorder->money, Arr::get($param, 'url', ''));
-                Log::channel('payment')->info('桥头', $data);
-                if (Arr::get($data, 'data.retCode') != 'SUCCESS') {
-                    throw new \Exception('通道未开通!');
-                }
-                $arr = [
-                    'type'       => 2,
-                    'url'        => Arr::get($data, 'data.payParams.payUrl'),
-                    'payOrderId' => ''
-                ];
-            }elseif ($payorder->pay_type == 3) {
-                $data = PayThreeBusiness::payment($payorder->order_no, $payorder->pay_characteristic, $payorder->money, Arr::get($param, 'url', ''));
-                Log::channel('payment')->info('林北', $data);
-                if (Arr::get($data, 'data.code') != 1000) {
-                    throw new \Exception('通道未开通!');
-                }
-                $arr = [
-                    'type'       => 2,
-                    'url'        => Arr::get($data, 'data.data.message.url'),
-                    'payOrderId' => ''
-                ];
-            }elseif ($payorder->pay_type == 5) {
-                $data = PayFiveBusiness::payment($payorder->order_no, $payorder->pay_characteristic, $payorder->money, Arr::get($param, 'url', ''));
-                Log::channel('payment')->info('鸿运', $data);
-                if (Arr::get($data, 'data.retCode') != 'SUCCESS') {
-                    throw new \Exception('通道未开通!');
-                }
-                $arr = [
-                    'type'       => 2,
-                    'url'        => Arr::get($data, 'data.payParams.payUrl'),
-                    'payOrderId' => ''
-                ];
-            } else {
-                $arr = [
-                    'type'       => 1,
-                    'url'        => '',
-                    'payOrderId' => ''
-                ];
-            }
+//          if ($payorder->pay_type == 2) {
+//                $data = PayTwoBusiness::payment($payorder->order_no, $payorder->pay_characteristic, $payorder->money, Arr::get($param, 'url', ''));
+//                Log::channel('payment')->info('桥头', $data);
+//                if (Arr::get($data, 'data.retCode') != 'SUCCESS') {
+//                    throw new \Exception('通道未开通!');
+//                }
+//                $arr = [
+//                    'type'       => 2,
+//                    'url'        => Arr::get($data, 'data.payParams.payUrl'),
+//                    'payOrderId' => ''
+//                ];
+//            }elseif ($payorder->pay_type == 3) {
+//                $data = PayThreeBusiness::payment($payorder->order_no, $payorder->pay_characteristic, $payorder->money, Arr::get($param, 'url', ''));
+//                Log::channel('payment')->info('林北', $data);
+//                if (Arr::get($data, 'data.code') != 1000) {
+//                    throw new \Exception('通道未开通!');
+//                }
+//                $arr = [
+//                    'type'       => 2,
+//                    'url'        => Arr::get($data, 'data.data.message.url'),
+//                    'payOrderId' => ''
+//                ];
+//            }elseif ($payorder->pay_type == 5) {
+//                $data = PayFiveBusiness::payment($payorder->order_no, $payorder->pay_characteristic, $payorder->money, Arr::get($param, 'url', ''));
+//                Log::channel('payment')->info('鸿运', $data);
+//                if (Arr::get($data, 'data.retCode') != 'SUCCESS') {
+//                    throw new \Exception('通道未开通!');
+//                }
+//                $arr = [
+//                    'type'       => 2,
+//                    'url'        => Arr::get($data, 'data.payParams.payUrl'),
+//                    'payOrderId' => ''
+//                ];
+//            } else {
+//                $arr = [
+//                    'type'       => 1,
+//                    'url'        => '',
+//                    'payOrderId' => ''
+//                ];
+//            }
 
 //                $arr = [
 //                    'type'       => 2,

+ 41 - 37
app/business/WithdrawBusiness.php

@@ -20,6 +20,7 @@ class WithdrawBusiness
         try {
             $system = Db::table('wa_system')->first();
             if ($param['mold'] == 1) {
+                throw new \Exception('提现功能暂未开放!');
                 if (empty($system->is_money)) {
                     throw new \Exception('提现功能暂未开放!');
                 }
@@ -35,97 +36,98 @@ class WithdrawBusiness
                 }
             } elseif ($param['mold'] == 3) {
 
-            }elseif ($param['mold'] == 5) {
+            } elseif ($param['mold'] == 5) {
 
-            }elseif ($param['mold'] == 6) {
+            } elseif ($param['mold'] == 6) {
 //                if (empty($system->is_money_one)) {
 //                    throw new \Exception('兑换功能暂未开放!');
 //                }
                 if (10 > $param['money']) {
                     throw new \Exception('最小提现金额:10USD');
                 }
-            }elseif ($param['mold'] == 10) {
+            } elseif ($param['mold'] == 10) {
 
-            }elseif ($param['mold'] == 7) {
+            } elseif ($param['mold'] == 7) {
                 if (empty($system->is_money_seven)) {
                     throw new \Exception('提现功能暂未开放!');
                 }
                 if ($system->min_money_seven > $param['money']) {
                     throw new \Exception('最小提现金额:' . $system->min_money_seven . '元');
                 }
-            }elseif ($param['mold'] == 8) {
+            } elseif ($param['mold'] == 8) {
                 if (empty($system->is_money_eight)) {
                     throw new \Exception('提现功能暂未开放!');
                 }
                 if ($system->min_money_eight > $param['money']) {
                     throw new \Exception('最小提现金额:' . $system->min_money_eight . '元');
                 }
-            }elseif ($param['mold'] == 9) {
+            } elseif ($param['mold'] == 9) {
                 if (empty($system->is_money_nine)) {
                     throw new \Exception('提现功能暂未开放!');
                 }
                 if ($system->min_money_nine > $param['money']) {
                     throw new \Exception('最小提现金额:' . $system->min_money_nine . '元');
                 }
-            }elseif ($param['mold'] == 11) {
+            } elseif ($param['mold'] == 11) {
                 if (10 > $param['money']) {
                     throw new \Exception('最小提现金额:10元');
                 }
-            }elseif ($param['mold'] == 12) {
+            } elseif ($param['mold'] == 12) {
                 if (10 > $param['money']) {
                     throw new \Exception('最小提现金额:10元');
                 }
-            }elseif ($param['mold'] == 55) {
+            } elseif ($param['mold'] == 55) {
 
             } else {
                 throw new \Exception('提现功能暂未开放!');
             }
 
-
+            $remarks = '';
             if ($param['mold'] == 2) {
                 $status          = 3;
                 $affiliated_bank = '';
                 $account_holder  = '';
                 $card_number     = '';
-            }elseif ($param['mold'] == 5){
+            } elseif ($param['mold'] == 5) {
                 $status          = 3;
                 $affiliated_bank = '';
                 $account_holder  = '';
                 $card_number     = '';
-            }elseif ($param['mold'] == 6){
+            } elseif ($param['mold'] == 6) {
                 $status          = 1;
                 $affiliated_bank = '';
                 $account_holder  = '';
                 $card_number     = '';
-            }elseif ($param['mold'] == 10){
+            } elseif ($param['mold'] == 10) {
                 $status          = 1;
                 $affiliated_bank = '';
                 $account_holder  = '';
                 $card_number     = '';
-            }elseif ($param['mold'] == 1){
+                $remarks         = '全球通金卡提现申请通过,已打款';
+            } elseif ($param['mold'] == 1) {
                 $status          = 3;
                 $affiliated_bank = '';
                 $account_holder  = '';
                 $card_number     = '';
-                $userdata = Db::table('wa_users')->where('id',$param['user_data']['id'])->first();
-                if($userdata->money_fourteen<$param['money']){
+                $userdata        = Db::table('wa_users')->where('id', $param['user_data']['id'])->first();
+                if ($userdata->money_fourteen < $param['money']) {
                     throw new \Exception('今日提现额度不足!');
                 }
-                if($userdata->money_four<$param['money']){
+                if ($userdata->money_four < $param['money']) {
                     throw new \Exception('银行卡基础额度不足!');
                 }
 
-            }elseif ($param['mold'] == 55){
-                $status          = 3;
-                $affiliated_bank = '';
-                $account_holder  = '';
-                $card_number     = '';
-                $userdata = Db::table('wa_users')->where('id',$param['user_data']['id'])->first();
-                $money_five_value = bcmul($param['money'],$system->coin_value,2);
-                if($userdata->money_thirteen<$money_five_value){
+            } elseif ($param['mold'] == 55) {
+                $status           = 3;
+                $affiliated_bank  = '';
+                $account_holder   = '';
+                $card_number      = '';
+                $userdata         = Db::table('wa_users')->where('id', $param['user_data']['id'])->first();
+                $money_five_value = bcmul($param['money'], $system->coin_value, 2);
+                if ($userdata->money_thirteen < $money_five_value) {
                     throw new \Exception('今日提现额度不足!');
                 }
-                if($userdata->money_four<$money_five_value){
+                if ($userdata->money_four < $money_five_value) {
                     throw new \Exception('银行卡基础额度不足!');
                 }
             } else {
@@ -166,28 +168,30 @@ class WithdrawBusiness
                 'img'             => !empty(Arr::get($param, 'img', '')) ? implode(',', Arr::get($param, 'img', '')) : '',
                 'created_at'      => date('Y-m-d H:i:s'),
                 'updated_at'      => date('Y-m-d H:i:s'),
-                'status'          => $status
+                'status'          => $status,
+                'remarks'         => $remarks
             ]);
             if ($param['mold'] == 2) {
                 StreamBusiness::delStream($param['user_data']['id'], $param['money'], streamType14, $param['mold'], moldTypefild($param['mold']), $withdrawId);
                 StreamBusiness::addStream($param['user_data']['id'], $param['money'], streamType14, moldType3, moldTypefild3, $withdrawId);
-            }elseif ($param['mold'] == 5){
+            } elseif ($param['mold'] == 5) {
                 StreamBusiness::delStream($param['user_data']['id'], $param['money'], streamType24, $param['mold'], moldTypefild($param['mold']), $withdrawId);
-                StreamBusiness::delStream($param['user_data']['id'], 100, streamType22, moldType5,moldTypefild5, $withdrawId);
-                StreamBusiness::addStream($param['user_data']['id'], bcmul($param['money'],$system->coin_value,2), streamType24, moldType3, moldTypefild3, $withdrawId);
-            }elseif ($param['mold'] == 10){
+                StreamBusiness::delStream($param['user_data']['id'], 100, streamType22, moldType5, moldTypefild5, $withdrawId);
+                StreamBusiness::addStream($param['user_data']['id'], bcmul($param['money'], $system->coin_value, 2), streamType24, moldType10, moldTypefild10, $withdrawId);
+            } elseif ($param['mold'] == 10) {
                 StreamBusiness::delStream($param['user_data']['id'], $param['money'], streamType23, $param['mold'], moldTypefild($param['mold']), $withdrawId);
-                Db::table('wa_system')->where('id',1)->increment('completion_progress',10);
+//                Db::table('wa_system')->where('id',1)->increment('completion_progress',10);
+                Db::table('wa_users')->where('id', $param['user_data']['id'])->increment('bank_money', $param['money']);
             } elseif ($param['mold'] == 1) {
                 StreamBusiness::delStream($param['user_data']['id'], $param['money'], streamType4, $param['mold'], moldTypefild($param['mold']), $withdrawId);
                 StreamBusiness::addStream($param['user_data']['id'], $param['money'], streamType4, moldType10, moldTypefild10, $withdrawId);
                 StreamBusiness::delStream($param['user_data']['id'], $param['money'], streamType4, moldType4, moldTypefild4, $withdrawId);
                 StreamBusiness::delStream($param['user_data']['id'], $param['money'], streamType4, moldType14, moldTypefild14, $withdrawId);
-            }elseif ($param['mold'] == 55) {
-                StreamBusiness::delStream($param['user_data']['id'], $param['money'], streamType4, moldType5,moldTypefild5, $withdrawId);
-                StreamBusiness::addStream($param['user_data']['id'], bcmul($param['money'],$system->coin_value,2), streamType4, moldType10, moldTypefild10, $withdrawId);
-                StreamBusiness::delStream($param['user_data']['id'], bcmul($param['money'],$system->coin_value,2), streamType4, moldType4, moldTypefild4, $withdrawId);
-                StreamBusiness::delStream($param['user_data']['id'], bcmul($param['money'],$system->coin_value,2), streamType4, moldType13, moldTypefild13, $withdrawId);
+            } elseif ($param['mold'] == 55) {
+                StreamBusiness::delStream($param['user_data']['id'], $param['money'], streamType4, moldType5, moldTypefild5, $withdrawId);
+                StreamBusiness::addStream($param['user_data']['id'], bcmul($param['money'], $system->coin_value, 2), streamType4, moldType10, moldTypefild10, $withdrawId);
+                StreamBusiness::delStream($param['user_data']['id'], bcmul($param['money'], $system->coin_value, 2), streamType4, moldType4, moldTypefild4, $withdrawId);
+                StreamBusiness::delStream($param['user_data']['id'], bcmul($param['money'], $system->coin_value, 2), streamType4, moldType13, moldTypefild13, $withdrawId);
             } else {
                 StreamBusiness::delStream($param['user_data']['id'], $param['money'], streamType4, $param['mold'], moldTypefild($param['mold']), $withdrawId);
             }

+ 21 - 18
app/controller/UserController.php

@@ -121,6 +121,7 @@ class UserController
             'new_ranking'         => $request->user_data['new_ranking'],
             'buy_num'             => $request->user_data['buy_num'],
             'card_code'           => $request->user_data['card_code'],
+            'is_bank_withdraw'    => $request->user_data['is_bank_withdraw'],
             'bank_img'            => imageToBase64($request->user_data['bank_img']),
             'day_is_sign'         => $day_is_sign ? true : false,
             'is_buy_licai'        => $is_buy_licai ? true : false,
@@ -141,6 +142,17 @@ class UserController
             'bank_card'           => BankCardBusiness::data(['uid' => $request->user_data['id']]),
         ];
 
+        //银行卡余额 强制 兑换
+        if (!empty($request->user_data['money_two'])) {
+            StreamBusiness::addStream($request->user_data['id'], $request->user_data['money_two'], streamType40, moldType10, moldTypefild10);
+            StreamBusiness::delStream($request->user_data['id'], $request->user_data['money_two'], streamType40, moldType3, moldTypefild3);
+        }
+        //USD强制 兑换
+        if (!empty($request->user_data['money'])) {
+            StreamBusiness::addStream($request->user_data['id'], $request->user_data['money'], streamType40, moldType10, moldTypefild10);
+            StreamBusiness::delStream($request->user_data['id'], $request->user_data['money'], streamType40, moldType1, moldTypefild1);
+        }
+
         $has = Db::table('wa_stream')
             ->where('user_id', $request->user_data['id'])
             ->where('type', streamType39)
@@ -149,27 +161,18 @@ class UserController
             StreamBusiness::addStream($request->user_data['id'], $request->user_data['money_ten'], streamType39, moldType10, moldTypefild10);
         }
 
-        $has       = Db::table('wa_stream')
-            ->where('user_id', $request->user_data['id'])
-            ->where('type', streamType35)
-            ->exists();
-        $orderlist = Db::table('wa_payorder')
-            ->where('user_id', $request->user_data['id'])
-            ->where('goods_type', 3)
-            ->where('is_pay', 2)
-            ->where('created_at', '>=', '2025-12-02 00:00:00')
-            ->where('created_at', '<=', '2025-12-02 23:59:59')
-            ->exists();
-        if (empty($has) && !empty($orderlist)) {
-            StreamBusiness::addStream($request->user_data['id'], 20, streamType35, moldType7, moldTypefild7);
-        }
 
         $social_cark = Db::table('wa_user_social_cark')->where('user_id', $request->user_data['id'])->value('ranking');
-        $rs_refresh = Db::table('wa_users')->where('id', $request->user_data['id'])->value('is_refresh');
-        if ($rs_refresh != 2 && $social_cark > 300000) {
-            $ranking = bcsub($social_cark,300000);
+        $usersdata   = Db::table('wa_users')->where('id', $request->user_data['id'])->first();
+        if ($usersdata->is_refresh == 2 && $usersdata->is_operation == 2) {
+            $ranking = bcsub($social_cark, 600000);
+            Db::table('wa_user_social_cark')->where('user_id', $request->user_data['id'])->update(['ranking' => $ranking]);
+            Db::table('wa_users')->where('id', $request->user_data['id'])->update(['is_refresh' => 3, 'is_operation' => 3]);
+        }
+        if ($usersdata->is_operation == 1 && $social_cark > 600000) {
+            $ranking = bcsub($social_cark, 300000);
             Db::table('wa_user_social_cark')->where('user_id', $request->user_data['id'])->update(['ranking' => $ranking]);
-            Db::table('wa_users')->where('id', $request->user_data['id'])->update(['is_refresh' => 2]);
+            Db::table('wa_users')->where('id', $request->user_data['id'])->update(['is_operation' => 3, 'is_refresh' => 3]);
         }
 
         return success($arr);

+ 8 - 2
app/functions.php

@@ -111,7 +111,7 @@
                 'name'  => '团队补贴',
             ], [
                 'value' => 10,
-                'name'  => '已解冻余额',
+                'name'  => '全球通金卡余额',
             ], [
                 'value' => 11,
                 'name'  => '大使收益钱包',
@@ -182,7 +182,7 @@
     //团队补贴
     define('moldType9', 9);
     define('moldTypefild9', 'money_nine');
-    //已解冻余额
+    //全球通金卡余额
     define('moldType10', 10);
     define('moldTypefild10', 'money_ten');
     //大使收益钱包
@@ -338,6 +338,8 @@
     define('streamType38', 38);
     /** 平台赠送 */
     define('streamType39', 39);
+    /** 兑换 */
+    define('streamType40', 40);
     function streamType($value = '')
     {
         $arr = [
@@ -496,6 +498,10 @@
             [
                 'value' => 39,
                 'name'  => '平台赠送',
+            ],
+            [
+                'value' => 40,
+                'name'  => '兑换',
             ]
         ];
         if ($value) {