mirror of
https://gitee.com/ctexthuang/hyperf_rbac_framework_server_ctexthuang.git
synced 2025-12-25 17:07:49 +08:00
feat : admin role unfinish
This commit is contained in:
@@ -10,12 +10,69 @@ declare(strict_types=1);
|
||||
|
||||
namespace App\Service\Admin\AdminUser;
|
||||
|
||||
use App\Exception\ErrException;
|
||||
use App\Repository\AdminRoleRepository;
|
||||
use App\Service\Admin\BaseAdminService;
|
||||
use Hyperf\Di\Annotation\Inject;
|
||||
|
||||
class RoleService extends BaseAdminService
|
||||
{
|
||||
public function handle()
|
||||
/**
|
||||
* @var AdminRoleRepository
|
||||
*/
|
||||
#[Inject]
|
||||
protected AdminRoleRepository $adminRoleRepository;
|
||||
|
||||
/**
|
||||
* @return array
|
||||
*/
|
||||
public function handle(): array
|
||||
{
|
||||
//todo Write logic
|
||||
return $this->adminReturn->success(
|
||||
'success',
|
||||
$this->adminRoleRepository->page(
|
||||
$this->getRequestData(),
|
||||
$this->getCurrentPage(),
|
||||
$this->getPageSize()
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return array
|
||||
*/
|
||||
public function create(): array
|
||||
{
|
||||
if (!$this->adminRoleRepository->create(
|
||||
array_merge(
|
||||
$this->getRequestData(),
|
||||
['created_by' => $this->adminId]
|
||||
)
|
||||
)) throw new ErrException('添加失败');
|
||||
|
||||
return $this->adminReturn->success();
|
||||
}
|
||||
|
||||
public function update(int $id)
|
||||
{
|
||||
if (!$this->adminRoleRepository->updateById(
|
||||
$id,
|
||||
array_merge()
|
||||
));
|
||||
}
|
||||
|
||||
public function delete()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public function getRole()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public function setRole()
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user