From f39cdca8ffcb220b93229e9a6b2b564e019cc214 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=A0=82=E5=90=89=E8=AF=83=E5=BE=B7=E6=8B=89=E6=9B=BC?= =?UTF-8?q?=E6=9F=A5=E7=9A=84=E8=8B=B1=E8=B1=AA?= Date: Fri, 7 Aug 2026 09:22:09 +0800 Subject: [PATCH] =?UTF-8?q?=E8=A1=A5=E5=85=85=E5=85=AC=E5=91=8A=E4=B8=8E?= =?UTF-8?q?=E8=AF=95=E9=A2=98=E4=B8=AD=E5=BF=83RPC=E5=A5=91=E7=BA=A6?= =?UTF-8?q?=EF=BC=8CDataService=E8=A1=A5=E8=80=83=E8=AF=95=E7=B1=BB?= =?UTF-8?q?=E5=9E=8B=E4=B8=8E=E7=A7=91=E7=9B=AE=E5=A2=9E=E5=88=A0=E6=94=B9?= =?UTF-8?q?=E6=96=B9=E6=B3=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- consumers/exam_service.php | 40 +++++++ consumers/notice_service.php | 40 +++++++ src/DataService/DataServiceInterface.php | 6 + src/ExamService/CampusRelationInterface.php | 18 +++ src/ExamService/CustomQuestionInterface.php | 67 +++++++++++ src/ExamService/ExamService.php | 23 ++++ src/ExamService/GufenPaperInterface.php | 71 ++++++++++++ src/ExamService/PaperImportInterface.php | 41 +++++++ src/ExamService/PaperInterface.php | 60 ++++++++++ src/ExamService/QuestionCategoryInterface.php | 31 +++++ src/ExamService/QuestionInterface.php | 66 +++++++++++ src/ExamService/QuestionNoteInterface.php | 48 ++++++++ src/ExamService/QuestionTypeInterface.php | 18 +++ src/ExamService/SmartPaperInterface.php | 82 +++++++++++++ src/ExamService/UserPaperInterface.php | 33 ++++++ .../NoticeAttachmentInterface.php | 33 ++++++ .../NoticePositionCollectInterface.php | 24 ++++ .../NoticePositionHistoryInterface.php | 82 +++++++++++++ src/NoticeService/NoticePositionInterface.php | 80 +++++++++++++ .../NoticePositionPkInterface.php | 24 ++++ src/NoticeService/NoticeService.php | 20 ++++ src/NoticeService/NoticeServiceInterface.php | 109 ++++++++++++++++++ src/NoticeService/NoticeStatsInterface.php | 12 ++ src/NoticeService/NoticeStatsLogInterface.php | 26 +++++ 24 files changed, 1054 insertions(+) create mode 100644 consumers/exam_service.php create mode 100644 consumers/notice_service.php create mode 100644 src/ExamService/CampusRelationInterface.php create mode 100644 src/ExamService/CustomQuestionInterface.php create mode 100644 src/ExamService/ExamService.php create mode 100644 src/ExamService/GufenPaperInterface.php create mode 100644 src/ExamService/PaperImportInterface.php create mode 100644 src/ExamService/PaperInterface.php create mode 100644 src/ExamService/QuestionCategoryInterface.php create mode 100644 src/ExamService/QuestionInterface.php create mode 100644 src/ExamService/QuestionNoteInterface.php create mode 100644 src/ExamService/QuestionTypeInterface.php create mode 100644 src/ExamService/SmartPaperInterface.php create mode 100644 src/ExamService/UserPaperInterface.php create mode 100644 src/NoticeService/NoticeAttachmentInterface.php create mode 100644 src/NoticeService/NoticePositionCollectInterface.php create mode 100644 src/NoticeService/NoticePositionHistoryInterface.php create mode 100644 src/NoticeService/NoticePositionInterface.php create mode 100644 src/NoticeService/NoticePositionPkInterface.php create mode 100644 src/NoticeService/NoticeService.php create mode 100644 src/NoticeService/NoticeServiceInterface.php create mode 100644 src/NoticeService/NoticeStatsInterface.php create mode 100644 src/NoticeService/NoticeStatsLogInterface.php 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 @@ +