06488f0237
功能: - Go后端 (Gin + GORM + PostgreSQL) - UniApp用户端 (iOS/Android/小程序) - DaisyUI5后台管理 - JWT认证 + 微信登录 - 盲选加权算法 - 会员系统 + 优惠券 - 打分评价 + 偏好学习
29 lines
1.1 KiB
Go
29 lines
1.1 KiB
Go
package model
|
|
|
|
import (
|
|
"time"
|
|
|
|
"gorm.io/datatypes"
|
|
"gorm.io/gorm"
|
|
)
|
|
|
|
type User struct {
|
|
ID uint `gorm:"primaryKey" json:"id"`
|
|
Nickname string `gorm:"size:100" json:"nickname"`
|
|
Avatar string `gorm:"size:255" json:"avatar"`
|
|
Phone string `gorm:"size:20;uniqueIndex" json:"phone"`
|
|
WechatOpenID string `gorm:"size:100;uniqueIndex" json:"wechat_openid"`
|
|
PasswordHash string `gorm:"size:255" json:"-"`
|
|
PrefScore datatypes.JSON `gorm:"type:jsonb" json:"pref_score,omitempty"`
|
|
Tags []string `gorm:"type:text[]" json:"tags"`
|
|
RepeatDays int `gorm:"default:7" json:"repeat_days"`
|
|
Blacklist []uint `gorm:"type:bigint[]" json:"blacklist"`
|
|
MemberLevel int `gorm:"default:0" json:"member_level"`
|
|
MemberExpires *time.Time `json:"member_expires,omitempty"`
|
|
CreatedAt time.Time `json:"created_at"`
|
|
UpdatedAt time.Time `json:"updated_at"`
|
|
DeletedAt gorm.DeletedAt `gorm:"index" json:"-"`
|
|
}
|
|
|
|
func (User) TableName() string { return "users" }
|