DataService契约按实际提供方修正,拆分Course/Exam服务契约并补消费者配置
This commit is contained in:
543
src/ExamService/ExamServiceInterface.php
Normal file
543
src/ExamService/ExamServiceInterface.php
Normal file
@@ -0,0 +1,543 @@
|
||||
<?php
|
||||
|
||||
namespace Dhd\Micro\Interface\ExamService;
|
||||
|
||||
interface ExamServiceInterface extends GufenPaperInterface
|
||||
{
|
||||
// 练习相关
|
||||
/**
|
||||
* 获取练习列表.
|
||||
* @param int $userId 用户ID
|
||||
* @return array 练习列表
|
||||
*/
|
||||
public function getPracticeList(int $userId): array;
|
||||
|
||||
/**
|
||||
* 获取练习详情.
|
||||
* @param int $userId 用户ID
|
||||
* @param int $id 练习ID
|
||||
* @return array 练习详情
|
||||
*/
|
||||
public function getPracticeDetail(int $userId, int $id): array;
|
||||
|
||||
// 考试类型相关
|
||||
|
||||
/**
|
||||
* 获取考试类型列表.
|
||||
* @param array $params
|
||||
* @return array
|
||||
*/
|
||||
public function getExamTypeList(array $params): array;
|
||||
|
||||
/**
|
||||
* 获取考试类型详情.
|
||||
* @param int $id 考试类型ID
|
||||
* @return array 考试类型详情
|
||||
*/
|
||||
public function getExamTypeDetail(int $id): array;
|
||||
|
||||
/**
|
||||
* 创建考试类型.
|
||||
* @param array $params
|
||||
* @return bool 创建结果
|
||||
*/
|
||||
public function createExamType(array $params): bool;
|
||||
|
||||
/**
|
||||
* 更新考试类型.
|
||||
* @param int $id 考试类型ID
|
||||
* @param array $params
|
||||
* @return bool 更新结果
|
||||
*/
|
||||
public function updateExamType(int $id, array $params): bool;
|
||||
|
||||
/**
|
||||
* 删除考试类型.
|
||||
* @param int $id 考试类型ID
|
||||
* @return bool 删除结果
|
||||
*/
|
||||
public function deleteExamType(int $id): bool;
|
||||
|
||||
// 题目素材相关
|
||||
|
||||
/**
|
||||
* 获取素材列表.
|
||||
* @param array $params
|
||||
* @return array
|
||||
*/
|
||||
public function getQuestionMaterialList(array $params): array;
|
||||
|
||||
/**
|
||||
* 获取素材详情.
|
||||
* @param int $id
|
||||
* @return array
|
||||
*/
|
||||
public function getQuestionMaterialDetail(int $id): array;
|
||||
|
||||
/**
|
||||
* 创建素材.
|
||||
* @param array $params
|
||||
* @return bool 创建结果
|
||||
*/
|
||||
public function createQuestionMaterial(array $params): bool;
|
||||
|
||||
/**
|
||||
* 更新素材.
|
||||
* @param int $id 素材ID
|
||||
* @param array $params
|
||||
* @return bool 更新结果
|
||||
*/
|
||||
public function updateQuestionMaterial(int $id, array $params): bool;
|
||||
|
||||
/**
|
||||
* 删除素材.
|
||||
* @param int $id 素材ID
|
||||
* @return bool 删除结果
|
||||
*/
|
||||
public function deleteQuestionMaterial(int $id): bool;
|
||||
|
||||
// 题目相关
|
||||
|
||||
/**
|
||||
* 获取题目列表.
|
||||
* @param array $params
|
||||
* @return array
|
||||
*/
|
||||
public function getQuestionList(array $params): array;
|
||||
|
||||
/**
|
||||
* 获取题目详情.
|
||||
* @param int $id
|
||||
* @return array
|
||||
*/
|
||||
public function getQuestionDetail(int $id): array;
|
||||
|
||||
/**
|
||||
* 创建题目.
|
||||
* @param array $params
|
||||
* @return bool 创建结果
|
||||
*/
|
||||
public function createQuestion(array $params): bool;
|
||||
|
||||
/**
|
||||
* 更新题目.
|
||||
* @param int $id 题目ID
|
||||
* @param array $params
|
||||
* @return bool 更新结果
|
||||
*/
|
||||
public function updateQuestion(int $id, array $params): bool;
|
||||
|
||||
/**
|
||||
* 删除题目.
|
||||
* @param int $id 素材ID
|
||||
* @return bool 删除结果
|
||||
*/
|
||||
public function deleteQuestion(int $id): bool;
|
||||
|
||||
/**
|
||||
* 搜索题目.
|
||||
* @param array $params
|
||||
* @return array
|
||||
*/
|
||||
public function searchQuestion(array $params): array;
|
||||
|
||||
// 题目选项相关
|
||||
|
||||
/**
|
||||
* 批量创建题目选项.
|
||||
* @param int $questionId
|
||||
* @param array $options
|
||||
* @return bool
|
||||
*/
|
||||
public function batchCreateQuestionOptions(int $questionId, array $options): bool;
|
||||
|
||||
/**
|
||||
* 调整题目选项排序.
|
||||
* @param int $questionId
|
||||
* @param array $sortData
|
||||
* @return bool
|
||||
*/
|
||||
public function adjustQuestionOptionSort(int $questionId, array $sortData): bool;
|
||||
|
||||
/**
|
||||
* 删除题目选项.
|
||||
* @param int $questionId
|
||||
* @return bool
|
||||
*/
|
||||
public function deleteQuestionOptionsByQuestionId(int $questionId): bool;
|
||||
|
||||
// 题库相关
|
||||
|
||||
/**
|
||||
* 获取题库列表.
|
||||
* @param array $params
|
||||
* @return array
|
||||
*/
|
||||
public function getQuestionStoreList(array $params): array;
|
||||
|
||||
/**
|
||||
* 获取题库详情.
|
||||
* @param int $id
|
||||
* @return array
|
||||
*/
|
||||
public function getQuestionStoreDetail(int $id): array;
|
||||
|
||||
/**
|
||||
* 创建题库.
|
||||
* @param array $params
|
||||
* @return bool 创建结果
|
||||
*/
|
||||
public function createQuestionStore(array $params): bool;
|
||||
|
||||
/**
|
||||
* 更新题库.
|
||||
* @param int $id 题库ID
|
||||
* @param array $params
|
||||
* @return bool 更新结果
|
||||
*/
|
||||
public function updateQuestionStore(int $id, array $params): bool;
|
||||
|
||||
/**
|
||||
* 删除题库.
|
||||
* @param int $id 题库ID
|
||||
* @return bool 删除结果
|
||||
*/
|
||||
public function deleteQuestionStore(int $id): bool;
|
||||
|
||||
// 题型相关
|
||||
|
||||
/**
|
||||
* 获取题型列表.
|
||||
* @param array $params
|
||||
* @return array
|
||||
*/
|
||||
public function getQuestionTypeList(array $params): array;
|
||||
|
||||
/**
|
||||
* 获取题型详情.
|
||||
* @param int $id
|
||||
* @return array
|
||||
*/
|
||||
public function getQuestionTypeDetail(int $id): array;
|
||||
|
||||
/**
|
||||
* 创建题型.
|
||||
* @param array $params
|
||||
* @return bool 创建结果
|
||||
*/
|
||||
public function createQuestionType(array $params): bool;
|
||||
|
||||
/**
|
||||
* 删除题型.
|
||||
* @param int $id 题型ID
|
||||
* @return bool 删除结果
|
||||
*/
|
||||
public function updateQuestionType(int $id, array $params): bool;
|
||||
|
||||
/**
|
||||
* 删除题型.
|
||||
* @param int $id 题型ID
|
||||
* @return bool 删除结果
|
||||
*/
|
||||
public function deleteQuestionType(int $id): bool;
|
||||
|
||||
// 科目相关
|
||||
|
||||
/**
|
||||
* 获取科目列表.
|
||||
* @param array $params
|
||||
* @return array
|
||||
*/
|
||||
public function getSubjectList(array $params): array;
|
||||
|
||||
/**
|
||||
* 获取科目详情.
|
||||
* @param int $id
|
||||
* @return array
|
||||
*/
|
||||
public function getSubjectDetail(int $id): array;
|
||||
|
||||
/**
|
||||
* 创建科目.
|
||||
* @param array $params
|
||||
* @return bool 创建结果
|
||||
*/
|
||||
public function createSubject(array $params): bool;
|
||||
|
||||
/**
|
||||
* 更新科目.
|
||||
* @param int $id 科目ID
|
||||
* @return bool 更新结果
|
||||
*/
|
||||
public function updateSubject(int $id, array $params): bool;
|
||||
|
||||
/**
|
||||
* 删除科目.
|
||||
* @param int $id 科目ID
|
||||
* @return bool 删除结果
|
||||
*/
|
||||
public function deleteSubject(int $id): bool;
|
||||
|
||||
// 用户试卷记录相关
|
||||
|
||||
/**
|
||||
* 开始考试(创建试卷记录).
|
||||
* @param array $params
|
||||
* - user_id: 用户ID
|
||||
* - paper_id: 试卷ID
|
||||
* @return array 试卷记录信息
|
||||
*/
|
||||
public function startExam(array $params): array;
|
||||
|
||||
/**
|
||||
* 提交试卷.
|
||||
* @param array $params
|
||||
* - record_id: 试卷记录ID
|
||||
* - user_id: 用户ID(验证权限)
|
||||
* @return array 考试结果
|
||||
*/
|
||||
public function submitExam(array $params): array;
|
||||
|
||||
/**
|
||||
* 获取用户试卷记录列表.
|
||||
* @param array $params
|
||||
* - user_id: 用户ID
|
||||
* - page: 页码
|
||||
* - size: 每页条数
|
||||
* - status: 状态筛选
|
||||
* @return array 分页记录
|
||||
*/
|
||||
public function getUserRecords(array $params): array;
|
||||
|
||||
/**
|
||||
* 获取试卷记录详情.
|
||||
* @param int $recordId 记录ID
|
||||
* @param int $userId 用户ID(验证权限)
|
||||
* @return array 详情信息
|
||||
*/
|
||||
public function getRecordDetail(int $recordId, int $userId): array;
|
||||
|
||||
/**
|
||||
* 获取用户考试记录列表.
|
||||
* @param array $params
|
||||
* @return array
|
||||
*/
|
||||
public function getUserExamRecords(array $params): array;
|
||||
|
||||
/**
|
||||
* 获取考试记录详情.
|
||||
* @param int $recordId 考试记录ID
|
||||
* @param int $userId 用户ID(验证权限)
|
||||
* @return array 详情信息
|
||||
*/
|
||||
public function getExamRecordDetail(int $recordId, int $userId): array;
|
||||
|
||||
// 试卷相关
|
||||
|
||||
/**
|
||||
* 创建试卷.
|
||||
* @param array $params
|
||||
* @return bool
|
||||
*/
|
||||
public function createPaper(array $params): bool;
|
||||
|
||||
/**
|
||||
* 更新试卷.
|
||||
* @param int $id 试卷ID
|
||||
* @param array $params
|
||||
* @return bool
|
||||
*/
|
||||
public function updatePaper(int $id, array $params): bool;
|
||||
|
||||
/**
|
||||
* 添加题目到试卷.
|
||||
* @param int $paperId
|
||||
* @param array $questionData
|
||||
* @return bool
|
||||
*/
|
||||
public function addQuestionsToPaper(int $paperId, array $questionData): bool;
|
||||
|
||||
/**
|
||||
* 从试卷中移除题目.
|
||||
* @param int $paperId
|
||||
* @param array $questionIds
|
||||
* @return bool
|
||||
*/
|
||||
public function removeQuestionsFromPaper(int $paperId, array $questionIds): bool;
|
||||
|
||||
/**
|
||||
* 获取试卷详情.
|
||||
* @param int $id
|
||||
* @return array
|
||||
*/
|
||||
public function getPaperDetail(int $id): array;
|
||||
|
||||
// 试卷生成相关
|
||||
|
||||
/**
|
||||
* 根据策略生成试卷.
|
||||
* @param array $params
|
||||
* @return array
|
||||
*/
|
||||
public function generateByStrategy(array $params): array;
|
||||
|
||||
/**
|
||||
* 手动生成试卷.
|
||||
* @param array $params
|
||||
* @return array
|
||||
*/
|
||||
public function generateManual(array $params): array;
|
||||
|
||||
// 素材相关
|
||||
|
||||
/**
|
||||
* 获取素材列表.
|
||||
* @param array $params
|
||||
* @return array
|
||||
*/
|
||||
public function getMaterialList(array $params): array;
|
||||
|
||||
/**
|
||||
* 获取素材详情.
|
||||
* @param int $id
|
||||
* @return array
|
||||
*/
|
||||
public function getMaterialDetail(int $id): array;
|
||||
|
||||
/**
|
||||
* 创建素材.
|
||||
* @param array $params
|
||||
* @return bool
|
||||
*/
|
||||
public function createMaterial(array $params): bool;
|
||||
|
||||
/**
|
||||
* 更新素材.
|
||||
* @param int $id 素材ID
|
||||
* @param array $params
|
||||
* @return bool
|
||||
*/
|
||||
public function updateMaterial(int $id, array $params): bool;
|
||||
|
||||
/**
|
||||
* 删除素材.
|
||||
* @param int $id 素材ID
|
||||
* @return bool
|
||||
*/
|
||||
public function deleteMaterial(int $id): bool;
|
||||
|
||||
// 题目标签关联相关
|
||||
|
||||
/**
|
||||
* 添加题目标签.
|
||||
* @param int $questionId
|
||||
* @param array $tagIds
|
||||
* @return bool
|
||||
*/
|
||||
public function attachQuestionTags(int $questionId, array $tagIds): bool;
|
||||
|
||||
/**
|
||||
* 删除题目标签.
|
||||
* @param int $questionId
|
||||
* @param array $tagIds
|
||||
* @return bool
|
||||
*/
|
||||
public function detachQuestionTags(int $questionId, array $tagIds = []): bool;
|
||||
|
||||
/**
|
||||
* 获取题目标签.
|
||||
* @param int $questionId
|
||||
* @return array
|
||||
*/
|
||||
public function getQuestionTags(int $questionId): array;
|
||||
|
||||
/**
|
||||
* 获取用户错题列表.
|
||||
* @param array $params
|
||||
* - user_id: 用户ID
|
||||
* - page: 页码
|
||||
* - size: 每页条数
|
||||
* - subject_id: 科目筛选
|
||||
* @return array 分页错题列表
|
||||
*/
|
||||
public function getUserWrongQuestions(array $params): array;
|
||||
|
||||
/**
|
||||
* 标记错题为已掌握
|
||||
* @param int $userId 用户ID
|
||||
* @param int $wrongId 错题ID
|
||||
* @return bool 操作结果
|
||||
*/
|
||||
public function markAsMastered(int $userId, int $wrongId): bool;
|
||||
|
||||
/**
|
||||
* 添加错题笔记.
|
||||
* @param array $params
|
||||
* - wrong_id: 错题ID
|
||||
* - user_id: 用户ID
|
||||
* - note: 笔记内容
|
||||
* @return bool 操作结果
|
||||
*/
|
||||
public function addNote(array $params): bool;
|
||||
|
||||
/**
|
||||
* 获取题目错误统计
|
||||
* @param int $userId 用户ID
|
||||
* @param int $questionId 题目ID
|
||||
* @return array 统计信息
|
||||
*/
|
||||
public function getErrorStats(int $userId, int $questionId): array;
|
||||
|
||||
/**
|
||||
* 保存用户答题记录.
|
||||
* @param array $params
|
||||
* - user_id: 用户ID
|
||||
* - record_id: 试卷记录ID
|
||||
* - question_id: 题目ID
|
||||
* - user_answer: 用户答案
|
||||
* @return bool 操作结果
|
||||
*/
|
||||
public function saveAnswer(array $params): bool;
|
||||
|
||||
/**
|
||||
* 获取试卷内用户答题记录.
|
||||
* @param int $userId 用户ID
|
||||
* @param int $recordId 试卷记录ID
|
||||
* @return array 答题记录列表
|
||||
*/
|
||||
public function getByRecordId(int $userId, int $recordId): array;
|
||||
|
||||
/**
|
||||
* 批量更新题目得分.
|
||||
* @param array $params
|
||||
* - record_id: 试卷记录ID
|
||||
* - scores: 得分数据 [{question_id: 1, score: 5, is_correct: true}, ...]
|
||||
* @return bool 操作结果
|
||||
*/
|
||||
public function batchUpdateScores(array $params): bool;
|
||||
|
||||
public function getCategoryList(array $params): array;
|
||||
|
||||
public function getSubQuestionCategoryList(array $data): array;
|
||||
|
||||
public function getCategoryDetail(int $id): array;
|
||||
|
||||
public function getCategoriesByIds(array $ids): array;
|
||||
|
||||
public function createCategory(array $params): array;
|
||||
|
||||
public function updateCategory(int $id, array $params): array;
|
||||
|
||||
public function deleteCategory(int $id): array;
|
||||
|
||||
public function getCategoryTree(array $ids = []): array;
|
||||
|
||||
public function getCategoryOptions(): array;
|
||||
|
||||
/**
|
||||
* 查询指定分类下的题库数量
|
||||
* @param int $categoryId 分类ID
|
||||
* @return int 题库数量
|
||||
*/
|
||||
public function getQuestionCountByCategory(int $categoryId): int;
|
||||
}
|
||||
9
src/ExamService/GufenPaperInterface.php
Normal file
9
src/ExamService/GufenPaperInterface.php
Normal file
@@ -0,0 +1,9 @@
|
||||
<?php
|
||||
|
||||
namespace Dhd\Micro\Interface\ExamService;
|
||||
|
||||
interface GufenPaperInterface
|
||||
{
|
||||
//更新估分职位信息
|
||||
public function editGufenPosition(array $params): array;
|
||||
}
|
||||
Reference in New Issue
Block a user