mirror of
https://github.com/lkddi/nexusphp.git
synced 2026-04-24 12:07:23 +08:00
fix admin exam-user detail error + improve announce check ReAnnounce log
This commit is contained in:
@@ -51,6 +51,7 @@ class ExamUser extends NexusModel
|
|||||||
}
|
}
|
||||||
$currentValue = $progress[$index['index']] ?? 0;
|
$currentValue = $progress[$index['index']] ?? 0;
|
||||||
$requireValue = $index['require_value'];
|
$requireValue = $index['require_value'];
|
||||||
|
$unit = Exam::$indexes[$index['index']]['unit'] ?? '';
|
||||||
switch ($index['index']) {
|
switch ($index['index']) {
|
||||||
case Exam::INDEX_UPLOADED:
|
case Exam::INDEX_UPLOADED:
|
||||||
case Exam::INDEX_DOWNLOADED:
|
case Exam::INDEX_DOWNLOADED:
|
||||||
@@ -58,7 +59,7 @@ class ExamUser extends NexusModel
|
|||||||
$requireValueAtomic = $requireValue * 1024 * 1024 * 1024;
|
$requireValueAtomic = $requireValue * 1024 * 1024 * 1024;
|
||||||
break;
|
break;
|
||||||
case Exam::INDEX_SEED_TIME_AVERAGE:
|
case Exam::INDEX_SEED_TIME_AVERAGE:
|
||||||
$currentValueFormatted = number_format($currentValue / 3600, 2) . " {$index['unit']}";
|
$currentValueFormatted = number_format($currentValue / 3600, 2) . " $unit";
|
||||||
$requireValueAtomic = $requireValue * 3600;
|
$requireValueAtomic = $requireValue * 3600;
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
|
|||||||
+6
-4
@@ -229,14 +229,16 @@ if ($compact == 1) {
|
|||||||
//check ReAnnounce
|
//check ReAnnounce
|
||||||
$params = $_GET;
|
$params = $_GET;
|
||||||
unset($params['key']);
|
unset($params['key']);
|
||||||
$lockKey = md5(http_build_query($params));
|
$reAnnounceQuery = http_build_query($params);
|
||||||
|
$lockKey = md5($reAnnounceQuery);
|
||||||
|
$log .= ", [CHECK_RE_ANNOUNCE], reAnnounceQuery: $reAnnounceQuery, lockKey: $lockKey";
|
||||||
$redis = $Cache->getRedis();
|
$redis = $Cache->getRedis();
|
||||||
if (!$redis->set($lockKey, TIMENOW, ['nx', 'ex' => 5])) {
|
if (!$redis->set($lockKey, TIMENOW, ['nx', 'ex' => 5])) {
|
||||||
do_log('ReAnnounce');
|
do_log("$log, [YES_RE_ANNOUNCE]");
|
||||||
benc_resp($rep_dict);
|
benc_resp($rep_dict);
|
||||||
exit();
|
exit();
|
||||||
}
|
}
|
||||||
|
$log .= ", [NO_RE_ANNOUNCE]";
|
||||||
unset($self);
|
unset($self);
|
||||||
$res = sql_query($peerlistsql);
|
$res = sql_query($peerlistsql);
|
||||||
if (isset($event) && $event == "stopped") {
|
if (isset($event) && $event == "stopped") {
|
||||||
@@ -359,7 +361,7 @@ else // continue an existing session
|
|||||||
do_log("notSeedBoxMaxSpeedMbps: $notSeedBoxMaxSpeedMbps, upSpeedMbps: $upSpeedMbps");
|
do_log("notSeedBoxMaxSpeedMbps: $notSeedBoxMaxSpeedMbps, upSpeedMbps: $upSpeedMbps");
|
||||||
if ($upSpeedMbps > $notSeedBoxMaxSpeedMbps) {
|
if ($upSpeedMbps > $notSeedBoxMaxSpeedMbps) {
|
||||||
(new \App\Repositories\UserRepository())->updateDownloadPrivileges(null, $userid, 'no');
|
(new \App\Repositories\UserRepository())->updateDownloadPrivileges(null, $userid, 'no');
|
||||||
do_log("user: $userid downloading privileges have been disabled! (over speed)", 'error');
|
do_log("user: $userid downloading privileges have been disabled! (over speed), notSeedBoxMaxSpeedMbps: $notSeedBoxMaxSpeedMbps > upSpeedMbps: $upSpeedMbps", 'error');
|
||||||
err("Your downloading privileges have been disabled! (over speed)");
|
err("Your downloading privileges have been disabled! (over speed)");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user