mirror of
https://github.com/lkeme/BiliHelper-personal.git
synced 2025-12-20 18:40:05 +08:00
[fix] Statistics
This commit is contained in:
parent
746d75cf89
commit
83d5adeb86
@ -18,6 +18,9 @@ class Competition
|
|||||||
{
|
{
|
||||||
use TimeLock;
|
use TimeLock;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @use 赛事入口 https://www.bilibili.com/v/game/match/competition
|
||||||
|
*/
|
||||||
public static function run()
|
public static function run()
|
||||||
{
|
{
|
||||||
if (getenv('USE_COMPETITION') == 'false' || self::getLock() > time()) {
|
if (getenv('USE_COMPETITION') == 'false' || self::getLock() > time()) {
|
||||||
@ -37,10 +40,9 @@ class Competition
|
|||||||
$questions = self::fetchQuestions();
|
$questions = self::fetchQuestions();
|
||||||
$max_guess = intval(getenv('COMPET_MAX_NUM'));
|
$max_guess = intval(getenv('COMPET_MAX_NUM'));
|
||||||
foreach ($questions as $index => $question) {
|
foreach ($questions as $index => $question) {
|
||||||
if (($index + 1) >= $max_guess) {
|
if ($index >= $max_guess) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
// int $, int $main_id, int $detail_id, int $coin_num
|
|
||||||
$guess = self::parseQuestion($question);
|
$guess = self::parseQuestion($question);
|
||||||
self::addGuess($guess);
|
self::addGuess($guess);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -169,7 +169,7 @@ class Statistics
|
|||||||
$results = 0;
|
$results = 0;
|
||||||
is_null($second_key) ? self::initKeyValue($target, $key) : self::initKeyValue($target, $key, 0, $second_key);
|
is_null($second_key) ? self::initKeyValue($target, $key) : self::initKeyValue($target, $key, 0, $second_key);
|
||||||
foreach ($target as $item) {
|
foreach ($target as $item) {
|
||||||
$skip = is_null($second_key) ? isset($item[$key]) : $item[$key][$second_key];
|
$skip = is_null($second_key) ? isset($item[$key]) : isset($item[$key][$second_key]);
|
||||||
if ($skip) {
|
if ($skip) {
|
||||||
is_null($second_key) ? $results += intval($item[$key]) : $results += intval($item[$key][$second_key]);
|
is_null($second_key) ? $results += intval($item[$key]) : $results += intval($item[$key][$second_key]);
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user