新增答题卡批改相关接口

This commit is contained in:
2026-08-20 13:57:29 +08:00
parent 716032432b
commit e768dfcbc3
7 changed files with 281 additions and 0 deletions

66
consumers/pg_service.php Normal file
View File

@@ -0,0 +1,66 @@
<?php
declare(strict_types=1);
/**
* This file is part of Hyperf.
*
* @link https://www.hyperf.io
* @document https://hyperf.wiki
* @contact group@hyperf.io
* @license https://github.com/hyperf/hyperf/blob/master/LICENSE
*/
use Dhd\Micro\Interface\PgService\PgService;
return [
// 对应消费者类的 $serviceName
'name' => 'PgService',
// 服务接口名,可选,默认值等于 name 配置的值,如果 name 直接定义为接口类则可忽略此行配置,如 name 为字符串则需要配置 service 对应到接口类
'service' => PgService::class,
// 对应容器对象 ID,可选,默认值等于 service 配置的值,用来定义依赖注入的 key
// 'id' => \App\JsonRpc\File\FileServiceInterface::class,
// 服务提供者的服务协议,可选,默认值为 jsonrpc-http
// 可选 jsonrpc-http jsonrpc jsonrpc-tcp-length-check
'protocol' => 'jsonrpc-http',
// 负载均衡算法,可选,默认值为 random
'load_balancer' => 'random',
// 这个消费者要从哪个服务中心获取节点信息,如不配置则不会从服务中心获取节点信息
'registry' => [
'protocol' => env('CONSUMERS_PROTOCOL', 'nacos'),
'address' => env('CONSUMERS_ADDRESS', 'http://192.168.28.199:8848'),
],
// 'nodes' => [
// [
// 'host' => env('NOTICE_SERVICE_HOST', '127.0.0.1'),
// 'port' => env('NOTICE_SERVICE_PORT', 9610),
// ],
// ],
// 配置项,会影响到 Packer 和 Transporter
'options' => [
'connect_timeout' => 5.0,
'recv_timeout' => 5.0,
'settings' => [
// 根据协议不同,区分配置
'open_eof_split' => true,
'package_eof' => "\r\n",
// 'open_length_check' => true,
// 'package_length_type' => 'N',
// 'package_length_offset' => 0,
// 'package_body_offset' => 4,
],
// 重试次数,默认值为 2,收包超时不进行重试。暂只支持 JsonRpcPoolTransporter
'retry_count' => 2,
// 重试间隔,毫秒
'retry_interval' => 100,
// 使用多路复用 RPC 时的心跳间隔,null 为不触发心跳
'heartbeat' => 30,
// 当使用 JsonRpcPoolTransporter 时会用到以下配置
'pool' => [
'min_connections' => 1,
'max_connections' => 32,
'connect_timeout' => 10.0,
'wait_timeout' => 3.0,
'heartbeat' => -1,
'max_idle_time' => 60.0,
],
],
];

View File

@@ -0,0 +1,14 @@
<?php
declare(strict_types=1);
namespace Dhd\Micro\Interface\PgService\JsonRpcInterface\Crm;
interface SchoolInterface
{
/**
* 获取学校下拉列表
* @return array
*/
public function getSchoolSelectList(): array;
}

View File

@@ -0,0 +1,51 @@
<?php
declare(strict_types=1);
namespace Dhd\Micro\Interface\PgService\JsonRpcInterface;
interface PgPaperInterface
{
/**
* 获取试卷分页列表
* @param array $params 请求参数
* @return array
*/
public function getPgPaperPageList(array $params): array;
/**
* 获取试卷详情
* @param int $id 试卷id
* @return array
*/
public function getPgPaperDetail(int $id): array;
/**
* 创建试卷及答案配置
* @param array $params 请求参数
* @return void
*/
public function createPgPaper(array $params): void;
/**
* 更新试卷及答案配置
* @param int $paperId 试卷ID
* @param array $params 请求参数
* @return void
*/
public function updatePgPaper(int $paperId, array $params): void;
/**
* 删除试卷
* @param int $id 试卷id
* @return void
*/
public function deletePgPaper(int $id): void;
/**
* 删除章节或答案配置
* @param int $id 章节或答案配置id
* @return void
*/
public function deletePgPaperAnswer(int $id): void;
}

