seven 1 hafta önce
ebeveyn
işleme
fa842dc401

+ 5 - 2
app/Http/Controllers/admin/Wallet.php

@@ -19,6 +19,7 @@ use App\Services\IssueService;
 use App\Services\GameplayRuleService;
 use App\Models\Config;
 use App\Services\ConfigService;
+use App\Services\Payment\SanJinService;
 
 class Wallet extends Controller
 {
@@ -277,9 +278,11 @@ class Wallet extends Controller
         // $url = "https://ydpc28.co/api/pc28/list";
         // $result = file_get_contents($url);
         // $result = json_decode($result,true);
-        $awards = IssueService::award([7,7,7]);
-        $result = BetService::betSettled2('3356003',$awards);
+        // $awards = IssueService::award([7,7,7]);
+        // $result = BetService::betSettled2('3356003',$awards);
         // $result = IssueService::sendLotteryImage($memberId, 3356000);
+
+        $result = SanJinService::findBalance();
         echo "<pre>";
         var_dump($result);
     }

+ 19 - 0
app/Services/BaseService.php

@@ -348,4 +348,23 @@ class BaseService
         return $start . str_repeat("*", $hideCount) . $end;
     }
 
+    // 生成订单号
+    public static function createOrderNo($prefix = 'pc28_',$memberId = null)
+    {
+         // 处理会员ID,获取后四位
+        if ($memberId) {
+            $memberSuffix = str_pad(substr($memberId, -4), 4, '0', STR_PAD_LEFT);
+        } else {
+            $memberSuffix = '0000'; // 默认值
+        }
+        
+        // 时间部分
+        $timePart = date('YmdHis');
+        
+        // 随机部分增加唯一性
+        $randomPart = mt_rand(1000, 9999);
+        
+        return $prefix . $timePart . $randomPart . $memberSuffix;
+    }
+
 }

+ 46 - 0
app/Services/Payment/SanJinService.php

@@ -0,0 +1,46 @@
+<?php
+
+namespace App\Services\Payment;
+
+use GuzzleHttp\Client;
+use GuzzleHttp\Exception\RequestException;
+use GuzzleHttp\Psr7\Response;
+use App\Services\BaseService;
+
+class SanJinService extends BaseService
+{
+    // SanJin payment service methods would go here
+    const REQUEST_URL = 'https://api.qbdf13.com/';
+
+    
+    /**
+     * @description: 获取请求客户端
+     * @return {*}
+     */
+    public static function getClient(): Client
+    {
+        return new Client([
+            'base_uri' => self::REQUEST_URL,
+            'timeout' => 5.0,
+        ]);
+    }
+
+    // 查询商户余额
+    public static function findBalance()
+    {
+        $merchant_id  = config('app.tree_payment_merchant_id');
+        $secret = config('app.tree_payment_secret');
+        $sign = md5($merchant_id . $secret);
+        $data = [
+            'merchantNum' => $merchant_id,
+            'sign' => $sign,
+        ];
+
+        $client = self::getClient();
+        $response = $client->get('api/findBalance', [
+            'query' => $data,
+        ]);
+        $body = $response->getBody();
+        return json_decode($body->getContents(), true);
+    }
+}

+ 4 - 0
config/app.php

@@ -7,6 +7,10 @@ return [
     'usdt_address' => env('USDT_ADDRESS',''),
     'trx_private_key' => env('TRX_PRIVATE_KEY',''),
     'tron_network' => env('TRON_NETWORK','main'),
+
+    // 第三方支付配置
+    'tree_payment_merchant_id' => env('TREE_PAYMENT_MERCHANT_ID',''),
+    'tree_payment_secret' => env('TREE_PAYMENT_SECRET',''),
     /*
     |--------------------------------------------------------------------------
     | Application Name