1.优化实时对局页面样式以及自动创建下一局和作废本局的记录
2.新增派彩达到game_config.jackpot_max_amount必须审核才能发放 3.新增游戏对局记录-查看游玩记录btn 3.备份MySQL数据库
This commit is contained in:
@@ -47,30 +47,25 @@ final class GameHotDataRedis
|
||||
if ($configKey === '') {
|
||||
return null;
|
||||
}
|
||||
if (array_key_exists($configKey, self::$gcLocal)) {
|
||||
$cachedLocal = self::$gcLocal[$configKey];
|
||||
return is_array($cachedLocal) ? $cachedLocal : null;
|
||||
}
|
||||
// game_config 为全局配置,多进程/多 worker 间必须强一致;
|
||||
// 因此不使用进程内本地缓存(gcLocal),避免某个进程读到旧值导致前端回弹/行为冲突。
|
||||
if (self::enabled()) {
|
||||
$cached = self::redisGet(self::KEY_GC . $configKey);
|
||||
if ($cached !== null && $cached !== '') {
|
||||
$decoded = json_decode($cached, true);
|
||||
if (is_array($decoded)) {
|
||||
self::$gcLocal[$configKey] = $decoded;
|
||||
return $decoded;
|
||||
}
|
||||
}
|
||||
}
|
||||
$row = Db::name('game_config')->where('config_key', $configKey)->find();
|
||||
if (!$row) {
|
||||
self::$gcLocal[$configKey] = null;
|
||||
return null;
|
||||
}
|
||||
if (self::enabled()) {
|
||||
$ttl = self::intConfig('ttl_game_config', 86400);
|
||||
self::redisSetEx(self::KEY_GC . $configKey, $ttl, json_encode($row, JSON_UNESCAPED_UNICODE));
|
||||
}
|
||||
self::$gcLocal[$configKey] = $row;
|
||||
return $row;
|
||||
}
|
||||
|
||||
@@ -88,17 +83,24 @@ final class GameHotDataRedis
|
||||
*/
|
||||
public static function gameConfigReplaceFromDb(string $configKey): void
|
||||
{
|
||||
if ($configKey === '' || !self::enabled()) {
|
||||
if ($configKey === '') {
|
||||
return;
|
||||
}
|
||||
// 无论是否启用 Redis 热点缓存,都要刷新进程内缓存,避免同一 worker 读到旧值
|
||||
$row = Db::name('game_config')->where('config_key', $configKey)->find();
|
||||
if (!$row) {
|
||||
self::gameConfigForget($configKey);
|
||||
self::$gcLocal[$configKey] = null;
|
||||
if (self::enabled()) {
|
||||
self::redisDel(self::KEY_GC . $configKey);
|
||||
}
|
||||
return;
|
||||
}
|
||||
$ttl = self::intConfig('ttl_game_config', 86400);
|
||||
self::redisSetEx(self::KEY_GC . $configKey, $ttl, json_encode($row, JSON_UNESCAPED_UNICODE));
|
||||
|
||||
self::$gcLocal[$configKey] = $row;
|
||||
if (self::enabled()) {
|
||||
$ttl = self::intConfig('ttl_game_config', 86400);
|
||||
self::redisSetEx(self::KEY_GC . $configKey, $ttl, json_encode($row, JSON_UNESCAPED_UNICODE));
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user