- 添加个人客户微信登录和手机验证码登录接口 - 实现个人客户设备、ICCID、手机号关联管理 - 添加短信发送服务(HTTP 客户端) - 添加微信认证服务(含 mock 实现) - 添加 JWT Token 生成和验证工具 - 创建数据库迁移脚本(personal_customer 关联表) - 修复测试文件中的路由注册参数错误 - 重构 scripts 目录结构(分离独立脚本到子目录) Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
23 lines
1004 B
Go
23 lines
1004 B
Go
package model
|
||
|
||
import (
|
||
"gorm.io/gorm"
|
||
)
|
||
|
||
// PersonalCustomer 个人客户模型(微信用户)
|
||
// 说明:个人客户由微信 OpenID/UnionID 唯一标识
|
||
// 手机号、ICCID、设备号通过关联表存储
|
||
type PersonalCustomer struct {
|
||
gorm.Model
|
||
WxOpenID string `gorm:"column:wx_open_id;type:varchar(100);uniqueIndex:idx_personal_customer_wx_open_id,where:deleted_at IS NULL;not null;comment:微信OpenID(唯一标识)" json:"wx_open_id"`
|
||
WxUnionID string `gorm:"column:wx_union_id;type:varchar(100);index;not null;comment:微信UnionID" json:"wx_union_id"`
|
||
Nickname string `gorm:"column:nickname;type:varchar(100);comment:微信昵称" json:"nickname"`
|
||
AvatarURL string `gorm:"column:avatar_url;type:varchar(500);comment:微信头像URL" json:"avatar_url"`
|
||
Status int `gorm:"column:status;type:int;not null;default:1;comment:状态 0=禁用 1=启用" json:"status"`
|
||
}
|
||
|
||
// TableName 指定表名
|
||
func (PersonalCustomer) TableName() string {
|
||
return "tb_personal_customer"
|
||
}
|