|
|
@@ -1,197 +0,0 @@
|
|
|
-# Fund模块迁移文档
|
|
|
-
|
|
|
-## 目录结构迁移
|
|
|
-
|
|
|
-### 旧目录结构
|
|
|
-```
|
|
|
-app/Module/Fund1/
|
|
|
-├── ModelLaravel/ # 模型目录
|
|
|
-├── Enums/ # 枚举目录
|
|
|
-├── Exception/ # 异常目录
|
|
|
-├── Item/ # 数据项目录
|
|
|
-├── Model/ # 模型目录
|
|
|
-├── Repositories/ # 仓库目录
|
|
|
-├── Service/ # 服务目录
|
|
|
-├── Validation/ # 验证规则目录
|
|
|
-├── Validator/ # 验证器目录
|
|
|
-├── constt/ # 常量目录
|
|
|
-└── 根目录文件
|
|
|
-```
|
|
|
-
|
|
|
-### 新目录结构
|
|
|
-```
|
|
|
-app/Module/Fund/
|
|
|
-├── Controllers/ # 控制器目录
|
|
|
-├── AdminControllers/ # 后台控制器目录
|
|
|
-├── Models/ # 模型目录
|
|
|
-├── Repositorys/ # 仓库目录
|
|
|
-├── Services/ # 服务目录
|
|
|
-├── Validators/ # 验证器目录
|
|
|
-├── Validations/ # 验证规则目录
|
|
|
-├── Enums/ # 枚举目录
|
|
|
-├── Config/ # 配置目录
|
|
|
-├── Database/ # 数据库目录
|
|
|
-│ ├── Migrations/ # 迁移文件
|
|
|
-│ └── Seeders/ # 数据填充
|
|
|
-└── Tests/ # 测试目录
|
|
|
-```
|
|
|
-
|
|
|
-## 命名空间迁移
|
|
|
-
|
|
|
-### 旧命名空间
|
|
|
-```php
|
|
|
-namespace Fund;
|
|
|
-namespace Fund\Enums;
|
|
|
-namespace Fund\Model;
|
|
|
-namespace Fund\ModelLaravel;
|
|
|
-namespace Fund\Repositories;
|
|
|
-namespace Fund\Service;
|
|
|
-namespace Fund\Validator;
|
|
|
-namespace Fund\Validation;
|
|
|
-namespace Fund\constt;
|
|
|
-```
|
|
|
-
|
|
|
-### 新命名空间
|
|
|
-```php
|
|
|
-namespace App\Module\Fund;
|
|
|
-namespace App\Module\Fund\Controllers;
|
|
|
-namespace App\Module\Fund\AdminControllers;
|
|
|
-namespace App\Module\Fund\Models;
|
|
|
-namespace App\Module\Fund\Repositorys;
|
|
|
-namespace App\Module\Fund\Services;
|
|
|
-namespace App\Module\Fund\Validators;
|
|
|
-namespace App\Module\Fund\Validations;
|
|
|
-namespace App\Module\Fund\Enums;
|
|
|
-```
|
|
|
-
|
|
|
-## 类名迁移
|
|
|
-
|
|
|
-### 核心类
|
|
|
-| 旧类名 | 新类名 | 说明 |
|
|
|
-|--------|--------|------|
|
|
|
-| `Fund\CoreService` | `App\Module\Fund\CoreService` | 核心服务基类 |
|
|
|
-| `Fund\CoreValidation` | 移除 | 功能合并到Validators |
|
|
|
-
|
|
|
-### 服务类
|
|
|
-| 旧类名 | 新类名 | 说明 |
|
|
|
-|--------|--------|------|
|
|
|
-| `Fund\Fund` | `App\Module\Fund\Services\FundService` | 资金服务 |
|
|
|
-| `Fund\Account` | `App\Module\Fund\Services\AccountService` | 账户服务 |
|
|
|
-| `Fund\Task` | `App\Module\Fund\Services\TaskService` | 任务服务 |
|
|
|
-| `Fund\Currency` | `App\Module\Fund\Services\CurrencyService` | 货币服务 |
|
|
|
-| `Fund\External` | `App\Module\Fund\Services\ExternalService` | 外部服务 |
|
|
|
-| `Fund\Order` | `App\Module\Fund\Services\OrderService` | 订单服务 |
|
|
|
-| `Fund\Rechange` | `App\Module\Fund\Services\RechangeService` | 充值服务 |
|
|
|
-| `Fund\Withdrawal` | `App\Module\Fund\Services\WithdrawalService` | 提现服务 |
|
|
|
-| `Fund\Settlement` | `App\Module\Fund\Services\SettlementService` | 结算服务 |
|
|
|
-
|
|
|
-### 模型类
|
|
|
-| 旧类名 | 新类名 | 说明 |
|
|
|
-|--------|--------|------|
|
|
|
-| `Fund\ModelLaravel\Fund` | `App\Module\Fund\Models\FundModel` | 资金模型 |
|
|
|
-| `Fund\ModelLaravel\FundLog` | `App\Module\Fund\Models\FundLogModel` | 资金日志模型 |
|
|
|
-| `Fund\ModelLaravel\FundOrder` | `App\Module\Fund\Models\FundOrderModel` | 资金订单模型 |
|
|
|
-| `Fund\ModelLaravel\FundAdmin` | `App\Module\Fund\Models\FundAdminModel` | 资金管理模型 |
|
|
|
-| `Fund\ModelLaravel\FundConfig` | `App\Module\Fund\Models\FundConfigModel` | 资金配置模型 |
|
|
|
-| `Fund\ModelLaravel\FundCurrency` | `App\Module\Fund\Models\FundCurrencyModel` | 货币模型 |
|
|
|
-| `Fund\ModelLaravel\FundExternal` | `App\Module\Fund\Models\FundExternalModel` | 外部资金模型 |
|
|
|
-
|
|
|
-### 验证器类
|
|
|
-| 旧类名 | 新类名 | 说明 |
|
|
|
-|--------|--------|------|
|
|
|
-| `Fund\Validator\UserFund1Check` | `App\Module\Fund\Validators\FundValidator::validateBalance` | 账户余额检查 |
|
|
|
-| `Fund\Validator\UserFundCheck1000` | `App\Module\Fund\Validators\FundValidator::validateBalance1000` | 1000倍数余额检查 |
|
|
|
-| `Fund\Validator\FundIdCheck` | `App\Module\Fund\Validators\FundValidator::validateFundId` | 资金ID检查 |
|
|
|
-
|
|
|
-### 枚举类
|
|
|
-| 旧类名 | 新类名 | 说明 |
|
|
|
-|--------|--------|------|
|
|
|
-| `Fund\Enums\Fund` | `App\Module\Fund\Enums\FundType` | 资金类型枚举 |
|
|
|
-| `Fund\Enums\FundCurrency` | `App\Module\Fund\Enums\FundCurrencyType` | 货币类型枚举 |
|
|
|
-| 新增 | `App\Module\Fund\Enums\ExternalStatus` | 外部状态枚举 |
|
|
|
-
|
|
|
-### 仓库类
|
|
|
-| 旧类名 | 新类名 | 说明 |
|
|
|
-|--------|--------|------|
|
|
|
-| `Fund\Repositories\Fund` | `App\Module\Fund\Repositorys\FundRepository` | 资金仓库 |
|
|
|
-| `Fund\Repositories\FundLog` | `App\Module\Fund\Repositorys\FundLogRepository` | 资金日志仓库 |
|
|
|
-| `Fund\Repositories\FundOrder` | `App\Module\Fund\Repositorys\FundOrderRepository` | 资金订单仓库 |
|
|
|
-
|
|
|
-## 数据库表
|
|
|
-
|
|
|
-保持不变的表:
|
|
|
-- `fund` - 资金表
|
|
|
-- `fund_log` - 资金日志表
|
|
|
-- `fund_order` - 资金订单表
|
|
|
-- `fund_admin` - 资金管理表
|
|
|
-- `fund_config` - 资金配置表
|
|
|
-- `fund_currency` - 货币表
|
|
|
-- `fund_external` - 外部资金表
|
|
|
-
|
|
|
-## 主要改进
|
|
|
-
|
|
|
-1. 规范化
|
|
|
- - 统一命名空间为 `App\Module\Fund`
|
|
|
- - 统一类名规范(添加Service/Model/Repository等后缀)
|
|
|
- - 统一目录结构
|
|
|
-
|
|
|
-2. 功能优化
|
|
|
- - 将验证器统一到 `FundValidator` 类
|
|
|
- - 将服务类统一到 `Services` 目录
|
|
|
- - 将模型类统一到 `Models` 目录
|
|
|
- - 将仓库类统一到 `Repositorys` 目录
|
|
|
-
|
|
|
-3. 新增功能
|
|
|
- - 添加事务管理 `TransactionManager`
|
|
|
- - 完善外部资金处理
|
|
|
- - 完善订单管理
|
|
|
- - 添加缓存支持
|
|
|
-
|
|
|
-4. 文档完善
|
|
|
- - 添加模块说明文档
|
|
|
- - 添加迁移文档
|
|
|
- - 完善代码注释
|
|
|
-
|
|
|
-## 验证器类迁移
|
|
|
-旧命名空间:`namespace Fund\Validation;`
|
|
|
-新命名空间:`namespace App\Module\Fund\Validators;`
|
|
|
-
|
|
|
-| 旧类名 | 新类名 | 说明 |
|
|
|
-|--------|--------|------|
|
|
|
-| Circulation | CirculationValidator | 流转验证器 |
|
|
|
-| Transfer | TransferValidator | 转账验证器 |
|
|
|
-
|
|
|
-主要改进:
|
|
|
-1. 统一验证器命名规范,添加Validator后缀
|
|
|
-2. 完善验证逻辑,增加更多数据校验
|
|
|
-3. 添加查询参数验证方法
|
|
|
-4. 使用枚举类型进行资金类型验证
|
|
|
-
|
|
|
-## 异常类迁移
|
|
|
-旧命名空间:`namespace Fund\Exception;`
|
|
|
-新命名空间:`namespace App\Module\Fund\Exceptions;`
|
|
|
-
|
|
|
-| 旧类名 | 新类名 | 说明 |
|
|
|
-|--------|--------|------|
|
|
|
-| DbException | DbException | 数据库操作异常类 |
|
|
|
-
|
|
|
-主要改进:
|
|
|
-1. 统一异常类命名空间
|
|
|
-2. 完善异常信息和文档注释
|
|
|
-3. 规范化异常处理机制
|
|
|
-
|
|
|
-## 数据传输对象(DTO)迁移
|
|
|
-旧命名空间:`namespace Fund\Item;`
|
|
|
-新命名空间:`namespace App\Module\Fund\Dto;`
|
|
|
-
|
|
|
-| 旧类名 | 新类名 | 说明 |
|
|
|
-|--------|--------|------|
|
|
|
-| Fund | FundDto | 资金数据传输对象 |
|
|
|
-| Tr | TransferDto | 转账数据传输对象 |
|
|
|
-| Withdrawal | WithdrawalDto | 提现数据传输对象 |
|
|
|
-
|
|
|
-主要改进:
|
|
|
-1. 将Item类重构为DTO类,更符合设计模式
|
|
|
-2. 添加类型声明和属性注释
|
|
|
-3. 统一数据转换方法
|
|
|
-4. 增加数据验证和默认值处理
|