重构:统一 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

@@ -37,13 +37,13 @@ const (
CodePermAlreadyAssigned = 1027 // 权限已分配
// 组织相关错误 (1030-1049)
CodeShopNotFound = 1030 // 店铺不存在
CodeShopCodeExists = 1031 // 店铺编号已存在
CodeShopLevelExceeded = 1032 // 店铺层级超过最大值
CodeEnterpriseNotFound = 1033 // 企业不存在
CodeShopNotFound = 1030 // 店铺不存在
CodeShopCodeExists = 1031 // 店铺编号已存在
CodeShopLevelExceeded = 1032 // 店铺层级超过最大值
CodeEnterpriseNotFound = 1033 // 企业不存在
CodeEnterpriseCodeExists = 1034 // 企业编号已存在
CodeCustomerNotFound = 1035 // 个人客户不存在
CodeCustomerPhoneExists = 1036 // 个人客户手机号已存在
CodeCustomerNotFound = 1035 // 个人客户不存在
CodeCustomerPhoneExists = 1036 // 个人客户手机号已存在
// 服务端错误 (2000-2999) -> 5xx HTTP 状态码
CodeInternalError = 2001 // 内部服务器错误

View File

@@ -81,4 +81,4 @@ func (g *Generator) Save(filename string) error {
}
return os.WriteFile(filename, yamlBytes, 0644)
}
}

View File

@@ -19,29 +19,29 @@ type SendResponse struct {
// 错误码常量
const (
CodeSuccess = 0 // 处理成功
CodeEmptyUserName = 1 // 帐号名为空
CodeAuthFailed = 2 // 帐号名或密码鉴权错误
CodeAccountLocked = 3 // 帐号已被锁定
CodeBusinessNotOpened = 4 // 此帐号业务未开通
CodeInsufficientBalance = 5 // 帐号余额不足
CodeMissingPhoneNumbers = 6 // 缺少发送号码
CodeTooManyPhoneNumbers = 7 // 超过最大发送号码数
CodeEmptyContent = 8 // 发送消息内容为空
CodeInvalidIP = 10 // 非法的IP地址
CodeTimeLimitRestriction = 11 // 24小时发送时间段限制
CodeInvalidScheduledTime = 12 // 定时发送时间错误或超过15天
CodeTooFrequent = 13 // 请求过于频繁
CodeInvalidExtCode = 14 // 错误的用户扩展码
CodeTimestampError = 16 // 时间戳差异过大
CodeNotRealNameAuthenticated = 18 // 帐号未进行实名认证
CodeReceiptNotEnabled = 19 // 帐号未开放回执状态
CodeMissingParameters = 22 // 缺少必填参数
CodeDuplicateUserName = 23 // 用户帐号名重复
CodeNoSignatureRestriction = 24 // 用户无签名限制
CodeSignatureMissingBrackets = 25 // 签名需要包含【】符
CodeInvalidContentType = 98 // HTTP Content-Type错误
CodeInvalidJSON = 99 // 错误的请求JSON字符串
CodeSuccess = 0 // 处理成功
CodeEmptyUserName = 1 // 帐号名为空
CodeAuthFailed = 2 // 帐号名或密码鉴权错误
CodeAccountLocked = 3 // 帐号已被锁定
CodeBusinessNotOpened = 4 // 此帐号业务未开通
CodeInsufficientBalance = 5 // 帐号余额不足
CodeMissingPhoneNumbers = 6 // 缺少发送号码
CodeTooManyPhoneNumbers = 7 // 超过最大发送号码数
CodeEmptyContent = 8 // 发送消息内容为空
CodeInvalidIP = 10 // 非法的IP地址
CodeTimeLimitRestriction = 11 // 24小时发送时间段限制
CodeInvalidScheduledTime = 12 // 定时发送时间错误或超过15天
CodeTooFrequent = 13 // 请求过于频繁
CodeInvalidExtCode = 14 // 错误的用户扩展码
CodeTimestampError = 16 // 时间戳差异过大
CodeNotRealNameAuthenticated = 18 // 帐号未进行实名认证
CodeReceiptNotEnabled = 19 // 帐号未开放回执状态
CodeMissingParameters = 22 // 缺少必填参数
CodeDuplicateUserName = 23 // 用户帐号名重复
CodeNoSignatureRestriction = 24 // 用户无签名限制
CodeSignatureMissingBrackets = 25 // 签名需要包含【】符
CodeInvalidContentType = 98 // HTTP Content-Type错误
CodeInvalidJSON = 99 // 错误的请求JSON字符串
CodeSystemError = 500 // 系统异常
)

View File

@@ -10,12 +10,12 @@ type Service interface {
// UserInfo 微信用户信息
type UserInfo struct {
OpenID string `json:"open_id"` // 微信 OpenID
UnionID string `json:"union_id"` // 微信 UnionID开放平台统一ID
Nickname string `json:"nickname"` // 昵称
Avatar string `json:"avatar"` // 头像URL
Sex int `json:"sex"` // 性别 0-未知 1-男 2-女
Province string `json:"province"` // 省份
City string `json:"city"` // 城市
Country string `json:"country"` // 国家
OpenID string `json:"open_id"` // 微信 OpenID
UnionID string `json:"union_id"` // 微信 UnionID开放平台统一ID
Nickname string `json:"nickname"` // 昵称
Avatar string `json:"avatar"` // 头像URL
Sex int `json:"sex"` // 性别 0-未知 1-男 2-女
Province string `json:"province"` // 省份
City string `json:"city"` // 城市
Country string `json:"country"` // 国家
}