notfff 6 месяцев назад
Родитель
Сommit
fa4bfab9a1
1 измененных файлов с 12 добавлено и 10 удалено
  1. 12 10
      app/Module/Test/README.md

+ 12 - 10
app/Module/Test/README.md

@@ -45,12 +45,10 @@ app/Module/Test/
 │   └── TestCommand.php        # 示例命令
 ├── Config/                     # 配置文件
 │   └── test.php               # 模块配置
+├── Casts/                      # 自定义类型转换器
+│   └── TestAttributesCast.php # 测试属性转换器
 ├── Databases/                  # 数据库相关
-│   ├── GenerateSql/           # SQL文件
-│   │   ├── test_items.sql     # 创建数据表的SQL
-│   │   └── test_logs.sql      # 日志表SQL
-│   └── Repositories/          # 数据仓库(后台专用)
-│       └── TestRepository.php # 测试仓库
+│   └── create.sql             # 数据库创建脚本
 ├── Docs/                       # 文档目录
 │   ├── README.md              # 模块文档索引
 │   ├── 设计文档.md             # 设计文档
@@ -73,6 +71,8 @@ app/Module/Test/
 │   └── TestLog.php            # 测试日志模型
 ├── Providers/                  # 服务提供者
 │   └── TestServiceProvider.php # 测试服务提供者
+├── Repositorys/                # 数据仓库(后台专用)
+│   └── TestRepository.php     # 测试仓库
 ├── Services/                   # 服务类(对外接口)
 │   └── TestService.php        # 测试服务
 ├── Validations/                # 验证类(业务验证)
@@ -90,8 +90,9 @@ app/Module/Test/
 |------|------|------|
 | **AdminControllers/** | 后台管理界面 | 继承自UCore\DcatAdmin\AdminController |
 | **Commands/** | 命令行工具 | 定时任务、数据处理等命令 |
+| **Casts/** | 自定义类型转换器 | 处理JSON属性等特殊字段 |
 | **Config/** | 配置文件 | 模块相关配置参数 |
-| **Databases/** | 数据库相关 | SQL文件和Repository类 |
+| **Databases/** | 数据库相关 | SQL创建脚本 |
 | **Docs/** | 文档目录 | 模块设计和开发文档 |
 | **Dtos/** | 数据传输对象 | 继承自UCore\Dto\BaseDto |
 | **Enums/** | 枚举定义 | 使用PHP enum语法,避免魔法数字 |
@@ -101,6 +102,7 @@ app/Module/Test/
 | **Logics/** | 业务逻辑 | 内部业务处理,不对外暴露 |
 | **Models/** | 数据模型 | 继承自UCore\ModelCore,无业务逻辑 |
 | **Providers/** | 服务提供者 | 注册服务和事件 |
+| **Repositorys/** | 数据仓库 | 封装数据库操作,仅供后台管理使用 |
 | **Services/** | 服务接口 | 对外提供功能,调用Logics层 |
 | **Validations/** | 验证类 | 复合验证逻辑 |
 | **Validators/** | 验证器 | 单一验证逻辑 |
@@ -140,7 +142,7 @@ Test模块采用标准的分层架构设计:
 - **服务层对外**:其他模块只能通过Services层访问功能,不直接访问其他模块模型
 - **逻辑层内部**:Logic类处理具体业务规则,服务层直接使用逻辑层和模型
 - **事件通信**:模块间通过事件进行松耦合通信,模块内部不使用事件机制
-- **数据访问**:Repository层仅供后台管理使用,参考Fund模块实现
+- **数据访问**:Repositorys层仅供后台管理使用,参考Fund模块实现
 - **DTO传输**:服务层返回DTO对象而非Model,Handler中将DTO转换为protobuf格式
 - **响应规范**:Handler成功时使用RESPONSE_CODE常量设置响应码,不使用魔法数字0
 
@@ -229,7 +231,7 @@ use App\Module\Test\Logics\Test as TestLogic;
  *
  * 设计原则:
  * - 对外Service使用静态方法,内部Logic类处理业务逻辑
- * - 服务层直接使用逻辑层和模型,不使用Repository
+ * - 服务层直接使用逻辑层和模型,不使用Repositorys
  * - 模块间通过Service层交互,不直接访问其他模块模型
  * - 服务层返回DTO对象而非Model
  */
@@ -477,7 +479,7 @@ namespace App\Module\Test\AdminControllers;
 
 use App\Module\Test\AdminControllers\Helper\TestGridHelper;
 use App\Module\Test\AdminControllers\Helper\TestFormHelper;
-use App\Module\Test\Repositories\TestRepository;
+use App\Module\Test\Repositorys\TestRepository;
 use UCore\DcatAdmin\AdminController;
 
 /**
@@ -487,7 +489,7 @@ use UCore\DcatAdmin\AdminController;
  * - 继承自UCore\DcatAdmin\AdminController
  * - 使用Grid/Show/Form的'make'方法实例化
  * - 使用GridHelper/ShowHelper/FormHelper/FilterHelper辅助类
- * - Repository类参考Fund模块实现,内部不包含方法,仅供后台管理数据访问
+ * - Repositorys类参考Fund模块实现,内部不包含方法,仅供后台管理数据访问
  * - 添加路由注释,加入后台菜单适当位置
  *
  * @route /admin/test-items