Răsfoiți Sursa

充值 提现完善

Tree 2 luni în urmă
părinte
comite
bf13210120

+ 41 - 2
app/Http/Controllers/Admin/RechargeController.php

@@ -858,8 +858,10 @@ class RechargeController extends Controller
 //            $config_ids = $request->config_ids;
             $favorable_price = (float)$request->favorable_price;
             $give = (float)$request->give;
+            $pay_methods = (int)$request->pay_methods ?: 0;  // 支付方式位掩码
+            
             $logic = new RechargeLogic();
-            $res = $logic->add($money, $status, $config_ids, $favorable_price, $give);
+            $res = $logic->add($money, $status, $config_ids, $favorable_price, $give, $pay_methods);
             return apiReturnSuc();
         }
         return view('admin.recharge.add', ['list' => $list]);
@@ -872,16 +874,53 @@ class RechargeController extends Controller
             $favorable_price = (float)($request->favorable_price ?: 0);
             $give = (float)($request->give ?: 0);
             $second_give = (int)($request->second_give ?: 0);
+            $pay_methods = (int)($request->pay_methods ?: 0);  // 支付方式位掩码
+            
+            // 构建支付方式数组
+            $gearData = [];
+            $payMethodsMap = [
+                1 => 'cashapp',
+                2 => 'paypal',
+                4 => 'applepay',
+                8 => 'googlepay'
+            ];
+            
+            foreach ($payMethodsMap as $value => $name) {
+                if ($pay_methods & $value) {
+                    $gearData[] = [
+                        'name' => $name,
+                        'value' => $value,
+                        'status' => 1
+                    ];
+                }
+            }
+            
             $data = [
                 'money' => $money,
                 'favorable_price' => $favorable_price,
                 'second_give' => $second_give,
-                'give' => $give
+                'give' => $give,
+                'gear' => \GuzzleHttp\json_encode($gearData)  // 存储到gear字段
             ];
             DB::table('agent.dbo.recharge_gear')->where('id', $id)->update($data);
             return apiReturnSuc();
         } else {
             $info = DB::table('agent.dbo.recharge_gear')->where('id', $id)->first();
+            
+            // 解析gear字段,计算pay_methods用于回显
+            $pay_methods = 0;
+            if (!empty($info->gear)) {
+                $gear = \GuzzleHttp\json_decode($info->gear, true);
+                if (is_array($gear)) {
+                    foreach ($gear as $item) {
+                        if (isset($item['value']) && ($item['status'] ?? 0) == 1) {
+                            $pay_methods += $item['value'];
+                        }
+                    }
+                }
+            }
+            $info->pay_methods = $pay_methods;
+            
             return view('admin.recharge.update_config', ['info' => $info]);
         }
 

+ 12 - 12
app/Http/Controllers/Game/PayRechargeController.php

