50 lines
1.3 KiB
PHP
50 lines
1.3 KiB
PHP
<?php
|
|
|
|
namespace App\Controllers\Mangboard\Admin;
|
|
|
|
use App\Controllers\Admin\AdminController;
|
|
use App\Models\Mangboard\UserModel;
|
|
|
|
class UserController extends AdminController
|
|
{
|
|
public function __construct()
|
|
{
|
|
parent::__construct();
|
|
}
|
|
|
|
public function index(): string
|
|
{
|
|
return __METHOD__;
|
|
}
|
|
|
|
public function point(): string
|
|
{
|
|
try {
|
|
$id = $this->request->getPost("id");
|
|
$point = intval($this->request->getPost("point"));
|
|
$sign = $this->request->getPost("point") ?? "+";
|
|
|
|
$userModel = new UserModel();
|
|
$userModel->setPoint($id, $point, $sign);
|
|
return "완료되었습니다.";
|
|
} catch (\Exception $e) {
|
|
log_message("error", $e->getMessage());
|
|
return $e->getMessage();
|
|
}
|
|
}
|
|
public function level(...$params): bool
|
|
{
|
|
try {
|
|
$isDebug = in_array("debug", $params);
|
|
$userModel = new UserModel();
|
|
$userModel->setDebug($isDebug);
|
|
$userModel->setLevel();
|
|
log_message("notice", "Mangboard->level 작업이 완료되었습니다.");
|
|
return true;
|
|
} catch (\Exception $e) {
|
|
log_message("error", $e->getMessage());
|
|
return false;
|
|
}
|
|
}
|
|
}
|