mirror of
https://github.com/lkddi/nexusphp.git
synced 2026-04-24 12:07:23 +08:00
claim bulk
This commit is contained in:
@@ -161,3 +161,10 @@ function saveUserMedal($params)
|
||||
$rep = new \App\Repositories\MedalRepository();
|
||||
return $rep->saveUserMedal($CURUSER['id'], $data);
|
||||
}
|
||||
|
||||
function claimAllSeeding()
|
||||
{
|
||||
global $CURUSER;
|
||||
$rep = new \App\Repositories\ClaimRepository();
|
||||
return $rep->claimAllSeeding($CURUSER['id']);
|
||||
}
|
||||
|
||||
@@ -343,11 +343,24 @@ if ($count > 0 && isset($tableWhere, $fields, $order))
|
||||
list($torrentlist, $total_size_this_page) = maketable ( $res, $type);
|
||||
}
|
||||
|
||||
$table = $pagertop . $torrentlist . $pagerbottom;
|
||||
$hasData = false;
|
||||
$summary = sprintf('<b>%s</b>%s', $count, $lang_getusertorrentlistajax['text_record'] . add_s ( $count ));
|
||||
if (isset($total_size) && $total_size){
|
||||
echo "<br /><b>" . $count . "</b>" . $lang_getusertorrentlistajax['text_record'] . add_s ( $count ) . $lang_getusertorrentlistajax['text_total_size'] . mksize($total_size) . $pagertop . $torrentlist . $pagerbottom;
|
||||
} elseif ($count){
|
||||
echo "<br /><b>".$count."</b>".$lang_getusertorrentlistajax['text_record'].add_s($count). $pagertop . $torrentlist . $pagerbottom;
|
||||
$hasData = true;
|
||||
$summary .= $lang_getusertorrentlistajax['text_total_size'] . mksize($total_size);
|
||||
} elseif ($count) {
|
||||
$hasData = true;
|
||||
}
|
||||
if ($hasData) {
|
||||
$claimAllBtn = '';
|
||||
if ($id == $CURUSER['id'] && has_role_work_seeding($CURUSER['id'])) {
|
||||
$claimAllBtn = sprintf('<input type="button" value="%s" id="claim-all-seeding">', nexus_trans('claim.claim_all_seeding_btn'));
|
||||
}
|
||||
$header = sprintf('<div style="display: flex;justify-content: space-between"><div>%s</div><div>%s</div></div>', $summary, $claimAllBtn);
|
||||
echo '<br/>' . $header . $table;
|
||||
} else {
|
||||
echo $lang_getusertorrentlistajax['text_no_record'];
|
||||
}
|
||||
|
||||
?>
|
||||
|
||||
@@ -627,6 +627,23 @@ JS;
|
||||
}
|
||||
end_main_frame();
|
||||
|
||||
$claimAllSeedingConfirmation = nexus_trans('claim.claim_all_seeding_confirmation');
|
||||
$claimJs = '';
|
||||
if ($userInfo->id == $CURUSER['id'] && has_role_work_seeding($userInfo->id)) {
|
||||
$claimJs = <<<JS
|
||||
jQuery("body").on("click", "#claim-all-seeding", function (e) {
|
||||
layer.confirm("$claimAllSeedingConfirmation", {}, function () {
|
||||
jQuery.post('ajax.php', {"action": "claimAllSeeding"}, function (response) {
|
||||
if (response.ret == 0) {
|
||||
window.location.reload()
|
||||
} else {
|
||||
layer.alert(response.msg)
|
||||
}
|
||||
}, 'json')
|
||||
})
|
||||
})
|
||||
JS;
|
||||
}
|
||||
$paginationJs = <<<JS
|
||||
jQuery("body").on("click", ".nexus-pagination a", function (e) {
|
||||
e.preventDefault()
|
||||
@@ -637,7 +654,10 @@ jQuery("body").on("click", ".nexus-pagination a", function (e) {
|
||||
let result = ajax.gets(url);
|
||||
box.html(result)
|
||||
})
|
||||
$claimJs
|
||||
JS;
|
||||
|
||||
\Nexus\Nexus::js($paginationJs, 'footer', false);
|
||||
|
||||
stdfoot();
|
||||
?>
|
||||
|
||||
Reference in New Issue
Block a user