调整、梳理题库中心接口配置

This commit is contained in:
2026-08-20 09:13:34 +08:00
parent 9d191c2875
commit 2c1e4b2327
14 changed files with 142 additions and 123 deletions

View File

@@ -4,10 +4,24 @@ declare(strict_types=1);
namespace Dhd\Micro\Interface\ExamService;
/**
* 试题中心聚合契约
*/
use Dhd\Micro\Interface\ExamService\JsonRpcInterface\ExamServiceInterface;
use Dhd\Micro\Interface\ExamService\JsonRpcInterface\UserPaperInterface;
use Dhd\Micro\Interface\ExamService\JsonRpcInterface\AiInterviewQuestionInterface;
use Dhd\Micro\Interface\ExamService\JsonRpcInterface\CustomQuestionInterface;
use Dhd\Micro\Interface\ExamService\JsonRpcInterface\PaperInterface;
use Dhd\Micro\Interface\ExamService\JsonRpcInterface\GufenPaperInterface;
use Dhd\Micro\Interface\ExamService\JsonRpcInterface\QuestionInterface;
use Dhd\Micro\Interface\ExamService\JsonRpcInterface\QuestionTypeInterface;
use Dhd\Micro\Interface\ExamService\JsonRpcInterface\QuestionCategoryInterface;
use Dhd\Micro\Interface\ExamService\JsonRpcInterface\SmartPaperInterface;
use Dhd\Micro\Interface\ExamService\JsonRpcInterface\CampusRelationInterface;
use Dhd\Micro\Interface\ExamService\JsonRpcInterface\PaperImportInterface;
use Dhd\Micro\Interface\ExamService\JsonRpcInterface\QuestionNoteInterface;
interface ExamService extends
ExamServiceInterface,
UserPaperInterface,
AiInterviewQuestionInterface,
CustomQuestionInterface,
PaperInterface,
GufenPaperInterface,
@@ -15,99 +29,6 @@ interface ExamService extends
QuestionTypeInterface,
QuestionCategoryInterface,
SmartPaperInterface,
UserPaperInterface,
CampusRelationInterface,
PaperImportInterface,
QuestionNoteInterface,
AiInterviewQuestionInterface
{
/**
* 获取练习列表.
*/
public function getPracticeList(int $userId): array;
/**
* 获取练习详情.
*/
public function getPracticeDetail(int $userId, int $id): array;
/**
* 提交练习答案.
*/
public function submitPractice(int $userId, int $paperId, array $answers): array;
/**
* 开始考试.
*/
public function startExam(array $params): array;
/**
* 提交考试.
*/
public function submitExam(array $params): array;
/**
* 获取用户考试记录列表.
*/
public function getUserExamRecords(array $params): array;
/**
* 获取考试记录详情.
*/
public function getExamRecordDetail(int $recordId, int $userId): array;
/**
* 获取考试记录题目列表.
*/
public function getByRecordId(int $userId, int $recordId): array;
/**
* 保存用户答题记录.
*/
public function saveAnswer(array $params): bool;
/**
* 获取用户错题列表.
*/
public function getUserWrongQuestions(array $params): array;
/**
* 标记错题为已掌握.
*/
public function markAsMastered(int $userId, int $wrongId): bool;
/**
* 添加错题笔记(避免与题目笔记 addNote 重名).
*/
public function addWrongQuestionNote(array $params): bool;
/**
* 获取题目错误统计.
*/
public function getErrorStats(int $userId, int $questionId): array;
/**
* 批量更新题目得分.
*/
public function batchUpdateScores(array $params): bool;
/**
* 获取考试类型列表(V1 兼容接口).
*/
public function getExamTypeList(array $params): array;
/**
* 获取考试类型详情(V1 兼容接口).
*/
public function getExamTypeDetail(int $id): array;
/**
* 获取科目列表(V1 兼容接口).
*/
public function getSubjectList(array $params): array;
/**
* 获取题库列表(V1 兼容接口).
*/
public function getQuestionStoreList(array $params): array;
}
QuestionNoteInterface {}

View File

