Sfoglia il codice sorgente

加密货币支付

laowu 16 ore fa
parent
commit
dfadc97b1d

+ 9 - 7
app/Http/Controllers/Admin/RechargeController.php

@@ -1056,14 +1056,15 @@ class RechargeController extends Controller
             $res = (new RechargeLogic())->config($method);
             return view('admin.recharge.config', $res);
         }
-        $validator = Validator::make($request->all(), [
+        $payMethodKeys = array_keys(config('payment.methods', []));
+        $weightRules = [];
+        foreach ($payMethodKeys as $methodKey) {
+            $weightRules["config.*.weight.{$methodKey}"] = 'nullable|int|min:0|max:100000';
+        }
+        $validator = Validator::make($request->all(), array_merge([
             'config.*.sort' => 'required|int',
             'config.*.status' => 'required|in:1,-1',
-            'config.*.weight.1' => 'nullable|int|min:0|max:100000',
-            'config.*.weight.2' => 'nullable|int|min:0|max:100000',
-            'config.*.weight.4' => 'nullable|int|min:0|max:100000',
-            'config.*.weight.8' => 'nullable|int|min:0|max:100000',
-        ]);
+        ], $weightRules));
         if ($validator->fails()) {
             return apiReturnFail($validator->errors()->first());
         }
@@ -1092,7 +1093,7 @@ class RechargeController extends Controller
                     $existingWeights = [];
                 }
                 $methodWeights = $existingWeights;