View File

@@ -0,0 +1,43 @@
<?php
declare(strict_types=1);
namespace Dhd\Micro\Interface\PgService\JsonRpcInterface;
interface PgPhaseInterface
{
/**
* 获取阶段分页列表
* @param array $params 请求参数
* @return array
*/
public function getPgPhasePageList(array $params): array;
/**
* 获取阶段下拉列表
* @return array
*/
public function getPgPhaseSelectList(): array;
/**
* 创建阶段
* @param array $params 请求参数
* @return void
*/
public function createPgPhase(array $params): void;
/**
* 更新阶段
* @param int $id 阶段ID
* @param array $params 请求参数
* @return void
*/
public function updatePgPhase(int $id, array $params): void;
/**
* 删除阶段
* @param int $id 阶段ID
* @return void
*/
public function deletePgPhase(int $id): void;
}

View File

@@ -0,0 +1,43 @@
<?php
declare(strict_types=1);
namespace Dhd\Micro\Interface\PgService\JsonRpcInterface;
interface PgSubjectInterface
{
/**
* 获取学科分页列表
* @param array $params 请求参数
* @return array
*/
public function getPgSubjectPageList(array $params): array;
/**
* 获取学科下拉列表
* @return array
*/
public function getPgSubjectSelectList(): array;
/**
* 创建学科
* @param array $params 请求参数
* @return void
*/
public function createPgSubject(array $params): void;
/**
* 更新学科
* @param int $id 学科ID
* @param array $params 请求参数
* @return void
*/
public function updatePgSubject(int $id, array $params): void;
/**
* 删除学科
* @param int $id 学科ID
* @return void
*/
public function deletePgSubject(int $id): void;
}

View File

@@ -0,0 +1,48 @@
<?php
declare(strict_types=1);
namespace Dhd\Micro\Interface\PgService\JsonRpcInterface;
interface PgUserPaperRecordInterface
{
/**
* App获取试卷章节列表
* @param int $userId 用户id
* @param int $paperId 试卷id
* @return array
*/
public function appGetPgPaperSectionList(int $userId, int $paperId): array;
/**
* App获取试卷章节详情
* @param int $userId 用户id
* @param int $sectionId 章节id
* @return array
*/
public function appGetPgPaperSectionDetail(int $userId, int $sectionId): array;
/**
* 获取用户答题卡记录分页列表
* @param int $userId 用户id
* @param array $params 查询参数
* @return array
*/
public function appGetPgPaperHistory(int $userId, array $params): array;
/**
* 获取用户学习统计数据
* @param int $userId 用户id
* @return array
*/
public function getPgUserTotal(int $userId): array;
/**
* 用户提交答题卡
* @param int $userId 用户id
* @param array $params 答题卡数据
* @return void
*/
public function submitPgUserPaper(int $userId, array $params): void;
}

View File

@@ -0,0 +1,16 @@
<?php
declare(strict_types=1);
namespace Dhd\Micro\Interface\PgService;
use Dhd\Micro\Interface\PgService\JsonRpcInterface\Crm\SchoolInterface;
use Dhd\Micro\Interface\PgService\JsonRpcInterface\PgSubjectInterface;
use Dhd\Micro\Interface\PgService\JsonRpcInterface\PgPhaseInterface;
use Dhd\Micro\Interface\PgService\JsonRpcInterface\PgUserPaperRecordInterface;
interface PgService extends
SchoolInterface,
PgSubjectInterface,
PgPhaseInterface,
PgUserPaperRecordInterface {}