重构:统一 IoT 模型到 internal/model/ 目录

将所有 IoT 相关的数据模型从 internal/iot/model/ 迁移到 internal/model/,
实现全局统一的模型层架构,符合项目横向分层设计原则。

变更内容:
- 迁移 11 个 IoT 模型文件(carrier, iot_card, device, order, package 等)
- 删除 internal/iot/model/ 目录
- 更新文档中的模型路径引用(25 处)
- 创建重构总结文档
- 归档 OpenSpec 变更为 2026-01-12-refactor-iot-model-location
- 创建 model-organization 规格文档

验证结果:
- 编译通过(go build 成功)
- 静态分析通过(go vet 无错误)
- 代码格式通过(go fmt 无变更)
- 无 Go 代码引用旧路径

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
This commit is contained in:
2026-01-12 16:01:53 +08:00
parent 034f00e2e7
commit 867e97af11
30 changed files with 1158 additions and 75 deletions

View File

@@ -11,9 +11,9 @@ import (
// Dependencies 封装所有基础依赖
// 这些是应用启动时初始化的核心组件
type Dependencies struct {
DB *gorm.DB // PostgreSQL 数据库连接
Redis *redis.Client // Redis 客户端
Logger *zap.Logger // 应用日志器
JWTManager *auth.JWTManager // JWT 管理器
VerificationService *verification.Service // 验证码服务
DB *gorm.DB // PostgreSQL 数据库连接
Redis *redis.Client // Redis 客户端
Logger *zap.Logger // 应用日志器
JWTManager *auth.JWTManager // JWT 管理器
VerificationService *verification.Service // 验证码服务
}

View File

@@ -57,7 +57,7 @@ type LoginRequest struct {
// LoginResponse 登录响应
type LoginResponse struct {
Token string `json:"token"` // 访问令牌
Token string `json:"token"` // 访问令牌
Customer *PersonalCustomerDTO `json:"customer"` // 客户信息
}

View File

@@ -75,4 +75,4 @@ type PermissionTreeNode struct {
URL string `json:"url,omitempty" description:"请求路径"`
Sort int `json:"sort" description:"排序值"`
Children []*PermissionTreeNode `json:"children,omitempty" description:"子权限列表"`
}
}

View File

@@ -65,4 +65,4 @@ type AssignPermissionsParams struct {
type RemovePermissionParams struct {
RoleID uint `path:"role_id" required:"true" description:"角色ID"`
PermID uint `path:"perm_id" required:"true" description:"权限ID"`
}
}

View File

@@ -68,9 +68,9 @@ func (s *Service) LoginByPhone(ctx context.Context, phone string, code string) (
// 客户不存在,创建新客户
// 注意:临时实现,使用空的微信信息(正式应该先微信授权)
customer = &model.PersonalCustomer{
WxOpenID: "", // 临时为空,后续需绑定微信
WxUnionID: "", // 临时为空,后续需绑定微信
Status: 1, // 默认启用
WxOpenID: "", // 临时为空,后续需绑定微信
WxUnionID: "", // 临时为空,后续需绑定微信
Status: 1, // 默认启用
}
if err := s.store.Create(ctx, customer); err != nil {
s.logger.Error("创建个人客户失败",

View File

@@ -129,4 +129,3 @@ func (s *AccountStore) List(ctx context.Context, opts *store.QueryOptions, filte
return accounts, total, nil
}