admin add claim

This commit is contained in:
xiaomlove
2022-07-02 15:08:23 +08:00
parent 579351c0eb
commit 5191a1ba9a
48 changed files with 992 additions and 293 deletions
+4 -4
View File
@@ -185,7 +185,7 @@ class ClaimRepository extends BaseRepository
if ($startOfThisMonth->diffInMonths($targetStartOfMonth) > 1) {
do_log("[UNREACHED_REMOVE], uid: $uid, torrent: " . $row->torrent_id);
$unReachedIdArr[] = $row->id;
$unReachedTorrentIdArr = $row->torrent_id;
$unReachedTorrentIdArr[] = $row->torrent_id;
} else {
do_log("[UNREACHED_FIRST_MONTH], uid: $uid, torrent: " . $row->torrent_id);
$seedTimeCaseWhen[] = sprintf('when %s then %s', $row->id, $row->snatch->seedtime);
@@ -290,9 +290,9 @@ class ClaimRepository extends BaseRepository
if ($deductTotal) {
$msg[] = nexus_trans(
"claim.claim_unreached_summary", [
'deduct_per_torrent '=> number_format($deductPerTorrent, 2),
'deduct_total' => number_format($deductTotal, 2)
], $locale
'deduct_per_torrent' => number_format($deductPerTorrent, 2),
'deduct_total' => number_format($deductTotal, 2)
], $locale
);
}
return [
+1 -3
View File
@@ -37,7 +37,7 @@ class DashboardRepository extends BaseRepository
$result[$name] = [
'name' => $name,
'text' => nexus_trans("dashboard.system_info.$name"),
'value' => '2.13.11',
'value' => "2.13.14",
];
$name = 'php_version';
$result[$name] = [
@@ -287,6 +287,4 @@ class DashboardRepository extends BaseRepository
}
}
+11 -10
View File
@@ -70,9 +70,7 @@ class ExamRepository extends BaseRepository
if (isset($params['end']) && $params['end'] == '') {
$params['end'] = null;
}
if (isset($params['priority'])) {
$params['priority'] = intval($params['priority']);
}
$params['priority'] = intval($params['priority'] ?? 0);
return $params;
}
@@ -86,12 +84,15 @@ class ExamRepository extends BaseRepository
if (isset($index['checked']) && !$index['checked']) {
continue;
}
if (isset($validIndex[$index['index']])) {
throw new \InvalidArgumentException(nexus_trans('admin.resources.exam.index_duplicate', ['index' => nexus_trans("exam.index_text_{$index['index']}")]));
}
if (isset($index['require_value']) && !ctype_digit((string)$index['require_value'])) {
throw new \InvalidArgumentException(sprintf(
'Invalid require value for index: %s.', $index['index']
));
}
$validIndex[] = $index;
$validIndex[$index['index']] = $index;
}
if (empty($validIndex)) {
throw new \InvalidArgumentException("Require valid index.");
@@ -861,12 +862,12 @@ class ExamRepository extends BaseRepository
$filter = Exam::FILTER_USER_REGISTER_TIME_RANGE;
$range = $filters->$filter;
if (!empty($range)) {
/**
* begin and end will be exists at the same time
* @see checkBeginEnd()
*/
$baseQuery->where("$userTable.added", ">=", Carbon::parse($range[0])->toDateTimeString())
->where("$userTable.added", '<=', Carbon::parse($range[1])->toDateTimeString());
if (!empty($range[0])) {
$baseQuery->where("$userTable.added", ">=", Carbon::parse($range[0])->toDateTimeString());
}
if (!empty($range[1])) {
$baseQuery->where("$userTable.added", '<=', Carbon::parse($range[1])->toDateTimeString());
}
}
//Does not has this exam
$baseQuery->whereDoesntHave('exams', function (Builder $query) use ($exam) {
+1 -1
View File
@@ -380,7 +380,7 @@ class HitAndRunRepository extends BaseRepository
throw new \LogicException("Can't be pardoned due to status is: " . $model->status_text . " !");
}
$model->status = HitAndRun::STATUS_PARDONED;
$model->comment = $this->getCommentUpdateRaw(addslashes('Pardon by ' . $user->username));
$model->comment = $this->getCommentUpdateRaw(addslashes(date('Y-m-d') . ' - Pardon by ' . $user->username));
$model->save();
return true;
}