diff --git a/consumers/exam_service.php b/consumers/exam_service.php new file mode 100644 index 0000000..9c0f6d0 --- /dev/null +++ b/consumers/exam_service.php @@ -0,0 +1,40 @@ + 'ExamService', + // 服务接口名 + 'service' => ExamService::class, + // 服务提供者的服务协议,可选,默认值为 jsonrpc-http + 'protocol' => 'jsonrpc-http', + // 负载均衡算法,可选,默认值为 random + 'load_balancer' => 'random', + // 这个消费者要从哪个服务中心获取节点信息,如不配置则不会从服务中心获取节点信息 + 'registry' => [ + 'protocol' => env('CONSUMERS_PROTOCOL', 'consul'), + 'address' => env('CONSUMERS_ADDRESS', 'http://127.0.0.1:8500'), + ], + // 配置项,会影响到 Packer 和 Transporter + 'options' => [ + 'connect_timeout' => 5.0, + 'recv_timeout' => 5.0, + 'settings' => [ + 'open_eof_split' => true, + 'package_eof' => "\r\n", + ], + 'retry_count' => 2, + 'retry_interval' => 100, + 'heartbeat' => 30, + 'pool' => [ + 'min_connections' => 1, + 'max_connections' => 32, + 'connect_timeout' => 10.0, + 'wait_timeout' => 3.0, + 'heartbeat' => -1, + 'max_idle_time' => 60.0, + ], + ], +]; diff --git a/consumers/notice_service.php b/consumers/notice_service.php new file mode 100644 index 0000000..2a8a529 --- /dev/null +++ b/consumers/notice_service.php @@ -0,0 +1,40 @@ + 'NoticeService', + // 服务接口名 + 'service' => NoticeService::class, + // 服务提供者的服务协议,可选,默认值为 jsonrpc-http + 'protocol' => 'jsonrpc-http', + // 负载均衡算法,可选,默认值为 random + 'load_balancer' => 'random', + // 这个消费者要从哪个服务中心获取节点信息,如不配置则不会从服务中心获取节点信息 + 'registry' => [ + 'protocol' => env('CONSUMERS_PROTOCOL', 'consul'), + 'address' => env('CONSUMERS_ADDRESS', 'http://127.0.0.1:8500'), + ], + // 配置项,会影响到 Packer 和 Transporter + 'options' => [ + 'connect_timeout' => 5.0, + 'recv_timeout' => 5.0, + 'settings' => [ + 'open_eof_split' => true, + 'package_eof' => "\r\n", + ], + 'retry_count' => 2, + 'retry_interval' => 100, + 'heartbeat' => 30, + 'pool' => [ + 'min_connections' => 1, + 'max_connections' => 32, + 'connect_timeout' => 10.0, + 'wait_timeout' => 3.0, + 'heartbeat' => -1, + 'max_idle_time' => 60.0, + ], + ], +]; diff --git a/src/DataService/DataServiceInterface.php b/src/DataService/DataServiceInterface.php index c378e10..3773409 100644 --- a/src/DataService/DataServiceInterface.php +++ b/src/DataService/DataServiceInterface.php @@ -40,11 +40,17 @@ interface DataServiceInterface public function getExamTypeBy(int $id): array; public function getExamTypesByCampusId(int $campusId): array; public function getExamTypeByIds(array $ids): array; + public function createExamType(array $data): int; + public function updateExamType(int $id, array $data): bool; + public function deleteExamType(int $id): bool; // 科目相关 public function getSubjects(array $data): array; public function getSubjectBy(int $id): array; public function getSubjectsByExamTypeId(int $examTypeId): array; + public function createSubject(array $data): int; + public function updateSubject(int $id, array $data): bool; + public function deleteSubject(int $id): bool; // 批量更新校区排序 public function batchUpdateCampusSort(array $sorts): bool; diff --git a/src/ExamService/CampusRelationInterface.php b/src/ExamService/CampusRelationInterface.php new file mode 100644 index 0000000..6c606fa --- /dev/null +++ b/src/ExamService/CampusRelationInterface.php @@ -0,0 +1,18 @@ + 2025, 'notices' => [ + * ['notice_id'=>1, 'title'=>'...', 'campus_id'=>5, 'timeline'=>[...]] + * ]], + * ] + */ + public function getTimelinesByYear(int $typeId = 0, int $campusId = 0): array; + + public function getTimelineCampuses(int $typeId, int $examYear): array; + + public function getNoticesByYear(array $params): array; + + public function getRelatedNotices(int $noticeId): array; +} diff --git a/src/NoticeService/NoticeStatsInterface.php b/src/NoticeService/NoticeStatsInterface.php new file mode 100644 index 0000000..f0b7918 --- /dev/null +++ b/src/NoticeService/NoticeStatsInterface.php @@ -0,0 +1,12 @@ +