user

package
v1.0.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 15, 2026 License: Apache-2.0 Imports: 14 Imported by: 0

Documentation

Overview

Package user 存放用户 Model 相关逻辑

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetChannelId

func GetChannelId(cId string) int

GetChannelId 通过子渠道获取渠道号

func GetTimeFromStrDate

func GetTimeFromStrDate(date string) (age int)

func IsNameExist

func IsNameExist(name string) bool

func IsPhoneExist

func IsPhoneExist(phone string) bool

IsPhoneExist 判断手机号已被注册

func IsUidExist

func IsUidExist(uid string) bool

IsUidExist 判断用户UID是否存在

Types

type User

type User struct {
	models.BaseModel

	Uid             uint32    `gorm:"default:null;uniqueIndex"`
	UseUID          uint32    `gorm:"column:use_uid;default:null"`
	Sex             uint8     `gorm:"column:sex;"`
	Pi              string    `gorm:"column:pi;"`
	PlatUid         string    `gorm:"type:varchar(255);default:null;"`
	Name            string    `gorm:"type:varchar(255);default:null;"`
	LoginInfo       string    `gorm:"type:varchar(255);default:null;"`
	Phone           string    `gorm:"type:char(32);default:null;uniqueIndex"`
	Password        string    `gorm:"type:varchar(255)"`
	Birthday        string    `gorm:"type:varchar(255);default:null;"`
	PayTotal        int       `gorm:"default:0;"`
	Subscribe       int       `gorm:"default:0;"`
	PlatId          int       `gorm:"default:1;"`
	PlatFormId      string    `gorm:"default:1;"`
	RegisterChannel string    `gorm:"default:1;"`
	TtChannel       string    `gorm:""`
	LastLoginTime   time.Time `gorm:"default:null;"`
	FirstPayTime    time.Time `gorm:"default:null;"`
	LastPayTime     time.Time `gorm:"default:null;"`
	BanTime         time.Time `gorm:"default:null;"`
	Status          int       `gorm:"default:0;"`
	GameId          int       `gorm:"default:null;"`

	DeletedAt gorm.DeletedAt `gorm:"index"`
}

User 用户模型

func Get

func Get(idstr string) (userModel User)

Get 通过 ID 获取用户

func GetByPhone

func GetByPhone(phone string) (userModel User)

GetByPhone 通过手机号来获取用户

func GetByPlatId

func GetByPlatId(platUid, channel string) (userModel User)

GetByPlatId 通过PlatId 和 channel 来获取用户

func GetByUid

func GetByUid(uid string) (userModel User)

GetByUid 通过 Uid 来获取用户

func UpdatePayTime

func UpdatePayTime(uid string, payFee int, payTime string) User

func (*User) CheckAgePayLimit

func (userModel *User) CheckAgePayLimit(payAmount int) (err error)

func (*User) ComparePasswordMd5

func (userModel *User) ComparePasswordMd5(_password string) bool

ComparePasswordMd5 密码是否正确

func (*User) Create

func (userModel *User) Create() error

Create 创建用户,通过 User.ID 来判断是否创建成功

func (*User) Delete

func (userModel *User) Delete()

Delete 删除用户

func (*User) GetAge

func (userModel *User) GetAge() int

根据生日获取年龄

func (*User) GetBirthday

func (userModel *User) GetBirthday(platForm string) string

func (*User) GetStringUID

func (userModel *User) GetStringUID() string

GetStringUID 创建用户,通过 User.ID 来判断是否创建成功

func (*User) Save

func (userModel *User) Save() error

func (*User) SetBirthday

func (userModel *User) SetBirthday() error

func (*User) SetGameId

func (userModel *User) SetGameId(lInfo string) error

func (*User) SetName

func (userModel *User) SetName() error

func (*User) SetPass

func (userModel *User) SetPass(pass string) error

func (*User) SetPhone

func (userModel *User) SetPhone(phone string) error

func (*User) SetUid

func (userModel *User) SetUid() uint32

func (*User) UpdateLoginTime

func (userModel *User) UpdateLoginTime(lInfo string)

根据更新最后登录时间

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL