修改缓存方式

This commit is contained in:
2026-04-20 10:31:14 +08:00
parent 025cce3e3e
commit 92fb40ae80
19 changed files with 512 additions and 57 deletions

View File

@@ -7,6 +7,7 @@ use ba\Random;
use support\think\Db;
use app\common\model\User;
use app\common\facade\Token;
use app\common\service\GameHotDataRedis;
use Webman\Http\Request;
/**
@@ -69,7 +70,7 @@ class Auth extends \ba\Auth
Token::tokenExpirationCheck($tokenData);
$userId = $tokenData['user_id'];
if ($tokenData['type'] == self::TOKEN_TYPE && $userId > 0) {
$this->model = User::where('id', $userId)->find();
$this->model = GameHotDataRedis::userModelFromCacheOrDb($userId);
if (!$this->model) {
$this->setError('Account not exist');
return false;

View File

@@ -4,7 +4,7 @@ declare(strict_types=1);
namespace app\common\library\finance;
use support\think\Db;
use app\common\service\GameHotDataRedis;
/**
* 提现打码量(流水)门槛工具库
@@ -38,7 +38,7 @@ final class WithdrawFlow
*/
public static function ratio(): string
{
$row = Db::name('game_config')->where('config_key', self::CONFIG_KEY)->find();
$row = GameHotDataRedis::gameConfigRow(self::CONFIG_KEY);
if (!$row) {
return self::DEFAULT_RATIO;
}

View File

@@ -4,7 +4,7 @@ declare(strict_types=1);
namespace app\common\library\game;
use support\think\Db;
use app\common\service\GameHotDataRedis;
/**
* 连胜奖励game_config.streak_win_reward按「连胜档位」110 配置赔率系数与是否大奖。
@@ -100,7 +100,7 @@ final class StreakWinReward
if (self::$cache !== null) {
return self::$cache;
}
$row = Db::name('game_config')->where('config_key', self::CONFIG_KEY)->find();
$row = GameHotDataRedis::gameConfigRow(self::CONFIG_KEY);
self::$cache = self::parseFromConfigValue($row['config_value'] ?? null);
return self::$cache;