improve claim settle message

This commit is contained in:
xiaomlove
2025-05-16 14:19:06 +07:00
parent 1ddd6e04d9
commit 45c41047da
7 changed files with 33 additions and 20 deletions
+2 -2
View File
@@ -40,8 +40,8 @@ class ClaimSettle extends Command
{
$rep = new ClaimRepository();
$uid = $this->option('uid');
$force = $this->option('force');
$test = $this->option('test');
$force = $this->option('force') ?? false;
$test = $this->option('test') ?? false;
$this->info(sprintf('uid: %s, force: %s, test: %s', $uid, $force, $test));
if (!$uid) {
$result = $rep->settleCronjob();
+1
View File
@@ -9,6 +9,7 @@ use App\Models\PersonalAccessToken;
use App\Models\Torrent;
use App\Models\TorrentExtra;
use App\Models\User;
use App\Repositories\ClaimRepository;
use App\Repositories\ExamRepository;
use App\Repositories\SeedBoxRepository;
use App\Repositories\UploadRepository;
+27 -12
View File
@@ -311,10 +311,16 @@ class ClaimRepository extends BaseRepository
$msg[] = nexus_trans('claim.claim_total', [ 'total' => count($allTorrentIdArr)], $locale);
//列表数据只取部分展示
$reachList = collect(array_slice($reachedTorrentIdArr, 0, self::SETTLE_MSG_SLICE_COUNT))->map(
fn($item) => sprintf("[url=details.php?id=%s]%s[/url]", $item, $torrentInfo->get($item)->name)
)->implode("\n");
$msg[] = nexus_trans("claim.claim_reached_counts", ['counts' => count($reachedTorrentIdArr)], $locale) . "\n$reachList";
$sliceCount = self::SETTLE_MSG_SLICE_COUNT;
$sliceTip = "... (" . nexus_trans('claim.slice_tip', ['slice_count' => $sliceCount], $locale) . ")";
$reachPart = nexus_trans("claim.claim_reached_counts", ['counts' => count($reachedTorrentIdArr), 'slice_count' => $sliceCount], $locale);
if (!empty($reachedTorrentIdArr)) {
$reachList = collect(array_slice($reachedTorrentIdArr, 0, $sliceCount))->map(
fn($item) => sprintf("[url=details.php?id=%s]%s[/url]", $item, $torrentInfo->get($item)->name)
)->implode("\n");
$reachPart .= sprintf("\n%s\n%s", $reachList, $sliceTip);
}
$msg[] = $reachPart;
$msg[] = nexus_trans(
"claim.claim_reached_summary", [
'bonus_per_hour' => number_format($bonusResult['seed_bonus'], 2),
@@ -323,15 +329,24 @@ class ClaimRepository extends BaseRepository
], $locale
);
$remainList = collect(array_slice($remainTorrentIdArr, 0, self::SETTLE_MSG_SLICE_COUNT))->map(
fn($item) => sprintf("[url=details.php?id=%s]%s[/url]", $item, $torrentInfo->get($item)->name)
)->implode("\n");
$msg[] = nexus_trans("claim.claim_unreached_remain_counts", ['counts' => count($remainTorrentIdArr)], $locale) . "\n$remainList";
$remainPart = nexus_trans("claim.claim_unreached_remain_counts", ['counts' => count($remainTorrentIdArr), 'slice_count' => $sliceCount], $locale);
if (!empty($remainTorrentIdArr)) {
$remainList = collect(array_slice($remainTorrentIdArr, 0, $sliceCount))->map(
fn($item) => sprintf("[url=details.php?id=%s]%s[/url]", $item, $torrentInfo->get($item)->name)
)->implode("\n");
$remainPart .= sprintf("\n%s\n%s", $remainList, $sliceTip);
}
$msg[] = $remainPart;
$removePart = nexus_trans("claim.claim_unreached_remove_counts", ['counts' => count($unReachedTorrentIdArr), 'slice_count' => $sliceCount], $locale);
if (!empty($unReachedTorrentIdArr)) {
$unReachList = collect(array_slice($unReachedTorrentIdArr, 0, $sliceCount))->map(
fn($item) => sprintf("[url=details.php?id=%s]%s[/url]", $item, $torrentInfo->get($item)->name)
)->implode("\n");
$removePart .= sprintf("\n%s\n%s", $unReachList, $sliceTip);
}
$msg[] = $removePart;
$unReachList = collect(array_slice($unReachedTorrentIdArr, 0, self::SETTLE_MSG_SLICE_COUNT))->map(
fn($item) => sprintf("[url=details.php?id=%s]%s[/url]", $item, $torrentInfo->get($item)->name)
)->implode("\n");
$msg[] = nexus_trans("claim.claim_unreached_remove_counts", ['counts' => count($unReachedTorrentIdArr)], $locale) . "\n$unReachList";
if ($deductTotal) {
$msg[] = nexus_trans(
"claim.claim_unreached_summary", [
-6
View File
@@ -56,12 +56,6 @@ class Torrent
return $snatchedList;
}
public function listPTGenInfo(array $torrentIdArr)
{
$list = TorrentExtra::query()->whereIn('torrent_id', $torrentIdArr)->get(['torrent_id', 'pt_gen']);
}
public function renderProgressBar($activeStatus, $progress): string
{
$color = '#aaa';
+1
View File
@@ -23,6 +23,7 @@ return [
'claim_unreached_remain_counts' => 'Unreached torrent remain counts: [b]:counts[/b]',
'claim_unreached_remove_counts' => 'Unreached torrent remove counts: [b]:counts[/b]',
'claim_unreached_summary' => 'Deduct bonus every unreached torrent[b]:deduct_per_torrent[/b], total deduct: [b]:deduct_total[/b]',
'slice_tip' => 'Show only the first :slice_count items',
'confirm_give_up' => 'Are you sure you want to give up claiming this torrent?',
'add_claim' => 'Claim',
+1
View File
@@ -23,6 +23,7 @@ return [
'claim_unreached_remain_counts' => '未达标保留数:[b]:counts[/b]',
'claim_unreached_remove_counts' => '未达标删除数:[b]:counts[/b]',
'claim_unreached_summary' => '未达标每个种子扣除魔力:[b]:deduct_per_torrent[/b],总扣除魔力:[b]:deduct_total[/b]',
'slice_tip' => '只显示前 :slice_count 个',
'confirm_give_up' => '确定要放弃认领此种子吗?',
'add_claim' => '认领',
+1
View File
@@ -22,6 +22,7 @@ return [
'claim_unreached_remain_counts' => '未達標保留數:[b]:counts[/b]',
'claim_unreached_remove_counts' => '未達標刪除數:[b]:counts[/b]',
'claim_unreached_summary' => '未達標每個種子扣除魔力:[b]:deduct_per_torrent[/b],總扣除魔力:[b]:deduct_total[/b]',
'slice_tip' => '只顯示前 :slice_count 個',
'confirm_give_up' => '確定要放棄認領此種子嗎?',
'add_claim' => '認領',