Tree 2 месяцев назад
Родитель
Сommit
61fc236419

+ 1 - 38
app/Console/Commands/ExemptReview.php

@@ -58,16 +58,8 @@ class ExemptReview extends Command
         $WithdrawalModel = new Withdrawal();
         $OrderWithDraw = DB::connection('write')->table('QPAccountsDB.dbo.OrderWithDraw')->where('State', 1)
                            ->whereRaw('locking = 0')->orderBy('CreateDate', 'desc')->get();
-        $userIDChannelMap = AccountsInfo::whereIn('UserID', $OrderWithDraw->pluck('UserID'))
-                                        ->pluck('Channel', 'UserID');
-
-        $channelConfigs = WithdrawalChannelPositionConfig::where('status', 1)->pluck('agent', 'channel');
 
         foreach ($OrderWithDraw as $value) {
-
-
-
-
             if ($value->State != 1) {
                 continue;
             }
@@ -77,12 +69,7 @@ class ExemptReview extends Command
             if (!$verifyRes) {
                 continue;
             }
-
-
-
-
             //防止刷子补充
-
             $AccountsInfoModel = new AccountsInfo();
 
             //            $mailNums=DB::table(TableName::QPAccountsDB() . 'OrderWithDraw')
@@ -143,19 +130,11 @@ class ExemptReview extends Command
                 Log::info("CPF重复阻拦自动免审:".$value->OrderId);
                 continue;
             }
-
-
             // 读取免审配置
             $config = DB::table(TableName::agent().'withdrawal_position_config')->where('status', 1)->first();
