瀏覽代碼

升级支付配置

Tree 2 月之前
父節點
當前提交
25ba7c12b1

+ 10 - 2
app/Http/Controllers/Game/PaymentEntryController.php

@@ -23,7 +23,7 @@ class PaymentEntryController {
         $userEmail = $request->input('userEmail');
         $userEmail = $request->input('userEmail');
         $userPhone = $request->input('userPhone');
         $userPhone = $request->input('userPhone');
         $pay_type = (int)$request->input('pay_type',28);
         $pay_type = (int)$request->input('pay_type',28);
-        $pay_method = $request->input('pay_method', 'cashapp');
+        $pay_method = $request->input('pay_method', 1);
         $GiftsID = (int)$request->input('GiftsID');
         $GiftsID = (int)$request->input('GiftsID');
         $AdId = $request->input('AdId');
         $AdId = $request->input('AdId');
         $eventType = $request->input('eventType');
         $eventType = $request->input('eventType');
@@ -34,6 +34,14 @@ class PaymentEntryController {
         $where[] = ['status', 1];
         $where[] = ['status', 1];
         $where[] = ['id', $pay_type];
         $where[] = ['id', $pay_type];
 
 
+//        $payMethods = [
+//            'cashapp' => 1,
+//            'paypal' => 2,
+//            'applepay' => 4,
+//            'googlepay' => 8,
+//
+//        ];
+
 
 
         $query = DB::table('agent.dbo.admin_configs')->where($where)->value('config_key');
         $query = DB::table('agent.dbo.admin_configs')->where($where)->value('config_key');
 
 
@@ -41,7 +49,7 @@ class PaymentEntryController {
             return apiReturnFail(['web.payment.paytype_error','PayType ERROR']);
             return apiReturnFail(['web.payment.paytype_error','PayType ERROR']);
         }
         }
         $channel = $request->globalUser->Channel;
         $channel = $request->globalUser->Channel;
-        $payServiceString = PayMentService::getServiceByPayMethod($query, $channel);
+        $payServiceString = PayMentService::getServiceByPayMethod($query, $payAmt,$pay_method);
 
 
 
 
         Log::info('channel', [
         Log::info('channel', [

+ 11 - 1
app/Http/logic/api/WiwiPayLogic.php

@@ -49,13 +49,23 @@ class WiwiPayLogic extends BaseApiLogic
         $amount = (int) round($pay_amount * NumConfig::NUM_VALUE) ;
         $amount = (int) round($pay_amount * NumConfig::NUM_VALUE) ;
         $logic->orderCreate($order_sn, $amount, 'WiwiPay', $userId, '', $GiftsID, $AdId, $eventType);
         $logic->orderCreate($order_sn, $amount, 'WiwiPay', $userId, '', $GiftsID, $AdId, $eventType);
 
 
+        $payMethods = [
+            'cashapp' => 1,
+            'paypal' => 2,
+            'applepay' => 4,
+            'googlepay' => 8,
+
+        ];
+
+        $wwMethod = @$payMethods[$pay_method];
+
         // 构建支付请求参数
         // 构建支付请求参数
         $params = [
         $params = [
             "mchNo" => $service->mchNo,
             "mchNo" => $service->mchNo,
             "mchOrderNo" => $order_sn,
             "mchOrderNo" => $order_sn,
             "amount" => $amount,
             "amount" => $amount,
             "currency" => $config['currency'] ?? "usd",
             "currency" => $config['currency'] ?? "usd",
-            "wayCode" => !empty($pay_method) ? $pay_method : ($config['wayCode'] ?? "cashapp"),
+            "wayCode" => $wwMethod? $wwMethod : ($config['wayCode'] ?? "cashapp"),
             "clientIp" => $buyIP,
             "clientIp" => $buyIP,
             "notifyUrl" => $config['notify'] ?? '',
             "notifyUrl" => $config['notify'] ?? '',
             "returnUrl" => $config['return'] ?? '',
             "returnUrl" => $config['return'] ?? '',

+ 35 - 34
app/Services/PayMentService.php

@@ -90,41 +90,42 @@ class PayMentService
      * @param $channel
      * @param $channel
      * @return bool|mixed
      * @return bool|mixed
      */
      */
-    public static function getServiceByPayMethod($method, $channel,$except_channelName="")
+    public static function getServiceByPayMethod($method, $payAmt,$pay_method)
     {
     {
-        $except_configKeys=[$except_channelName];
-        $switch = Redis::get("recharge_config_switch_{$channel}");
-        if ($channel && $switch) {
-            $services = DB::connection('write')
-                          ->table('QPPlatformDB.dbo.ChannelOpenRecharge')
-                          ->join(
-                              'agent.dbo.admin_configs',
-                              'admin_configs.id',
-                              '=',
-                              'ChannelOpenRecharge.ConfigID'
-                          )
-                          ->where('admin_configs.new_pay_type', $method)
-                          ->whereNotIn('admin_configs.config_key',$except_configKeys)
-                          ->where('admin_configs.type', 'pay')
-                          ->where('admin_configs.status', 1)
-                          ->where('ChannelOpenRecharge.Status', 1)
-                          ->where('ChannelOpenRecharge.Channel', $channel)
-                          ->where('ChannelOpenRecharge.Sort', '>', 0)
-                          ->selectRaw('admin_configs.config_key, ChannelOpenRecharge.Sort as sort')
-                          ->get();
-        }
-        if (!isset($services) || !$services->count()) {
-            $services = DB::table('agent.dbo.admin_configs')->where([
-                                                                        'new_pay_type' => $method,
-                                                                        'type' => 'pay',
-                                                                        'status' => 1,
-                                                                    ])->get();
-            if (!$services->count()) {
-                Log::error('支付渠道配置异常', [
-                    'method' => $method,
-                ]);
-                return false;
-            }
+//        $except_configKeys=[$except_channelName];
+//        $switch = Redis::get("recharge_config_switch_{$channel}");
+//        if ($channel && $switch) {
+//            $services = DB::connection('write')
+//                          ->table('QPPlatformDB.dbo.ChannelOpenRecharge')
+//                          ->join(
+//                              'agent.dbo.admin_configs',
+//                              'admin_configs.id',
+//                              '=',
+//                              'ChannelOpenRecharge.ConfigID'
+//                          )
+//                          ->where('admin_configs.new_pay_type', $method)
+//                          ->whereNotIn('admin_configs.config_key',$except_configKeys)
+//                          ->where('admin_configs.type', 'pay')
+//                          ->where('admin_configs.status', 1)
+//                          ->where('ChannelOpenRecharge.Status', 1)
+//                          ->where('ChannelOpenRecharge.Channel', $channel)
+//                          ->where('ChannelOpenRecharge.Sort', '>', 0)
+//                          ->selectRaw('admin_configs.config_key, ChannelOpenRecharge.Sort as sort')
+//                          ->get();
+//        }
+        $services = DB::table('agent.dbo.admin_configs')->where([
+            'new_pay_type' => $method,
+            'type' => 'pay',
+            'status' => 1,
+        ])->whereRaw('pay_types&'.$pay_method.'='.$pay_method)
+            ->where('min_amount', '<=', $payAmt)
+            ->where('max_amount', '>=', $payAmt)
+            ->get();
+        if (!$services->count()) {
+            Log::error('支付渠道配置异常', [
+                'method' => $method,
+            ]);
+            return false;
         }
         }
         $matrix = [];
         $matrix = [];
         foreach ($services as $v) {
         foreach ($services as $v) {