user-base/model/user-model.go

28 lines
1.2 KiB
Go

package model
import (
"time"
"gorm.io/gorm"
)
/*
通过分库来区别不同版本的产品-现在的demo逻辑
用户在后台注册,前台扫码登录,组织ID肯定存在(后期如果开放注册-组织ID可以不存在)
*/
type User struct {
ID uint `gorm:"primarykey"`
UserName string `gorm:"column:user_name;type:varchar(30);comment:用户名"`
NickName string `gorm:"column:nick_name;type:varchar(40);comment:昵称"`
OpenID string `gorm:"column:openid;type:varchar(100);not null;index;comment:公众号openid" json:"-"`
Avatar string `gorm:"column:avatar;type:varchar(300);comment:头像地址"`
Mobile string `gorm:"column:mobile;type:varchar(12);not null;index ;comment:手机号"`
Email string `gorm:"column:email;type:varchar(30);comment:email"`
ProjectID string `gorm:"column:project_id;type:varchar(40);comment:项目ID"` //项目 Id admin项目 Id 为 0
Role string `gorm:"column:role;type:varchar(15);not null;default:guest;comment:角色类型"` // sys、so、admin
CreatedAt time.Time `gorm:"autoCreateTime"`
UpdatedAt time.Time `gorm:"autoUpdateTime"`
DeletedAt gorm.DeletedAt `gorm:"index"`
}