@@ -244,27 +244,27 @@ class PayRechargeController extends Controller
     private function getFirstPayGiftData($firstPayGift, $timeLeft)
     {
         // 获取支付方式
-        $names = DB::table('agent.dbo.admin_configs')
-            ->where([
-                'type' => 'pay_method',
-                'status' => 1,
-            ])
-            ->selectRaw('id, name, status, new_pay_type as type')
-            ->orderByDesc('sort')
-            ->get()
-            ->toArray();
+//        $names = DB::table('agent.dbo.admin_configs')
+//            ->where([
+//                'type' => 'pay_method',
+//                'status' => 1,
+//            ])
+//            ->selectRaw('id, name, status, new_pay_type as type')
+//            ->orderByDesc('sort')
+//            ->get()
+//            ->toArray();
 
         // 获取充值档位
         $list = DB::table('agent.dbo.recharge_gear')
-            ->select('money', 'favorable_price', 'give')
+            ->select('money', 'favorable_price', 'give','gear')
             ->orderBy('money', 'asc')
             ->where('status', 1)
             ->get();
 
-        $gear = \GuzzleHttp\json_encode($names);
+//        $gear = \GuzzleHttp\json_encode($names);
         foreach ($list as &$val) {
             $val->favorable_price = $val->favorable_price + $val->give;
-            $val->gear = $gear;
+//            $val->gear = $gear;
             $val->recommend = 0;
             if ($val->money == $firstPayGift->recommend) {
                 $val->recommend = 1;

+ 2 - 18
app/Http/Controllers/Game/RechargeController.php

@@ -29,27 +29,11 @@ class RechargeController
     public function gear(Request $request)
     {
 
-        $names = DB::table('agent.dbo.admin_configs')
-            ->where([
-                'type' => 'pay_method',
-                'status' => 1,
-            ])
-            ->selectRaw('id, name, status, new_pay_type as type')
-            ->orderByDesc('sort')->get()->toArray();
 
         $list = DB::table('agent.dbo.recharge_gear')
-            ->select('id','money','favorable_price','give','recommend')
+            ->select('id','money','favorable_price','give','recommend','gear')
             ->orderBy('money', 'asc')->where('status', 1)->get();
 
-        $gear=\GuzzleHttp\json_encode($names);
-        foreach ($list as &$val) {
-            $val->favorable_price = $val->favorable_price + $val->give;
-            if(isset($p[$val->money])){
-                $val->activity=$p[$val->money];
-            }
-
-            $val->gear = $gear;
-        }
         return apiReturnSuc(['list'=>$list,'bonus_show'=>false]);
     }
 
@@ -189,7 +173,7 @@ class RechargeController
     }
 
     // 首充可选择渠道
-    public function firstPayConfig(Request $request)
+    public function firstPayfirstPayConfig(Request $request)
     {
         $origin = $_SERVER['HTTP_ORIGIN'] ??$_SERVER['HTTP_REFERER']?? '*';
         if (strstr($origin, "52256") ) {

+ 32 - 32
app/Http/Controllers/Game/WithDrawInfoController.php

@@ -54,10 +54,10 @@ class WithDrawInfoController
         $UserID=$user->UserID;
 
 
-        $paypass = $request->input('paypass');
-        if (!empty($user->InsurePass)&&!Hash::check($paypass,$user->InsurePass)) {
-            return apiReturnFail(['web.user.paypass_fail', 'A senha original está errada, digite-a novamente.'], '', 2);
-        }
+//        $paypass = $request->input('paypass');
+//        if (!empty($user->InsurePass)&&!Hash::check($paypass,$user->InsurePass)) {
+//            return apiReturnFail(['web.user.paypass_fail', 'A senha original está errada, digite-a novamente.'], '', 2);
+//        }
 
         $list=DB::table('QPAccountsDB.dbo.OrderWithDraw')
             ->where('UserID', $UserID)
@@ -176,34 +176,34 @@ class WithDrawInfoController
     }
     public function saveCpf(Request $request)
     {
-        $user = $request->user();
-        $UserID=$user->UserID;
-
-        $account = $request->Account ?: '';
-        $phone = $request->Phone ?: '';
-        $email = $request->Email ?: '';
-        $PixNum = $request->PixNum ?: '';
-
-        if(!Util::validateCpf($PixNum)){
-            return apiReturnFail(['withdraw.account.tip.cpf_error','Cpf error format']);
-        }
-
-        $redisKey = 'Api_updateAccountsPayInfo_'.$UserID;
-        $lock = SetNXLock::getExclusiveLock($redisKey);
-        if (!$lock) {
-            return apiReturnFail(['web.withdraw.try_again_later','Tente novamente mais tarde']);
-        }
-        $exist = DB::table(TableName::QPAccountsDB() . 'AccountWithDrawInfo')->where('UserID', $UserID)->first();
-
-        if ($exist) {
-            DB::table(TableName::QPAccountsDB() . 'AccountWithDrawInfo')->where('UserID', $UserID)->update(['PixNum' => $PixNum]);
-        } else {
-
-            $data = ['BankUserName' => $account, 'PhoneNumber' => $phone, 'EmailAddress' => $email, 'UserID' => $UserID, 'PixNum' => $PixNum, 'Achieves' => '', 'HistoryWithDraw' => 0];
-            DB::table(TableName::QPAccountsDB() . 'AccountWithDrawInfo')
-                ->insert($data);
-        }
-        SetNXLock::release($redisKey);
+//        $user = $request->user();
+//        $UserID=$user->UserID;
+//
+//        $account = $request->Account ?: '';
+//        $phone = $request->Phone ?: '';
+//        $email = $request->Email ?: '';
+//        $PixNum = $request->PixNum ?: '';
+//
+//        if(!Util::validateCpf($PixNum)){
+//            return apiReturnFail(['withdraw.account.tip.cpf_error','Cpf error format']);
+//        }
+//
+//        $redisKey = 'Api_updateAccountsPayInfo_'.$UserID;
+//        $lock = SetNXLock::getExclusiveLock($redisKey);
+//        if (!$lock) {
+//            return apiReturnFail(['web.withdraw.try_again_later','Tente novamente mais tarde']);
+//        }
+//        $exist = DB::table(TableName::QPAccountsDB() . 'AccountWithDrawInfo')->where('UserID', $UserID)->first();
+//
+//        if ($exist) {
+//            DB::table(TableName::QPAccountsDB() . 'AccountWithDrawInfo')->where('UserID', $UserID)->update(['PixNum' => $PixNum]);
+//        } else {
+//
+//            $data = ['BankUserName' => $account, 'PhoneNumber' => $phone, 'EmailAddress' => $email, 'UserID' => $UserID, 'PixNum' => $PixNum, 'Achieves' => '', 'HistoryWithDraw' => 0];
+//            DB::table(TableName::QPAccountsDB() . 'AccountWithDrawInfo')
+//                ->insert($data);
+//        }
+//        SetNXLock::release($redisKey);
         return apiReturnSuc();
     }
     public function MexWithDrawInfo(Request $request)

+ 39 - 22
app/Http/logic/admin/RechargeLogic.php

@@ -130,19 +130,33 @@ class RechargeLogic extends BaseApiLogic
             ->get();
 
         $names = DB::table('agent.dbo.admin_configs')->where('type', 'pay')->pluck('name', 'id');
+        $payMethodsNames = [
+            'cashapp' => 'CashApp',
+            'paypal' => 'PayPal',
+            'applepay' => 'ApplePay',
+            'googlepay' => 'GooglePay'
+        ];
+        
         foreach ($list as &$value) {
 
             $name = [];
             if (!empty($value->gear)) {
                 $gear = \GuzzleHttp\json_decode($value->gear, true);
-                foreach ($gear as $val) {
-                    if ($val['status'] == 1) {
-                        $name[] = isset($names[$val['id']]) ? $names[$val['id']] : '';
+                if (is_array($gear)) {
+                    foreach ($gear as $val) {
+                        // 新格式:支付方式位掩码
+                        if (isset($val['name']) && isset($val['status']) && $val['status'] == 1) {
+                            $name[] = $payMethodsNames[$val['name']] ?? $val['name'];
+                        }
+                        // 旧格式:支付渠道ID(兼容)
+                        elseif (isset($val['id']) && ($val['status'] ?? 0) == 1) {
+                            $name[] = isset($names[$val['id']]) ? $names[$val['id']] : '';
+                        }
                     }
                 }
             }
 
-            $value->gear = implode(',', $name);
+            $value->gear = implode(', ', $name);
         }
 
 
@@ -244,28 +258,31 @@ class RechargeLogic extends BaseApiLogic
         }
     }
 
-    public function add($money, $status, $config_ids, $favorable_price, $give)
+    public function add($money, $status, $config_ids, $favorable_price, $give, $pay_methods = 0)
     {
-        // 查询所有渠道
-//        $pluck = DB::table('agent.dbo.admin_configs')->where('type', 'pay')->pluck('id')->toArray();
-        $data = [];
-//        foreach ($pluck as $val) {
-//            if (in_array($val, $config_ids)) {
-//                $data[] = [
-//                    'id' => $val,
-//                    'status' => 1
-//                ];
-//            } else {
-//                $data[] = [
-//                    'id' => $val,
-//                    'status' => -1
-//                ];
-//            }
-//        }
+        // 构建支付方式数组
+        $gearData = [];
+        $payMethodsMap = [
+            1 => 'cashapp',
+            2 => 'paypal',
+            4 => 'applepay',
+            8 => 'googlepay'
+        ];
+        
+        foreach ($payMethodsMap as $value => $name) {
+            if ($pay_methods & $value) {
+                $gearData[] = [
+                    'name' => $name,
+                    'value' => $value,
+                    'status' => 1
+                ];
+            }
+        }
+        
         $add_data = [
             'money' => round($money, 2),
             'status' => $status,
-            //'gear' => \GuzzleHttp\json_encode($data),
+            'gear' => \GuzzleHttp\json_encode($gearData),  // 存储到gear字段
             'created_at' => date('Y-m-d H:i:s'),
             'favorable_price' => round($favorable_price, 2),
             'give' => round($give, 2)

+ 28 - 1
resources/views/admin/recharge/add.blade.php

@@ -24,6 +24,26 @@
                                     <input type="number" step="0.01" class="form-control required" name="give" placeholder="{{ __('auto.请输入咖啡档位') }}" value="0">
                                 </div>
 
+                                <div class="form-group">
+                                    <label for="pay_methods">*支持的支付方式</label><br>
+                                    <div class="form-check form-check-inline">
+                                        <input class="form-check-input" type="checkbox" name="pay_methods[]" id="cashapp" value="1">
+                                        <label class="form-check-label" for="cashapp">CashApp</label>
+                                    </div>
+                                    <div class="form-check form-check-inline">
+                                        <input class="form-check-input" type="checkbox" name="pay_methods[]" id="paypal" value="2">
+                                        <label class="form-check-label" for="paypal">PayPal</label>
+                                    </div>
+                                    <div class="form-check form-check-inline">
+                                        <input class="form-check-input" type="checkbox" name="pay_methods[]" id="applepay" value="4">
+                                        <label class="form-check-label" for="applepay">ApplePay</label>
+                                    </div>
+                                    <div class="form-check form-check-inline">
+                                        <input class="form-check-input" type="checkbox" name="pay_methods[]" id="googlepay" value="8">
+                                        <label class="form-check-label" for="googlepay">GooglePay</label>
+                                    </div>
+                                </div>
+
                                 <div class="form-group">
                                     <label for="account">*开关</label><br>
                                     {{ __('auto.开启') }} <input type="radio"   name="status" value="1" checked>&nbsp;&nbsp;
@@ -67,7 +87,14 @@
             var status = data.status
             var favorable_price = data.favorable_price
             var give = data.give
-            myRequest("/admin/recharge/add","post", {money,status,favorable_price,give},function(res){
+            
+            // 计算支付方式位掩码
+            var pay_methods = 0;
+            $("input[name='pay_methods[]']:checked").each(function() {
+                pay_methods += parseInt($(this).val());
+            });
+            
+            myRequest("/admin/recharge/add","post", {money,status,favorable_price,give,pay_methods},function(res){
                 if(res.code == '200'){
                     layer.msg(res.msg)
                     setTimeout(function(){

+ 2 - 0
resources/views/admin/recharge/gear_list.blade.php

@@ -35,6 +35,7 @@
                                 <tr>
                                     <th width="5%">{{ __('auto.充值档位') }}</th>
                                     <th width="5%">{{ __('auto.赠送') }}</th>
+                                    <th width="15%">{{ __('auto.支持的支付方式') }}</th>
                                     <th width="8%">{{ __('auto.档位显示开关') }}</th>
                                     <th width="8%">{{ __('auto.修改配置') }}</th>
                                 </tr>
@@ -44,6 +45,7 @@
                                     <tr>
                                         <td>{{ $v->money }}{{ env('CONFIG_24680_CURRENCY') }}</td>
                                         <td>{{ $v->give }}{{ env('CONFIG_24680_CURRENCY') }}</td>
+                                        <td>{{ $v->gear ?: '-' }}</td>
                                         <td>
                                             @if ($v->status == 1)
                                                 <span style="color: #0bb20c">{{ __('auto.已开启') }}</span>

+ 28 - 1
resources/views/admin/recharge/update_config.blade.php

@@ -31,6 +31,26 @@
                                     <input type="text"  class="form-control required" name="second_give" placeholder="{{ __('auto.请输入充值档位') }}" value="{{$info->second_give}}">
                                 </div>
 
+                                <div class="form-group">
+                                    <label for="pay_methods">*支持的支付方式</label><br>
+                                    <div class="form-check form-check-inline">
+                                        <input class="form-check-input" type="checkbox" name="pay_methods[]" id="cashapp" value="1" {{ (($info->pay_methods ?? 0) & 1) ? 'checked' : '' }}>
+                                        <label class="form-check-label" for="cashapp">CashApp</label>
+                                    </div>
+                                    <div class="form-check form-check-inline">
+                                        <input class="form-check-input" type="checkbox" name="pay_methods[]" id="paypal" value="2" {{ (($info->pay_methods ?? 0) & 2) ? 'checked' : '' }}>
+                                        <label class="form-check-label" for="paypal">PayPal</label>
+                                    </div>
+                                    <div class="form-check form-check-inline">
+                                        <input class="form-check-input" type="checkbox" name="pay_methods[]" id="applepay" value="4" {{ (($info->pay_methods ?? 0) & 4) ? 'checked' : '' }}>
+                                        <label class="form-check-label" for="applepay">ApplePay</label>
+                                    </div>
+                                    <div class="form-check form-check-inline">
+                                        <input class="form-check-input" type="checkbox" name="pay_methods[]" id="googlepay" value="8" {{ (($info->pay_methods ?? 0) & 8) ? 'checked' : '' }}>
+                                        <label class="form-check-label" for="googlepay">GooglePay</label>
+                                    </div>
+                                </div>
+
                                 <button type="button" onclick="commit({{$info->id}})" class="btn btn-sm btn-gradient-primary btn-icon-text">
                                     <i class="mdi mdi-file-check btn-icon-prepend"></i>
                                     {{ __('auto.提交') }}
@@ -61,7 +81,14 @@
             var favorable_price = data.favorable_price
             var give = data.give
             var second_give = data.second_give
-            myRequest("/admin/recharge/update_config/"+id,"post", {money,favorable_price,give,second_give},function(res){
+            
+            // 计算支付方式位掩码
+            var pay_methods = 0;
+            $("input[name='pay_methods[]']:checked").each(function() {
+                pay_methods += parseInt($(this).val());
+            });
+            
+            myRequest("/admin/recharge/update_config/"+id,"post", {money,favorable_price,give,second_give,pay_methods},function(res){
                 if(res.code == '200'){
                     layer.msg(res.msg)
                     setTimeout(function(){