mirror of
https://github.com/lkddi/nexusphp.git
synced 2026-04-24 03:57:22 +08:00
upload auto fill offer
This commit is contained in:
@@ -68,3 +68,9 @@ function removeUserLeechWarn($params)
|
||||
return $rep->removeLeechWarn($CURUSER['id'], $params['uid']);
|
||||
}
|
||||
|
||||
function getOffer($params)
|
||||
{
|
||||
$offer = \App\Models\Offer::query()->findOrFail($params['id']);
|
||||
return $offer->toArray();
|
||||
}
|
||||
|
||||
|
||||
@@ -149,6 +149,28 @@ stdhead($lang_upload['head_upload']);
|
||||
$offer .= "<option value=\"" . $offerrow["id"] . "\">" . htmlspecialchars($offerrow["name"]) . "</option>";
|
||||
$offer .= "</select>";
|
||||
tr($lang_upload['row_your_offer']. (!$uploadfreely && !$allowspecial ? "<font color=red>*</font>" : ""), $offer.$lang_upload['text_please_select_offer'] , 1);
|
||||
$getOfferJs = <<<JS
|
||||
jQuery('select[name="offer"]').on("change", function () {
|
||||
let id = this.value
|
||||
if (id == 0) {
|
||||
return
|
||||
}
|
||||
let params = {action: "getOffer", params: {id: id}}
|
||||
jQuery.post("ajax.php", params, function (response) {
|
||||
console.log(response)
|
||||
if (response.ret != 0) {
|
||||
alert(response.msg)
|
||||
return
|
||||
}
|
||||
jQuery("#name").val(response.data.name)
|
||||
clearContent()
|
||||
doInsert(response.data.descr, '', false)
|
||||
jQuery("#browsecat").val(response.data.category)
|
||||
}, 'json')
|
||||
})
|
||||
JS;
|
||||
\Nexus\Nexus::js($getOfferJs, 'footer', false);
|
||||
|
||||
}
|
||||
//===end
|
||||
|
||||
|
||||
@@ -6,11 +6,10 @@ $q = $_REQUEST['q'] ?? '';
|
||||
if (!empty($q)) {
|
||||
$query->where('username', 'like', "%{$q}%");
|
||||
}
|
||||
$total = $query->toBase()->getCountForPagination();
|
||||
$page = $_REQUEST['page'] ?? 1;
|
||||
$perPage = 20;
|
||||
$rows = $query->forPage($page, $perPage)->orderBy('id', 'desc')->get()->toArray();
|
||||
list($paginationTop, $paginationBottom, $limit) = pager($perPage, $total, "?");
|
||||
$total = (clone $query)->count();
|
||||
$perPage = 50;
|
||||
list($paginationTop, $paginationBottom, $limit, $offset) = pager($perPage, $total, "?");
|
||||
$rows = (clone $query)->offset($offset)->take($perPage)->orderBy('id', 'desc')->get()->toArray();
|
||||
$header = [
|
||||
'id' => 'ID',
|
||||
'uid' => 'UID',
|
||||
|
||||
Reference in New Issue
Block a user