1.重构实时消息WebSocket连接

2.MySQL备份
This commit is contained in:
2026-04-24 13:49:38 +08:00
parent d69412a0f7
commit fd324f2882
54 changed files with 2396 additions and 2638 deletions

View File

@@ -1,39 +0,0 @@
<?php
declare(strict_types=1);
namespace app\common\library\admin;
/**
* 后台推送测试页:读取 webman/push 配置(与 game/Live::pushConfig 口径一致)
*/
final class PushChannelConfigHelper
{
public static function wsBaseUrl(): string
{
$client = trim((string) config('plugin.webman.push.app.websocket_client'));
if ($client !== '') {
return self::normalizeClientWsBase($client);
}
$ws = (string) config('plugin.webman.push.app.websocket');
$ws = str_replace('websocket://', 'ws://', $ws);
return str_replace('0.0.0.0', '127.0.0.1', $ws);
}
private static function normalizeClientWsBase(string $url): string
{
$url = rtrim(trim($url), '/');
if (str_starts_with($url, 'websocket://')) {
return str_replace('websocket://', 'ws://', $url);
}
return $url;
}
public static function appKey(): string
{
return (string) config('plugin.webman.push.app.app_key');
}
}

View File

@@ -0,0 +1,18 @@
<?php
declare(strict_types=1);
namespace app\common\library\admin;
final class WebSocketConfigHelper
{
public static function wsUrl(): string
{
$url = trim((string) env('H5_WEBSOCKET_URL', ''));
if ($url !== '') {
return $url;
}
return 'ws://127.0.0.1:3131';
}
}

View File

@@ -4,6 +4,7 @@ declare(strict_types=1);
namespace app\common\library\finance;
use app\common\service\GameWebSocketEventBus;
use RuntimeException;
use support\think\Db;
use Throwable;
@@ -183,6 +184,14 @@ final class DepositSettlement
throw new RuntimeException($e->getMessage());
}
GameWebSocketEventBus::publish('wallet.changed', [
'user_id' => $userId,
'balance_after' => $balanceAfter,
'biz_type' => 'deposit',
'order_no' => $orderNo,
'changed_at' => $now,
]);
return [
'order_id' => $orderId,
'order_no' => $orderNo,