mirror of
https://gitee.com/ctexthuang/hyperf-micro-svc.git
synced 2026-02-08 10:20:16 +08:00
78 lines
1.4 KiB
PHP
78 lines
1.4 KiB
PHP
<?php
|
|
/**
|
|
* This service file is part of item.
|
|
*
|
|
* @author ctexthuang
|
|
* @contact ctexthuang@qq.com
|
|
*/
|
|
|
|
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
|
|
{
|
|
/**
|
|
* @var AdminRoleRepository
|
|
*/
|
|
#[Inject]
|
|
protected AdminRoleRepository $adminRoleRepository;
|
|
|
|
/**
|
|
* @return array
|
|
*/
|
|
public function handle(): array
|
|
{
|
|
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()
|
|
{
|
|
|
|
}
|
|
} |