补齐 HTTP 层:实现用户模块、路由与中间件接线、COS 上传及优雅启动
- 新增用户与上传错误码文件及 Recovery 中间件 - 修复 router.go 导入与中间件链,注册用户路由并补 handler 错误码导入 - 补充用户状态常量与 UserGetByWechatOpenID 查询,修订刷新令牌 dto - 移除 upload 包 OTel 调用,新增 FileUploadCos 上传封装 - 实现 UserService 微信登录/刷新令牌/我的信息/改资料/上传头像 - 裁剪 main.go 配置段并移除 OTel 桥接,补启动与优雅退出 - 新增 configs 示例配置、global 配置结构及 go.mod 依赖
This commit is contained in:
@@ -0,0 +1,22 @@
|
||||
package mysqlmodel
|
||||
|
||||
// 用户状态:1=正常 2=临时禁用 3=永久禁用 4=已注销。
|
||||
const (
|
||||
UserStatusNormal int8 = 1
|
||||
UserStatusTempBanned int8 = 2
|
||||
UserStatusBanned int8 = 3
|
||||
UserStatusCancelled int8 = 4
|
||||
)
|
||||
|
||||
type User struct {
|
||||
Model
|
||||
UserUUID string `gorm:"column:user_uuid;type:varchar(32);not null;uniqueIndex:idx_user_uuid"`
|
||||
WechatOpenID string `gorm:"column:wechat_open_id;type:varchar(32);not null;uniqueIndex:idx_wechat_open_id"`
|
||||
Username string `gorm:"column:username;type:varchar(64);not null"`
|
||||
Avatar string `gorm:"column:avatar;type:varchar(255);not null"`
|
||||
Status int8 `gorm:"column:status;type:tinyint(1);not null"`
|
||||
}
|
||||
|
||||
func (User) TableName() string {
|
||||
return "users"
|
||||
}
|
||||
Reference in New Issue
Block a user