mirror of
https://github.com/lkddi/nexusphp.git
synced 2026-04-14 12:30:49 +08:00
api scrape + medal wearing status
This commit is contained in:
29
public/ajax.php
Normal file
29
public/ajax.php
Normal file
@@ -0,0 +1,29 @@
|
||||
<?php
|
||||
require "../include/bittorrent.php";
|
||||
dbconn();
|
||||
loggedinorreturn();
|
||||
|
||||
$action = $_POST['action'] ?? 'noAction';
|
||||
$params = $_POST['params'] ?? [];
|
||||
|
||||
function noAction()
|
||||
{
|
||||
throw new \RuntimeException("no Action");
|
||||
}
|
||||
|
||||
|
||||
try {
|
||||
$result = call_user_func($action, $params);
|
||||
exit(json_encode(success($result)));
|
||||
} catch (\Throwable $exception) {
|
||||
exit(json_encode(fail($exception->getMessage(), $_POST)));
|
||||
}
|
||||
|
||||
function toggleUserMedalStatus($params)
|
||||
{
|
||||
global $CURUSER;
|
||||
$rep = new \App\Repositories\MedalRepository();
|
||||
return $rep->toggleUserMedalStatus($params['id'], $CURUSER['id']);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user