..
This commit is contained in:
@@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user