<?php
declare(strict_types=1);
namespace App\Controller\Admin;
use App\Controller\BaseController;
use Hyperf\HttpServer\Annotation\Controller;
use Hyperf\HttpServer\Annotation\PostMapping;
use Hyperf\HttpServer\Annotation\Middleware;
use Hyperf\HttpServer\Annotation\Middlewares;
use App\Middleware\LoginAuthMiddleware;
use App\Middleware\AdminAuthMiddleware;
class UserController extends BaseController
{
public function index()
{
$reqParam = $this->request->all();
$list = $this->userRepo->getUserList($reqParam);
$data = [
'pages' => $list['pages'],
'list' => $list['data'],
];
return $this->success($data);
}
public function store()
{
$reqParam = $this->request->all();
$id = $this->userRepo->saveUser($reqParam);
return $this->success($id);
}
public function getInfo()
{
$reqParam = $this->request->all();
$info = $this->userRepo->getInfo($reqParam['id']);
$data = [
'info' => $info,
];
return $this->success($data);
}
public function destroy()
{
$reqParam = $this->request->all();
$this->userRepo->deleteInfo($reqParam['id']);
return $this->success('ok');
}
public function getRoles()
{
$data = $this->userRepo->getRolesList();
return $this->success($data);
}
}