@@ -1,8 +1,6 @@
<?php
declare(strict_types=1);
namespace Dhd\Micro\Interface\ExamService;
namespace Dhd\Micro\Interface\ExamService\JsonRpcInterface;
interface AiInterviewQuestionInterface
{

View File

@@ -2,7 +2,7 @@
declare(strict_types=1);
namespace Dhd\Micro\Interface\ExamService;
namespace Dhd\Micro\Interface\ExamService\JsonRpcInterface;
interface CampusRelationInterface
{

View File

@@ -2,7 +2,7 @@
declare(strict_types=1);
namespace Dhd\Micro\Interface\ExamService;
namespace Dhd\Micro\Interface\ExamService\JsonRpcInterface;
interface CustomQuestionInterface
{

View File

@@ -0,0 +1,112 @@
<?php
declare(strict_types=1);
namespace Dhd\Micro\Interface\ExamService\JsonRpcInterface;
/**
* 试题中心聚合契约
*/
interface ExamServiceInterface
{
/**
* 获取练习列表.
*/
public function getPracticeList(int $userId): array;
/**
* 获取练习详情.
*/
public function getPracticeDetail(int $userId, int $id): array;
/**
* 提交练习答案.
*/
public function submitPractice(int $userId, int $paperId, array $answers): array;
/**
* 开始考试.
*/
public function startExam(array $params): array;
/**
* 提交考试.
*/
public function submitExam(array $params): array;
/**
* 获取用户考试记录列表.
*/
public function getUserExamRecords(array $params): array;
/**
* 获取考试记录详情.
*/
public function getExamRecordDetail(int $recordId, int $userId): array;
/**
* 获取考试记录题目列表.
*/
public function getByRecordId(int $userId, int $recordId): array;
/**
* 保存用户答题记录.
*/
public function saveAnswer(array $params): bool;
/**
* 获取用户错题列表.
*/
public function getUserWrongQuestions(array $params): array;
/**
* 标记错题为已掌握.
*/
public function markAsMastered(int $userId, int $wrongId): bool;
/**
* 添加错题笔记(避免与题目笔记 addNote 重名).
*/
public function addWrongQuestionNote(array $params): bool;
/**
* 获取题目错误统计.
*/
public function getErrorStats(int $userId, int $questionId): array;
/**
* 批量更新题目得分.
*/
public function batchUpdateScores(array $params): bool;
/**
* 获取考试类型列表(V1 兼容接口).
*/
public function getExamTypeList(array $params): array;
/**
* 获取考试类型详情(V1 兼容接口).
*/
public function getExamTypeDetail(int $id): array;
/**
* 获取科目列表(V1 兼容接口).
*/
public function getSubjectList(array $params): array;
/**
* 获取题库列表(V1 兼容接口).
*/
public function getQuestionStoreList(array $params): array;
/**
* 提交题目答案,根据试卷类型自动选择智能组卷或普通试卷逻辑.
*/
public function submitAnswer(array $params, int $userId): array;
/**
* 提交用户试卷,根据试卷类型自动选择智能组卷或普通试卷逻辑.
*/
public function submitUserPaper(array $params): array;
}

View File

@@ -2,7 +2,7 @@
declare(strict_types=1);
namespace Dhd\Micro\Interface\ExamService;
namespace Dhd\Micro\Interface\ExamService\JsonRpcInterface;
interface GufenPaperInterface
{

View File

@@ -2,7 +2,7 @@
declare(strict_types=1);
namespace Dhd\Micro\Interface\ExamService;
namespace Dhd\Micro\Interface\ExamService\JsonRpcInterface;
interface PaperImportInterface
{

View File

@@ -2,7 +2,7 @@
declare(strict_types=1);
namespace Dhd\Micro\Interface\ExamService;
namespace Dhd\Micro\Interface\ExamService\JsonRpcInterface;
interface PaperInterface
{

View File

@@ -2,7 +2,7 @@
declare(strict_types=1);
namespace Dhd\Micro\Interface\ExamService;
namespace Dhd\Micro\Interface\ExamService\JsonRpcInterface;
interface QuestionCategoryInterface
{

View File

@@ -2,7 +2,7 @@
declare(strict_types=1);
namespace Dhd\Micro\Interface\ExamService;
namespace Dhd\Micro\Interface\ExamService\JsonRpcInterface;
interface QuestionInterface
{

View File

@@ -2,7 +2,7 @@
declare(strict_types=1);
namespace Dhd\Micro\Interface\ExamService;
namespace Dhd\Micro\Interface\ExamService\JsonRpcInterface;
interface QuestionNoteInterface
{

View File

@@ -2,7 +2,7 @@
declare(strict_types=1);
namespace Dhd\Micro\Interface\ExamService;
namespace Dhd\Micro\Interface\ExamService\JsonRpcInterface;
interface QuestionTypeInterface
{

View File

@@ -2,7 +2,7 @@
declare(strict_types=1);
namespace Dhd\Micro\Interface\ExamService;
namespace Dhd\Micro\Interface\ExamService\JsonRpcInterface;
interface SmartPaperInterface
{
@@ -22,8 +22,6 @@ interface SmartPaperInterface
*/
public function getUserSmartPaperDetail(int $paperRecordId, bool $getCorrect): array;
// submitAnswer/submitUserPaper 与 UserPaperInterface 重名,统一由 UserPaperInterface 声明,避免聚合接口代理重复声明
/**
* 获取用户试卷历史列表
* @param array $params 参数:campus_id, exam_type_id, page, limit

View File

@@ -2,7 +2,7 @@
declare(strict_types=1);
namespace Dhd\Micro\Interface\ExamService;
namespace Dhd\Micro\Interface\ExamService\JsonRpcInterface;
interface UserPaperInterface
{
@@ -11,16 +11,6 @@ interface UserPaperInterface
*/
public function startDoPaper(int $userId, int $paperId): array;
/**
* 提交题目答案
*/
public function submitAnswer(array $params, int $userId): array;
/**
* 提交用户试卷
*/
public function submitUserPaper(array $params): array;
/**
* 获取用户试卷详情
*/