-
             if ($config) {
-                $agent = $config->agent;
-                //如果独立配置了,就走这个
-                $channelConfig = $channelConfigs[$userIDChannelMap[$value->UserID]] ?? null;
-                if ($channelConfig) {
-                    $agent = $channelConfig;
-                }
 
+                $agent = $config->agent;
                 if (empty($agent)) { // 默认第一家
                     $agent = DB::connection('write')->table('agent.dbo.admin_configs')->where('config_value', 1)
                                ->where('type', 'cash')->where('status', 1)->first()->config_value;
@@ -175,9 +154,6 @@ class ExemptReview extends Command
                 }
 
                 $redis->set($order_sn.'key1', $order_sn, 3600 * 24);
-
-
-
                 $log = ['user_id'   => $value->UserID,
                         'config_id' => $config->id,
                         'use_quota' => $value->WithDraw,
@@ -196,8 +172,6 @@ class ExemptReview extends Command
                 // 添加用户提现操作记录
                 DB::connection('write')->table('QPAccountsDB.dbo.AccountsRecord')
                   ->updateOrInsert(['RecordID' => $value->RecordID, 'type' => 1], $RecordData);
-
-
                 $RecordID = $value->RecordID;
                 $amount = $value->WithDraw;
                 $accountName = $value->BankUserName;
@@ -209,17 +183,6 @@ class ExemptReview extends Command
                 $IFSCNumber = $value->IFSCNumber;
                 $BranchBank = $value->BranchBank;
                 $BankNO = $value->BankNO;
-
-                if($PixType>10){
-                    Util::WriteLog("pixerror",$value);
-                    $oldRecord=DB::table('QPAccountsDB.dbo.OrderWithDraw')->where('UserID', $value->UserID)->where('State',2)->first();
-                    if(isset($oldRecord)&&isset($oldRecord->PixType)){
-                        $PixType=$oldRecord->PixType;
-                    }else{
-                        $PixType=1;
-                    }
-
-                }
                 // 改变状态处理中
                 $agentID = DB::connection('write')->table('agent.dbo.admin_configs')->where('config_value', $agent)
                              ->select('id')->first()->id ?? '';

+ 146 - 2
app/Http/Controllers/Admin/WithdrawalController.php

@@ -768,9 +768,9 @@ class WithdrawalController extends BaseController
     {
         if ($request->isMethod('get')) {
 
+            // 获取所有代付渠道配置(包括关闭的)
             $agent = DB::table('agent.dbo.admin_configs')
                 ->where('type', 'cash')
-                ->where('status', 1)
                 ->get();
             $info = DB::table('agent.dbo.withdrawal_position_config')->find($id);
 
@@ -805,7 +805,6 @@ class WithdrawalController extends BaseController
                 'total_quota' => $post['total_quota'],
                 'admin_id' => $admin_id,
                 'status' => $post['status'],
-                'agent' => $post['agent'],
                 'draw_gt_recharge' => $post['draw_gt_recharge'],
                 'draw_total' => $post['draw_total'],
                 'draw_bi' => $post['draw_bi'],
@@ -817,6 +816,151 @@ class WithdrawalController extends BaseController
         }
     }
 
+    // 提现渠道配置(新增和修改权重)
+    public function cashier_channel_config(Request $request)
+    {
+        if ($request->isMethod('get')) {
+            // 获取所有提现渠道
+            $list = DB::table('agent.dbo.admin_configs')
+                ->leftJoin('agent.dbo.admin_users as u', 'admin_configs.admin_id', '=', 'u.id')
+                ->select('admin_configs.*', 'u.account')
+                ->where('admin_configs.type', 'cash')
+                ->orderBy('admin_configs.id', 'asc')
+                ->get();
+            
+            return view('admin.Withdrawal.cashier_channel_config', ['list' => $list]);
+        } else {
+            // POST 提交 - 修改权重
+            $validator = Validator::make($request->all(), [
+                'config.*.sort' => 'required|int',
+                'config.*.status' => 'required|in:1,-1',
+            ]);
+            
+            if ($validator->fails()) {
+                return apiReturnFail($validator->errors()->first());
+            }
+            
+            $config = $request->input('config');
+            
+            // 验证权重总和
+            $opened = array_filter($config, function ($item) {
+                return $item['status'] == 1;
+            });
+            
+            if (empty($opened)) {
+                return apiReturnFail('至少需要开启一个提现渠道');
+            }
+            
+            if (array_sum(array_column($opened, 'sort')) != 100) {
+                return apiReturnFail('权重值分配不正确,开启的渠道权重总和必须为100');
+            }
+            
+            // 更新配置
+            foreach ($config as $id => $v) {
+                $v['admin_id'] = session('admin')['id'];
+                $v['updated_at'] = date('Y-m-d H:i:s');
+                if ($v['status'] == -1) {
+                    $v['sort'] = 0;
+                }
+                DB::table('agent.dbo.admin_configs')->where('id', $id)->update($v);
+            }
+            
+            return apiReturnSuc();
+        }
+    }
+    
+    // 新增提现渠道
+    public function cashier_channel_add(Request $request)
+    {
+        if ($request->isMethod('get')) {
+            return view('admin.Withdrawal.cashier_channel_add');
+        } else {
+            // POST 提交
+            $validator = Validator::make($request->all(), [
+                'name' => 'required',
+                'config_value' => 'required',
+                'status' => 'required|in:1,-1',
+            ]);
+            
+            if ($validator->fails()) {
+                return apiReturnFail($validator->errors()->first());
+            }
+            
+            // 获取最大ID
+            $maxId = DB::table('agent.dbo.admin_configs')->max('id');
+            
+            $data = [
+                'id' => $maxId + 1,
+                'name' => $request->name,
+                'config_key' => $request->config_key ?: $request->name,
+                'config_value' => $request->config_value,
+                'type' => 'cash',
+                'status' => $request->status,
+                'sort' => (int)($request->sort ?: 0),
+                'remarks' => $request->remarks ?: '',
+                'admin_id' => session('admin')['id'],
+                'created_at' => date('Y-m-d H:i:s'),
+                'updated_at' => date('Y-m-d H:i:s'),
+            ];
+            
+            try {
+                DB::table('agent.dbo.admin_configs')->insert($data);
+                return apiReturnSuc();
+            } catch (\Exception $e) {
+                return apiReturnFail('添加失败:' . $e->getMessage());
+            }
+        }
+    }
+    
+    // 修改提现渠道
+    public function cashier_channel_update(Request $request, $id)
+    {
+        if ($request->isMethod('get')) {
+            $info = DB::table('agent.dbo.admin_configs')
+                ->where('id', $id)
+                ->where('type', 'cash')
+                ->first();
+            
+            if (!$info) {
+                return redirect()->back()->with('error', '渠道不存在');
+            }
+            
+            return view('admin.Withdrawal.cashier_channel_update', ['info' => $info]);
+        } else {
+            // POST 提交
+            $validator = Validator::make($request->all(), [
+                'name' => 'required',
+                'config_value' => 'required',
+                'status' => 'required|in:1,-1',
+            ]);
+            
+            if ($validator->fails()) {
+                return apiReturnFail($validator->errors()->first());
+            }
+            
+            $data = [
+                'name' => $request->name,
+                'config_key' => $request->config_key ?: $request->name,
+                'config_value' => $request->config_value,
+                'status' => $request->status,
+                'sort' => (int)($request->sort ?: 0),
+                'remarks' => $request->remarks ?: '',
+                'admin_id' => session('admin')['id'],
+                'updated_at' => date('Y-m-d H:i:s'),
+            ];
+            
+            try {
+                DB::table('agent.dbo.admin_configs')
+                    ->where('id', $id)
+                    ->where('type', 'cash')
+                    ->update($data);
+                return apiReturnSuc();
+            } catch (\Exception $e) {
+                return apiReturnFail('修改失败:' . $e->getMessage());
+            }
+        }
+    }
+
     // 免审开关
     public function block(Request $request, $id)
     {

+ 7 - 2
app/Http/Controllers/Api/WiwiPayController.php

@@ -7,6 +7,8 @@ use App\Http\logic\api\WiwiPayCashierLogic;
 use App\Inter\PayMentInterFace;
 use App\Notification\TelegramBot;
 use App\Services\WiwiPay;
+use App\Services\PayConfig;
+use App\Services\PayUtils;
 use App\Util;
 use Illuminate\Http\Request;
 use Illuminate\Support\Facades\Log;
@@ -106,10 +108,13 @@ class WiwiPayController implements PayMentInterFace
 
         Util::WriteLog('WiwiPay', "WiwiPay cash 异步回调\n" . $payload);
 
-        $service = new WiwiPay();
+        // ✅ 使用 WiwiPayOut 配置进行验签
+        $payConfigService = new PayConfig();
+        $config = $payConfigService->getConfig('WiwiPayOut');
+        $apiKey = $config['key'];
         
         try {
-            $verify = $service->verifySign($post);
+            $verify = PayUtils::verifySign($post, $apiKey);
         } catch (\Exception $e) {
             Util::WriteLog('WiwiPay cash', '验签失败:' . $e->getMessage());
             return 'fail';

+ 213 - 50
app/Http/logic/api/WiwiPayCashierLogic.php

@@ -2,14 +2,19 @@
 
 namespace App\Http\logic\api;
 
+use App\dao\Estatisticas\RechargeWithDraw;
 use App\Http\helper\NumConfig;
 use App\Inter\CashierInterFace;
 use App\Models\PrivateMail;
+use App\Models\RecordUserDataStatistics;
 use App\Services\WiwiPay;
 use App\Services\PayConfig;
+use App\Services\PayUtils;
+use App\Services\StoredProcedure;
 use App\Util;
 use Illuminate\Support\Facades\DB;
 use Illuminate\Support\Facades\Log;
+use Illuminate\Support\Facades\Redis;
 
 class WiwiPayCashierLogic implements CashierInterFace
 {
@@ -22,31 +27,43 @@ class WiwiPayCashierLogic implements CashierInterFace
         $query = DB::connection('write')->table('QPAccountsDB.dbo.OrderWithDraw')->where('RecordID', $RecordID)->first();
         if (!$query) return 'fail';    // 订单不存在
 
-        $service = new WiwiPay();
-        $config = $service->config;
-
+        $payConfigService = new PayConfig();
+        $config = $payConfigService->getConfig('WiwiPayOut');
+        $wayCode = [
+            1 => 'ecashapp',
+            2 => 'paypal'
+        ];
+        $wayParam = [];
+        if($PixType == 1){
+            $wayParam = ["cashtag" => $PixNum];
+        }
+        if($PixType == 2){
+            $wayParam = ["email" => $email];
+        }
         // 构建提现请求参数
         $params = [
-            "mchNo" => $service->mchNo,
+            "mchNo" => $config['mchNo'] ?? '',
             "mchOrderNo" => $OrderId,
             "amount" => intval($amount),
             "currency" => $config['currency'] ?? "usd",
-            "accountName" => $accountName,
-            "accountNo" => $phone, // 根据实际情况调整
-            "notifyUrl" => $config['cashNotify'] ?? $config['notify'] ?? '',
+            "wayCode" => $wayCode[$PixType],
+            "notifyUrl" => $config['cashNotify'],
+            "wayParam" => $wayParam,
             "timestamp" => round(microtime(true) * 1000),
             "signType" => $config['signType'] ?? "MD5"
         ];
 
-        // 签名
-        $signedParams = $service->sign($params);
+        // 直接使用 PayUtils 签名(使用 WiwiPayOut 的 key)
+        $apiKey = $config['key'];
+        $signedParams = PayUtils::sign($params, $apiKey);
 
-        $url = $config['cash_url'] ?? $service->apiUrl;
+        $url = $config['apiUrl'];
 
         Log::info('WiwiPay 提现参数:', $signedParams);
         
         try {
-            $result = $service->curlPost($url, $signedParams);
+            // 使用独立的 curlPost 方法发送请求
+            $result = $this->curlPost($url, $signedParams);
         } catch (\Exception $exception) {
             Log::info('WiwiPay 提现请求异常:', [$exception->getMessage()]);
             return 'fail';
@@ -61,7 +78,7 @@ class WiwiPayCashierLogic implements CashierInterFace
             return 'fail';
         }
 
-        if (isset($data['status'])) {
+        if (isset($data['code']) && $data['code'] == 0) {
             return $data;
         } else {
             if ($query->State == 5) {
@@ -72,11 +89,11 @@ class WiwiPayCashierLogic implements CashierInterFace
 
                 PrivateMail::failMail($query->UserID, $OrderId, $WithDraw, $msg, $bonus);
 
-                $data = [
-                    'updated_at' => date('Y-m-d H:i:s'),
-                    'State' => 5,
-                ];
-                DB::connection('write')->table('QPAccountsDB.dbo.OrderWithDraw')->where('RecordID', $RecordID)->update($data);
+                $withdraw_data = ['State' => 6, 'agent' => $this->agent, 'finishDate' => now(),'remark' => json_encode($data)];
+                DB::connection('write')->table('QPAccountsDB.dbo.OrderWithDraw')->where('OrderId', $query->OrderId)->update($withdraw_data);
+                
+                $RecordData = ['after_state' => 6, 'update_at' => now()];
+                DB::connection('write')->table('QPAccountsDB.dbo.AccountsRecord')->where('type', 1)->where('RecordID', $RecordID)->update($RecordData);
             }
             return 'fail';
         }
@@ -84,48 +101,194 @@ class WiwiPayCashierLogic implements CashierInterFace
 
     public function notify($post)
     {
-        $OrderId = $post['mchOrderNo'] ?? '';
+        if (!is_array($post)) $post = \GuzzleHttp\json_decode($post, true);
         
         Util::WriteLog('WiwiPay', 'WiwiPay 提现回调:' . json_encode($post));
 
-        // 查询订单号
-        $query = DB::connection('write')->table('QPAccountsDB.dbo.OrderWithDraw')->where('OrderID', $OrderId)->first();
-        if (!$query) {
-            return 'fail';    // 订单不存在
-        }
+        try {
+            // 判断订单是否存在
+            $OrderId = $post['mchOrderNo'] ?? '';
+            $query = DB::connection('write')->table('QPAccountsDB.dbo.OrderWithDraw')->where('OrderId', $OrderId)->first();
+
+            if (!$query) {
+                Util::WriteLog('WiwiPay','订单不存在');
+                return '{"success":true,"message":"Accepted"}';
+            }
 
-        $orderStatus = $post['status'] ?? $post['orderStatus'] ?? '';
+            if ($query->State != 5 && $query->State != 7) {
+                Util::WriteLog('WiwiPay',$OrderId.'_订单状态已完成');
+                return 'SUCCESS';
+            }
+
+            $agentID = DB::connection('write')->table('agent.dbo.admin_configs')
+                ->where('config_value', self::AGENT)
+                ->where('type', 'cash')
+                ->select('id')
+                ->first()->id ?? '';
 
-        if ($orderStatus == 'SUCCESS' || $orderStatus == 'PAID' || $orderStatus == 2) {
-            // 订单成功
-            $data = [
-                'updated_at' => date('Y-m-d H:i:s'),
-                'State' => 2,
+            $now = now();
+            $notify_data = [
+                'state' => 1,
+                'finish_at' => $now,
+                'casOrdNo' => $post['mchOrderNo'] ?? '',
+                'extra' => \GuzzleHttp\json_encode($post),
+                'created_at' => $now,
+                'updated_at' => $now,
+                'order_sn' => $OrderId,
+                'amount' => $query->WithDraw,
             ];
-            DB::connection('write')->table('QPAccountsDB.dbo.OrderWithDraw')->where('OrderID', $OrderId)->update($data);
+            //state
+            //0-订单生成
+            //1-支付中
+            //2-支付成功
+            //3-支付失败
+            //4-已撤销
+            //5-已退款
+            //6-订单关闭
+
+            // 判断订单状态
+            $orderStatus = 0;
+            if (isset($post['state'])) {
+                // state: 2=成功, 3=失败
+                if ($post['state'] == 2) {
+                    $orderStatus = 1; // 成功
+                } elseif ($post['state'] == 3) {
+                    $orderStatus = 2; // 失败
+                }
+            }
+
+            if (!$orderStatus) {
+                Util::WriteLog('WiwiPay', 'WiwiPay 提现处理中:' . $OrderId);
+                return 'success';
+            }
+
+            Util::WriteLog('WiwiPay', 'WiwiPay 提现结果:' . $OrderId . '_' . $orderStatus);
             
-            Util::WriteLog('WiwiPay', 'WiwiPay 提现成功:' . $OrderId);
-            return 'SUCCESS';
-        } else if ($orderStatus == 'REJECTED' || $orderStatus == 'FAILED' || $orderStatus == 3) {
-            // 订单失败,退还金币
-            $msg = 'Liquidation failure';
-            $WithDraw = $query->WithDraw + $query->ServiceFee;
-            $bonus = '30000,' . $WithDraw;
-
-            PrivateMail::failMail($query->UserID, $OrderId, $WithDraw, $msg, $bonus);
-
-            $data = [
-                'updated_at' => date('Y-m-d H:i:s'),
-                'State' => 5,
+            $UserID = $query->UserID;
+            $TakeMoney = $query->WithDraw + $query->ServiceFee;
+
+
+            switch ($orderStatus) {
+                case 1: // 提现成功
+                    Util::WriteLog('WiwiPay', 'WiwiPay提现成功');
+
+                    $withdraw_data = [
+                        'State' => 2,
+                        'agent' => $agentID,
+                        'finishDate' => $now
+                    ];
+
+                    // 增加提现记录
+                    $first = DB::connection('write')->table('QPAccountsDB.dbo.UserTabData')->where('UserID', $UserID)->first();
+                    if ($first) {
+                        DB::connection('write')->table('QPAccountsDB.dbo.UserTabData')->where('UserID', $UserID)->increment('TakeMoney', $TakeMoney);
+                    } else {
+                        DB::connection('write')->table('QPAccountsDB.dbo.UserTabData')->insert(['TakeMoney' => $TakeMoney, 'UserID' => $UserID]);
+                        try {
+                            PrivateMail::praiseSendMail($UserID);
+                        } catch (\Exception $e) {
+                            // 忽略邮件发送失败
+                        }
+                    }
+
+                    // 免审的时候,修改免审状态
+                    $withdrawal_position_log = DB::connection('write')->table('agent.dbo.withdrawal_position_log')->where('order_sn', $OrderId)->first();
+                    if ($withdrawal_position_log) {
+                        DB::connection('write')->table('agent.dbo.withdrawal_position_log')->where('order_sn', $OrderId)->update(['take_effect' => 2, 'update_at' => date('Y-m-d H:i:s')]);
+                    }
+
+                    try {
+                        StoredProcedure::addPlatformData($UserID, 4, $TakeMoney);
+                    } catch (\Exception $exception) {
+                        Util::WriteLog('StoredProcedure', $exception);
+                    }
+
+                    $ServiceFee = $query->ServiceFee;
+                    // 增加用户提现值
+                    RecordUserDataStatistics::updateOrAdd($UserID, $TakeMoney, 0, $ServiceFee);
+
+                    // 数据统计后台 -- 提现记录添加
+                    (new RechargeWithDraw())->withDraw($UserID, $TakeMoney);
+
+                    $redis = Redis::connection();
+                    $redis->incr('draw_' . date('Ymd') . $UserID);
+                    break;
+
+                case 2: // 提现失败
+                    $msg = 'Encomenda rejeitada pelo banco';
+                    $bonus = '30000,' . $TakeMoney;
+                    PrivateMail::failMail($query->UserID, $OrderId, $TakeMoney, $msg, $bonus);
+                    
+                    Util::WriteLog('WiwiPayEmail', [$query->UserID, $OrderId, $TakeMoney, $msg, $bonus]);
+                    $withdraw_data = ['State' => 6, 'agent' => $agentID, 'remark' => @$post['errMsg'] ?: ''];
+                    $notify_data = ['state' => 2];
+                    break;
+            }
+
+            $RecordData = [
+                'before_state' => $query->State,
+                'after_state' => $withdraw_data['State'] ?? 0,
+                'RecordID' => $query->RecordID,
+                'update_at' => date('Y-m-d H:i:s')
             ];
-            DB::connection('write')->table('QPAccountsDB.dbo.OrderWithDraw')->where('OrderID', $OrderId)->update($data);
+
+            // 添加用户提现操作记录
+            DB::connection('write')->table('QPAccountsDB.dbo.AccountsRecord')->updateOrInsert(['RecordID' => $query->RecordID, 'type' => 1], $RecordData);
+            DB::connection('write')->table('QPAccountsDB.dbo.withdraw_notify')->updateOrInsert(['order_sn' => $OrderId], $notify_data);
+            DB::connection('write')->table('QPAccountsDB.dbo.OrderWithDraw')->where('OrderId', $query->OrderId)->update($withdraw_data);
+
+            if (isset($withdraw_data['State']) && $withdraw_data['State'] == 2) {
+                // 单控标签
+                StoredProcedure::user_label($UserID, 2, $TakeMoney);
+            }
             
-            Util::WriteLog('WiwiPay', 'WiwiPay 提现失败:' . $OrderId);
-            return 'SUCCESS';
-        } else {
-            // 处理中
-            Util::WriteLog('WiwiPay', 'WiwiPay 提现处理中:' . $OrderId . ' status:' . $orderStatus);
-            return 'SUCCESS';
+            return 'success';
+
+        } catch (\Exception $exception) {
+            Util::WriteLog('WiwiPay', 'WiwiPay异步业务逻辑处理失败:' . $exception->getMessage());
+            return '{"success":false,"message":"商户自定义出错信息"}';
         }
     }
+
+    /**
+     * POST请求方法(复用 WiwiPay 的实现)
+     */
+    private function curlPost($url, $payload)
+    {
+        $timeout = 20;
+        $data = json_encode($payload, JSON_UNESCAPED_UNICODE);
+        
+        $headers = [
+            'Content-Type: application/json',
+        ];
+
+        $ch = curl_init();
+        curl_setopt($ch, CURLOPT_URL, $url);
+        curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, false);
+        curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
+        curl_setopt($ch, CURLOPT_POST, 1);
+        curl_setopt($ch, CURLOPT_POSTFIELDS, $data);
+        curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, $timeout);
+        curl_setopt($ch, CURLOPT_TIMEOUT, $timeout);
+        curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
+        curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
+
+        $httpCode = curl_getinfo($ch, CURLINFO_HTTP_CODE);
+        $result = curl_exec($ch);
+
+        if (curl_errno($ch)) {
+            $error = curl_error($ch);
+            Util::WriteLog('WiwiPay_error', 'CURL Error: ' . $error);
+            curl_close($ch);
+            return false;
+        }
+
+        if (strstr($result, 'code') || $httpCode != 200) {
+            // 可选:记录错误日志
+        }
+
+        curl_close($ch);
+        return $result;
+    }
 }
+

+ 1 - 71
app/Services/CashService.php

@@ -3,29 +3,7 @@
 
 namespace App\Services;
 
-
-use App\Http\logic\api\AegPayCashierLogic;
-use App\Http\logic\api\ApcopayCashierLogic;
-use App\Http\logic\api\CashPayCashierLogic;
-use App\Http\logic\api\ClickPayCashierLogic;
-use App\Http\logic\api\HHPayColCashierLogic;
-use App\Http\logic\api\KaroPayCashierLogic;
-use App\Http\logic\api\LQPayCashierLogic;
-use App\Http\logic\api\PPayCashierLogic;
-use App\Http\logic\api\RussiaPayCashierLogic;
-use App\Http\logic\api\SitoBankCashierLogic;
 use App\Http\logic\api\WiwiPayCashierLogic;
-use App\Http\logic\api\SmartFastColCashierLogic;
-use App\Http\logic\api\SmartFastPayCashierLogic;
-use App\Http\logic\api\SmartFastPeruCashierLogic;
-use App\Http\logic\api\StanPayCashierLogic;
-use App\Http\logic\api\StarpagoBDCashierLogic;
-use App\Http\logic\api\StarpagoCashierLogic;
-use App\Http\logic\api\TopPayCashierLogic;
-use App\Http\logic\api\WWPayColCashierLogic;
-use App\Http\logic\api\DoPayCashierLogic;
-use App\Http\logic\api\PKpayCashierLogic;
-use App\Http\logic\api\ALL2payCashierLogic;
 
 
 class CashService
@@ -34,57 +12,9 @@ class CashService
     {
         switch ($val) {
 
-            case StarpagoBDCashierLogic::AGENT:
-                return new StarpagoBDCashierLogic();
-            case ClickPayCashierLogic::AGENT:
-                return new ClickPayCashierLogic();
-            case ApcopayCashierLogic::AGENT:
-                return new ApcopayCashierLogic();
-            case TopPayCashierLogic::AGENT:
-                return new TopPayCashierLogic();
-            case CashPayCashierLogic::AGENT:
-                return new CashPayCashierLogic();
-            case SitoBankCashierLogic::AGENT:
-                return new SitoBankCashierLogic();
+
             case WiwiPayCashierLogic::AGENT:
                 return new WiwiPayCashierLogic();
-            case AegPayCashierLogic::AGENT:
-                return new AegPayCashierLogic();
-            case StanPayCashierLogic::AGENT:
-                return new StanPayCashierLogic();
-            case SmartFastPayCashierLogic::AGENT:
-                return new SmartFastPayCashierLogic();
-
-            case LQPayCashierLogic::AGENT:
-                return new LQPayCashierLogic();
-
-            case RussiaPayCashierLogic::AGENT:
-                return new RussiaPayCashierLogic();
-
-            case PPayCashierLogic::AGENT:
-                return new PPayCashierLogic();
-
-            case SmartFastPeruCashierLogic::AGENT:
-                return new SmartFastPeruCashierLogic();
-            case SmartFastColCashierLogic::AGENT:
-                return new SmartFastColCashierLogic();
-
-            case HHPayColCashierLogic::AGENT:
-                return new HHPayColCashierLogic();
-
-            case WWPayColCashierLogic::AGENT:
-                return new WWPayColCashierLogic();
-
-            case StarpagoCashierLogic::AGENT:
-                return new StarpagoCashierLogic();
-            case DoPayCashierLogic::AGENT:
-                return new DoPayCashierLogic();
-            case PKpayCashierLogic::AGENT:
-                return new PKpayCashierLogic();
-            case ALL2payCashierLogic::AGENT:
-                return new ALL2payCashierLogic();
-            case KaroPayCashierLogic::AGENT:
-                return new KaroPayCashierLogic();
 
         }
     }

+ 9 - 0
config/pay.php

@@ -27,6 +27,15 @@ return [
         'payin_fee' => 0.15,
         'notify' => env('APP_URL', '').'/api/wiwipay/notify',
         'return' => env('APP_URL', '').'/api/wiwipay/return',
+    ],
+    'WiwiPayOut' => [
+        'key' => 'AX2w17jpU06y5bPQc3d33Z6F4XbfoHnN',
+        'mchNo' => '2025103753',
+        'apiUrl' => 'https://www.wiwiusonepayout.com/api/transfer/create',
+        'currency' => 'usd',
+        'wayCode' => 'cashapp',
+        'signType' => 'MD5',
+        'payout_fee' => 0.15,
         'cashNotify' => env('APP_URL', '').'/api/wiwipay/payout_notify',
         'cash_url' => env('APP_URL', '').'/api/payout/create'
     ]

+ 76 - 14
resources/views/admin/Withdrawal/exempt_review_update.blade.php

@@ -117,19 +117,82 @@
                                         checked
                                     @endif> {{ __('auto.关闭') }}</label>
                                 </div>
-                                <div style="margin-top: 10px">
-                                    <span>{{ __('auto.请选择一个代付方') }}</span>
-                                    @foreach($agent as $val)
-                                        <div class="radio">
-                                            <label>
-                                                <input type="radio" value="{{$val->config_value}}" name="agent" @if ($info->agent == $val->config_value)
-                                                checked
-                                                    @endif>
-
-                                                {{$val->name}}
-                                            </label>
-                                        </div>
-                                    @endforeach
+                                <div class="form-group" style="margin-top: 20px;">
+                                    <label><h4>{{ __('auto.代付渠道配置') }}</h4></label>
+                                    <p class="text-muted">{{ __('auto.以下为当前可用的代付渠道及其权重比例(从admin_configs表读取)') }}</p>
+                                    
+                                    <div class="table-responsive">
+                                        <table class="table table-bordered table-striped">
+                                            <thead class="bg-light">
+                                                <tr>
+                                                    <th width="30%">{{ __('auto.渠道名称') }}</th>
+                                                    <th width="20%">{{ __('auto.渠道值') }}</th>
+                                                    <th width="20%">{{ __('auto.权重比例') }}(%)</th>
+                                                    <th width="15%">{{ __('auto.状态') }}</th>
+                                                    <th width="15%">{{ __('auto.修改人') }}</th>
+                                                </tr>
+                                            </thead>
+                                            <tbody>
+                                                @php
+                                                    $totalSort = 0;
+                                                    $activeCount = 0;
+                                                @endphp
+                                                @foreach($agent as $val)
+                                                    @php
+                                                        if ($val->status == 1) {
+                                                            $totalSort += $val->sort;
+                                                            $activeCount++;
+                                                        }
+                                                    @endphp
+                                                    <tr class="{{ $val->status == 1 ? 'table-success' : 'table-secondary' }}">
+                                                        <td><strong>{{ $val->name }}</strong></td>
+                                                        <td>{{ $val->config_value }}</td>
+                                                        <td>
+                                                            <span class="badge badge-{{ $val->status == 1 ? 'primary' : 'secondary' }} badge-pill" style="font-size: 14px;">
+                                                                {{ $val->sort }}%
+                                                            </span>
+                                                        </td>
+                                                        <td>
+                                                            @if($val->status == 1)
+                                                                <span class="badge badge-success">{{ __('auto.开启') }}</span>
+                                                            @else
+                                                                <span class="badge badge-danger">{{ __('auto.关闭') }}</span>
+                                                            @endif
+                                                        </td>
+                                                        <td>{{ $val->admin_id ?? '-' }}</td>
+                                                    </tr>
+                                                @endforeach
+                                            </tbody>
+                                            <tfoot>
+                                                <tr class="bg-light">
+                                                    <td colspan="2" class="text-right"><strong>{{ __('auto.开启渠道权重总和') }}:</strong></td>
+                                                    <td>
+                                                        <strong class="text-{{ $totalSort == 100 ? 'success' : 'danger' }}" style="font-size: 16px;">
+                                                            {{ $totalSort }}%
+                                                            @if($totalSort == 100)
+                                                                <i class="mdi mdi-check-circle text-success"></i>
+                                                            @else
+                                                                <i class="mdi mdi-alert-circle text-danger"></i>
+                                                            @endif
+                                                        </strong>
+                                                    </td>
+                                                    <td colspan="2">
+                                                        <small class="text-muted">{{ __('auto.已开启') }}: {{ $activeCount }} {{ __('auto.个渠道') }}</small>
+                                                    </td>
+                                                </tr>
+                                            </tfoot>
+                                        </table>
+                                    </div>
+                                    
+                                    <div class="alert alert-info" role="alert">
+                                        <i class="mdi mdi-information"></i>
+                                        <strong>{{ __('auto.说明') }}:</strong>
+                                        <ul class="mb-0">
+                                            <li>{{ __('auto.代付渠道配置从 admin_configs 表中读取,在') }} <a href="/admin/recharge/config/cash" target="_blank">{{ __('auto.代付渠道管理') }}</a> {{ __('auto.中进行修改') }}</li>
+                                            <li>{{ __('auto.系统会根据开启渠道的权重比例自动分配代付任务') }}</li>
+                                            <li>{{ __('auto.开启的渠道权重总和应为 100%') }}</li>
+                                        </ul>
+                                    </div>
                                 </div>
                                 <button type="button" onclick="commit({{ $info->id }})"
                                         class="btn btn-sm btn-gradient-primary btn-icon-text">
@@ -150,7 +213,6 @@
     </div>
     <script>
 
-
         function commit(id) {
             if (!checkForm()) {
                 return false;

+ 4 - 0
routes/web.php

@@ -196,6 +196,7 @@ Route::group([
         $route->get('/exchange/cost', 'Admin\ExchangeController@costList');
         $route->post('/cost/update/{id}', 'Admin\ExchangeController@costUpdate');
         //充值管理
+        $route->get('/recharge/config/cash', 'Admin\WithdrawalController@cashier_channel_config')->name('admin.cashier.config');
         $route->get('/recharge/list/{history?}', 'Admin\RechargeController@rechargeList');
         $route->get('/recharge/rank', 'Admin\RechargeController@rechargeRank');
         $route->get('/recharge/game_card_config', 'Admin\RechargeController@gameCardConfig');
@@ -504,6 +505,9 @@ Route::group([
         $route->get('/withdrawal/exempt_review', 'Admin\WithdrawalController@exempt_review');
         $route->any('/withdrawal/exempt_review_add', 'Admin\WithdrawalController@exempt_review_add');
         $route->any('/withdrawal/exempt_review_update/{id}', 'Admin\WithdrawalController@exempt_review_update');
+        $route->any('/withdrawal/cashier_channel_config', 'Admin\WithdrawalController@cashier_channel_config');
+        $route->any('/withdrawal/cashier_channel_add', 'Admin\WithdrawalController@cashier_channel_add');
+        $route->any('/withdrawal/cashier_channel_update/{id}', 'Admin\WithdrawalController@cashier_channel_update');
         $route->any('/withdrawal/block/{id}', 'Admin\WithdrawalController@block');
         $route->any('/withdrawal/locking/{id}', 'Admin\WithdrawalController@locking');
         $route->any('/withdrawal/turn_down', 'Admin\WithdrawalController@turn_down');