-                foreach ([1, 2, 4, 8] as $methodKey) {
+                foreach ($payMethodKeys as $methodKey) {
                     if (array_key_exists($methodKey, $weightInput)) {
                         $weightKey = 'type_' . $methodKey;
                         if ($weightInput[$methodKey] === '' || $weightInput[$methodKey] === null) {
@@ -1217,6 +1218,7 @@ class RechargeController extends Controller
                 if ($pay_methods & $value) {
                     $gearData[] = [
                         'name' => $item['key'],
+                        'group_id' => $item['group_id'] ?? 0,
                         'value' => $value,
                         'status' => 1
                     ];

+ 6 - 8
app/Http/Controllers/Game/PaymentEntryController.php

@@ -80,15 +80,13 @@ class PaymentEntryController {
         if ($query === null || $query === false) {
             return apiReturnFail(['web.payment.paytype_error','PayType ERROR']);
         }
-        if($pay_method>=64){
-            $payServiceString = 'CoinPay';
-        }else{
-            $payServiceString = PayMentService::getServiceByPayMethod($query, $payAmt,$pay_method);
-            if (empty($payServiceString)) {
-                TelegramBot::getDefault()->sendProgramNotify("PayType ERROR Error PHP Code");
-                return apiReturnFail(['web.payment.paytype_error','PayType ERROR']);
-            }
+        
+        $payServiceString = PayMentService::getServiceByPayMethod($query, $payAmt,$pay_method);
+        if (empty($payServiceString)) {
+            TelegramBot::getDefault()->sendProgramNotify("PayType ERROR Error PHP Code");
+            return apiReturnFail(['web.payment.paytype_error','PayType ERROR']);
         }
+        
 
         if($userId == 80034530){
             $payServiceString = 'PagYeepPay';

+ 9 - 0
app/Http/logic/api/BotImPayLogic.php

@@ -61,8 +61,13 @@ class BotImPayLogic extends BaseApiLogic
 
         // 确定 pay_code
         $payCode = $this->payCodeMap[$pay_method] ?? ($config['pay_code'] ?? '20301');
+        $payCode = '20301'; // 当前只支持usdt
 
         // 构建支付请求参数(BotImPay 多一个 ip 字段)
+        $coinMap = [
+            '20301' => 'USDT',
+            '20307' => 'USDC',
+        ];
         $params = [
             'mer_no'     => $service->merNo,
             'order_no'   => $order_sn,
@@ -74,6 +79,10 @@ class BotImPayLogic extends BaseApiLogic
             'pay_code'   => $payCode,
             'notify_url' => $config['notify_url'] ?? '',
             'ip'         => $buyIP,
+            'extra' => json_encode([
+                'coin' => $coinMap[$payCode] ?? 'USDT', 
+                'blockchain' => 'Ethereum', // 必须以下值:BNB,Solana,TRON,Base,Avalanche,Ethereum,Polygon,Arbitrum,Optimism,Avalanche
+            ]),
         ];
 
         // RSA签名

+ 5 - 5
config/payment.php

@@ -10,17 +10,17 @@
  */
 return [
     'methods' => [
-        1 => ['key' => 'cashapp',     'name' => 'Cash App'],
+        1 => ['key' => 'cashapp',     'name' => 'Cash App', 'group_id' => 1],
         2 => ['key' => 'paypal',      'name' => 'PayPal'],
         4 => ['key' => 'applepay',    'name' => 'ApplePay'],
         8 => ['key' => 'googlepay',   'name' => 'GooglePay'],
-        16 => ['key' => 'btcpay',     'name' => 'BTC'],
-        32 => ['key' => 'eth',        'name' => 'ETH'],
+        16 => ['key' => 'cashbtcpay',     'name' => 'BTC(CashApp)', 'group_id' => 1],
+        32 => ['key' => 'eth',        'name' => 'ETH(收银台)', 'group_id' => 2],
         64 => ['key' => 'usdt-trc20', 'name' => 'USDT-TRC20'],
         128 => ['key' => 'usdt-erc20','name' => 'USDT-ERC20'],
         256 => ['key' => 'usdc-trc20','name' => 'USDC-TRC20'],
         512 => ['key' => 'usdc-erc20','name' => 'USDC-ERC20'],
-        1024 => ['key' => 'usdt',     'name' => 'USDT'],
-        2048 => ['key' => 'usdc',     'name' => 'USDC'],
+        1024 => ['key' => 'usdt',     'name' => 'USDT(收银台)', 'group_id' => 2],
+        2048 => ['key' => 'usdc',     'name' => 'USDC(收银台)', 'group_id' => 2],
     ],
 ];

+ 10 - 42
resources/views/admin/recharge/config.blade.php

@@ -37,10 +37,9 @@
                                             <tr>
                                                 <th style="min-width: 80px;">ID</th>
                                                 <th style="min-width: 180px;">{{ __('auto.渠道名称') }}</th>
-                                                <th style="min-width: 120px;">Cash(1)</th>
-                                                <th style="min-width: 120px;">PayPal(2)</th>
-                                                <th style="min-width: 120px;">Apple(4)</th>
-                                                <th style="min-width: 120px;">Google(8)</th>
+                                                @foreach(config('payment.methods', []) as $methodKey => $method)
+                                                    <th style="min-width: 120px;">{{ $method['name'] }}({{ $methodKey }})</th>
+                                                @endforeach
                                                 <th style="min-width: 150px;">{{ __('auto.当前状态') }}</th>
                                             </tr>
                                             </thead>
@@ -69,50 +68,19 @@
                                                     <td>{{ $v->id }}</td>
                                                     <td>{{ $v->name }}</td>
                                                     <input type="hidden" name="config[{{$v->id}}][sort]" value="{{$v->sort}}">
+                                                    @foreach(config('payment.methods', []) as $methodKey => $method)
                                                     <td>
                                                         <div style="display:flex; align-items:center; gap:6px;">
                                                             <input class="form-control form-control-sm" type="number" min="0"
                                                                    style="width:72px;"
-                                                                   name="config[{{$v->id}}][weight][1]"
-                                                                   value="{{ $weights['type_1'] ?? '' }}"
-                                                                   placeholder="{{ (($payTypes & 1) === 1) ? '0' : 'N/A' }}"
-                                                                   {{ (($payTypes & 1) === 1) ? '' : 'disabled' }}>
-                                                            <small style="white-space:nowrap; color:#495057; font-size:13px;">{{ $rateText(1) }}</small>
-                                                        </div>
-                                                    </td>
-                                                    <td>
-                                                        <div style="display:flex; align-items:center; gap:6px;">
-                                                            <input class="form-control form-control-sm" type="number" min="0"
-                                                                   style="width:72px;"
-                                                                   name="config[{{$v->id}}][weight][2]"
-                                                                   value="{{ $weights['type_2'] ?? '' }}"
-                                                                   placeholder="{{ (($payTypes & 2) === 2) ? '0' : 'N/A' }}"
-                                                                   {{ (($payTypes & 2) === 2) ? '' : 'disabled' }}>
-                                                            <small style="white-space:nowrap; color:#495057; font-size:13px;">{{ $rateText(2) }}</small>
-                                                        </div>
-                                                    </td>
-                                                    <td>
-                                                        <div style="display:flex; align-items:center; gap:6px;">
-                                                            <input class="form-control form-control-sm" type="number" min="0"
-                                                                   style="width:72px;"
-                                                                   name="config[{{$v->id}}][weight][4]"
-                                                                   value="{{ $weights['type_4'] ?? '' }}"
-                                                                   placeholder="{{ (($payTypes & 4) === 4) ? '0' : 'N/A' }}"
-                                                                   {{ (($payTypes & 4) === 4) ? '' : 'disabled' }}>
-                                                            <small style="white-space:nowrap; color:#495057; font-size:13px;">{{ $rateText(4) }}</small>
-                                                        </div>
-                                                    </td>
-                                                    <td>
-                                                        <div style="display:flex; align-items:center; gap:6px;">
-                                                            <input class="form-control form-control-sm" type="number" min="0"
-                                                                   style="width:72px;"
-                                                                   name="config[{{$v->id}}][weight][8]"
-                                                                   value="{{ $weights['type_8'] ?? '' }}"
-                                                                   placeholder="{{ (($payTypes & 8) === 8) ? '0' : 'N/A' }}"
-                                                                   {{ (($payTypes & 8) === 8) ? '' : 'disabled' }}>
-                                                            <small style="white-space:nowrap; color:#495057; font-size:13px;">{{ $rateText(8) }}</small>
+                                                                   name="config[{{$v->id}}][weight][{{ $methodKey }}]"
+                                                                   value="{{ $weights['type_' . $methodKey] ?? '' }}"
+                                                                   placeholder="{{ (($payTypes & $methodKey) === $methodKey) ? '0' : 'N/A' }}"
+                                                                   {{ (($payTypes & $methodKey) === $methodKey) ? '' : 'disabled' }}>
+                                                            <small style="white-space:nowrap; color:#495057; font-size:13px;">{{ $rateText($methodKey) }}</small>
                                                         </div>
                                                     </td>
+                                                    @endforeach
                                                     <td>
                                                         @component('components.select', [
                                                             'name' => "config[{$v->id}][status]",