优化一键测试权重
This commit is contained in:
@@ -46,18 +46,19 @@ class DiceReward extends BaseModel
|
||||
|
||||
/**
|
||||
* 获取奖励对照实例(按档位+方向索引,用于抽奖与权重配比)
|
||||
* 优先从共享缓存读取,保证多进程(如一键测试 worker)与数据库一致
|
||||
* @return array{list: array, by_tier_direction: array}
|
||||
*/
|
||||
public static function getCachedInstance(): array
|
||||
{
|
||||
if (self::$instance !== null) {
|
||||
return self::$instance;
|
||||
}
|
||||
$instance = Cache::get(self::CACHE_KEY_INSTANCE);
|
||||
if ($instance !== null && is_array($instance)) {
|
||||
self::$instance = $instance;
|
||||
return $instance;
|
||||
}
|
||||
if (self::$instance !== null) {
|
||||
return self::$instance;
|
||||
}
|
||||
self::refreshCache();
|
||||
$instance = Cache::get(self::CACHE_KEY_INSTANCE);
|
||||
self::$instance = is_array($instance) ? $instance : self::buildEmptyInstance();
|
||||
|
||||
Reference in New Issue
Block a user