2024-09-19 10:44:49 +08:00
|
|
|
package model
|
|
|
|
|
|
2024-11-03 05:25:10 +08:00
|
|
|
import (
|
|
|
|
|
"strings"
|
|
|
|
|
)
|
|
|
|
|
|
2024-09-19 10:44:49 +08:00
|
|
|
type UserThird struct {
|
|
|
|
|
IdModel
|
2024-11-05 09:48:02 +08:00
|
|
|
UserId uint `json:"user_id" gorm:"not null;index"`
|
2024-11-02 04:01:28 +08:00
|
|
|
OauthUser
|
2024-11-05 09:48:02 +08:00
|
|
|
UnionId string `json:"union_id" gorm:"default:'';not null;"`
|
2024-11-02 04:01:28 +08:00
|
|
|
// OauthType string `json:"oauth_type" gorm:"not null;"`
|
2024-11-05 09:48:02 +08:00
|
|
|
ThirdType string `json:"third_type" gorm:"default:'';not null;"` //deprecated
|
|
|
|
|
OauthType string `json:"oauth_type" gorm:"default:'';not null;"`
|
|
|
|
|
Op string `json:"op" gorm:"default:'';not null;"`
|
2024-09-19 10:44:49 +08:00
|
|
|
TimeModel
|
|
|
|
|
}
|
2024-11-02 04:01:28 +08:00
|
|
|
|
|
|
|
|
func (u *UserThird) FromOauthUser(userId uint, oauthUser *OauthUser, oauthType string, op string) {
|
2024-11-05 09:48:02 +08:00
|
|
|
u.UserId = userId
|
|
|
|
|
u.OauthUser = *oauthUser
|
|
|
|
|
u.OauthType = oauthType
|
|
|
|
|
u.Op = op
|
2024-11-03 05:25:10 +08:00
|
|
|
// make sure email is lower case
|
2024-11-05 09:48:02 +08:00
|
|
|
u.Email = strings.ToLower(u.Email)
|
|
|
|
|
}
|