1.优化game_config
2.备份MySQL数据库
This commit is contained in:
@@ -60,7 +60,8 @@ class Game extends MobileBase
|
||||
'bet_config' => [
|
||||
'pick_max_number_count' => $this->getPickMaxNumberCount(),
|
||||
'chips' => ['1.00', '5.00', '10.00', '25.00', '50.00', '100.00'],
|
||||
'single_number_max_bet' => $this->getConfigValue('single_number_max_bet', '500.00'),
|
||||
'min_bet_per_number' => $this->getConfigValue('min_bet_per_number', '0.0100'),
|
||||
'max_bet_per_number' => $this->getConfigValue('max_bet_per_number', '10000.0000'),
|
||||
],
|
||||
'dictionary' => $items,
|
||||
'user_snapshot' => [
|
||||
@@ -154,6 +155,17 @@ class Game extends MobileBase
|
||||
return $this->mobileError(1003, 'Invalid parameter value');
|
||||
}
|
||||
$singleAmount = bcadd($singleBetAmount, '0', 2);
|
||||
$minPer = trim((string) $this->getConfigValue('min_bet_per_number', '0.0100'));
|
||||
$maxPer = trim((string) $this->getConfigValue('max_bet_per_number', '10000.0000'));
|
||||
if (!is_numeric($minPer) || bccomp($minPer, '0', 4) <= 0) {
|
||||
$minPer = '0.0100';
|
||||
}
|
||||
if (!is_numeric($maxPer) || bccomp($maxPer, $minPer, 4) < 0) {
|
||||
$maxPer = '10000.0000';
|
||||
}
|
||||
if (bccomp($singleAmount, $minPer, 4) < 0 || bccomp($singleAmount, $maxPer, 4) > 0) {
|
||||
return $this->mobileError(1003, 'Bet amount out of range');
|
||||
}
|
||||
$numberCount = (string) count($numbers);
|
||||
$totalAmount = bcmul($singleAmount, $numberCount, 2);
|
||||
|
||||
|
||||
@@ -25,6 +25,15 @@ final class GameHotDataRedis
|
||||
|
||||
private const KEY_USER = 'dfw:v1:user:';
|
||||
|
||||
/**
|
||||
* 进程内实例化缓存(避免同一请求/进程内重复打 Redis/DB)。
|
||||
* - key => null:表示已确认不存在(负缓存)
|
||||
* - key => array:表示已加载行数据
|
||||
*
|
||||
* @var array<string, array<string, mixed>|null>
|
||||
*/
|
||||
private static array $gcLocal = [];
|
||||
|
||||
public static function enabled(): bool
|
||||
{
|
||||
return config('game_hot_cache.enabled', true) === true;
|
||||
@@ -38,23 +47,30 @@ final class GameHotDataRedis
|
||||
if ($configKey === '') {
|
||||
return null;
|
||||
}
|
||||
if (array_key_exists($configKey, self::$gcLocal)) {
|
||||
$cachedLocal = self::$gcLocal[$configKey];
|
||||
return is_array($cachedLocal) ? $cachedLocal : null;
|
||||
}
|
||||
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;
|
||||
}
|
||||
|
||||
@@ -64,6 +80,7 @@ final class GameHotDataRedis
|
||||
return;
|
||||
}
|
||||
self::redisDel(self::KEY_GC . $configKey);
|
||||
unset(self::$gcLocal[$configKey]);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -81,6 +98,7 @@ final class GameHotDataRedis
|
||||
}
|
||||
$ttl = self::intConfig('ttl_game_config', 86400);
|
||||
self::redisSetEx(self::KEY_GC . $configKey, $ttl, json_encode($row, JSON_UNESCAPED_UNICODE));
|
||||
self::$gcLocal[$configKey] = $row;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
File diff suppressed because one or more lines are too long
@@ -0,0 +1,20 @@
|
||||
-- 已上线环境:移除后台「会员管理」目录及子菜单、相关安全配置项(与代码移除配套执行)
|
||||
-- 执行前请备份数据库
|
||||
|
||||
DELETE FROM admin_rule WHERE `name` = 'user' OR `name` LIKE 'user/%';
|
||||
|
||||
DELETE FROM security_sensitive_data WHERE `id` = 2;
|
||||
|
||||
DELETE FROM security_data_recycle WHERE `id` = 5;
|
||||
|
||||
-- ---------------------------------------------------------------------------
|
||||
-- 以下可选:物理删除会员业务表(执行后 /api/user、/api/account 等会员接口将不可用)
|
||||
-- 若仍使用前台会员中心,请勿执行 DROP,并保留 user、user_group、user_rule 等表
|
||||
-- ---------------------------------------------------------------------------
|
||||
-- SET FOREIGN_KEY_CHECKS = 0;
|
||||
-- DROP TABLE IF EXISTS `user_money_log`;
|
||||
-- DROP TABLE IF EXISTS `user_score_log`;
|
||||
-- DROP TABLE IF EXISTS `user`;
|
||||
-- DROP TABLE IF EXISTS `user_group`;
|
||||
-- SET FOREIGN_KEY_CHECKS = 1;
|
||||
-- 说明:`user_rule` 仍用于前台会员菜单与权限,若整体下线会员功能再单独处理
|
||||
Reference in New Issue
Block a user