基础数据-校区服务

This commit is contained in:
Aether
2025-09-19 15:14:20 +08:00
parent 824510d57c
commit b69f14ded2
16 changed files with 757 additions and 300 deletions

View File

@@ -5,9 +5,9 @@ declare(strict_types=1);
namespace Aether;
use Aether\Exception\BusinessException;
use Hyperf\DbConnection\Db;
use Hyperf\Di\Annotation\Inject;
use Hyperf\Logger\LoggerFactory;
use Hyperf\DbConnection\Db;
use Psr\Log\LoggerInterface;
use Throwable;
@@ -17,18 +17,16 @@ abstract class AetherService
protected LoggerFactory $loggerFactory;
/**
* 获取当前服务日志器
* 获取当前服务日志器.
*/
protected function logger(): LoggerInterface
{
// return $this->loggerFactory->get(substr(strrchr(static::class, '\\'), 1));
// 提取类名如ExamTypeService作为日志通道名
$className = substr(strrchr(static::class, '\\'), 1);
return $this->loggerFactory->get($className);
}
/**
* 事务处理
* 事务处理.
* @throws Throwable
*/
protected function transaction(callable $callback)
@@ -37,7 +35,7 @@ abstract class AetherService
}
/**
* 检查资源是否存在(不存在则抛出异常)
* 检查资源是否存在(不存在则抛出异常).
* @throws BusinessException
*/
protected function checkResourceExists(?object $resource, string $message = '资源不存在'): void
@@ -46,4 +44,4 @@ abstract class AetherService
throw new BusinessException($message, BusinessException::RESOURCE_NOT_FOUND);
}
}
}
}