Files
hyperf_service/app/Service/Admin/BaseService.php
2024-11-07 16:43:58 +08:00

65 lines
1.1 KiB
PHP

<?php
/**
* This service file is part of item.
*
* @author ctexthuang
* @contact ctexthuang@qq.com
*/
declare(strict_types=1);
namespace App\Service\Admin;
use App\Lib\AdminReturn;
use Hyperf\Context\Context;
use Hyperf\Di\Annotation\Inject;
use Hyperf\HttpServer\Contract\RequestInterface;
abstract class BaseService
{
/**
* 请求对象
* @var RequestInterface
*/
#[Inject]
protected RequestInterface $request;
/**
* 通用返回对象
* @var AdminReturn $return
*/
#[Inject]
protected AdminReturn $return;
/**
* 管理员id
* @var int $adminId
*/
protected int $adminId = 0;
/**
* 角色id
* @var int $roleId
*/
protected int $roleId = 0;
/**
* @var int
*/
protected int $cityId = 0;
/**
* 主构造函数(获取请求对象)
*/
public function __construct()
{
$this->adminId = Context::get("admin_id",0);
$this->roleId = Context::get("role_id",0);
$this->cityId = Context::get("city_id",0);
}
/**
* 主体函数抽象类
*/
abstract public function handle();
}