This commit is contained in:
Aether
2025-10-16 20:06:23 +08:00
parent 6ab9bd6198
commit 9052c7069f
8 changed files with 153 additions and 20 deletions

View File

@@ -4,6 +4,9 @@ declare(strict_types=1);
namespace App\JsonRpc\Service;
use Aether\AetherCrudService;
use Aether\AetherModel;
use Aether\AetherValidator;
use Aether\Exception\BusinessException;
use App\Exception\CampusNotFound;
use App\Exception\TeacherNotFound;
@@ -31,12 +34,18 @@ class DataService implements DataServiceInterface
#[Inject]
protected TeacherValidator $teacherValidator;
#[Inject]
protected CampusService $campusService;
#[Inject]
protected TeacherService $teacherService;
/**
* 获取校区列表.
*/
public function getCampuses(array $data): array
{
return $this->campusModel->list($data);
return $this->campusService->list($data);
}
/**
@@ -108,12 +117,25 @@ class DataService implements DataServiceInterface
->toArray();
}
public function getCampusByIds(array $ids): array
{
if (empty($ids)) {
return [];
}
return $this->campusModel
->whereIn('id', $ids)
->where('status', 1)
->get()
->keyBy('id')
->toArray();
}
/**
* 获取教师列表.
*/
public function getTeachers(array $data): array
{
return $this->teacherModel->list($data);
return $this->teacherService->list($data);
}
/**
@@ -158,4 +180,14 @@ class DataService implements DataServiceInterface
{
return $this->teacherModel->deleteById($id);
}
protected function getModel(): AetherModel
{
return $this->campusModel;
}
protected function getValidator(): AetherValidator
{
return $this->teacherValidator;
}
}