user

package
v0.0.0-...-1f6533e Latest Latest
Warning

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

Go to latest
Published: Nov 14, 2024 License: MulanPSL-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type PointRecord

type PointRecord struct {
	gorm.Model
	UserId        int64     `json:"user_id"        gorm:"column:user_id;type:int(11);index;comment:用户ID"`
	ChangeType    string    `json:"change_type"    gorm:"column:change_type;type:varchar(30);comment:积分变动类型"`
	Amount        int64     `json:"amount"         gorm:"column:amount;type:int(11);comment:积分变动数量"`
	Balance       int64     `json:"balance"        gorm:"column:balance;type:int(11);comment:操作后的积分余额"`
	OperationTime time.Time `json:"operation_time" gorm:"column:operation_time;type:datetime;comment:操作时间"`
	Description   string    `json:"description"    gorm:"column:description;type:varchar(50);comment:积分操作描述"`
	Source        string    `json:"source"         gorm:"column:source;type:varchar(30);comment:积分来源"`
	OrderID       int64     `json:"order_id"       gorm:"column:order_id;type:int(11);comment:订单来源"`
}

PointRecord

func NewPointRecord

func NewPointRecord() *PointRecord

func (*PointRecord) CreatePointsRecord

func (p *PointRecord) CreatePointsRecord(ctx context.Context, in *PointRecord) (*User, error)

CreatePointsRecord 创建积分变动记录

type User

type User struct {
	gorm.Model
	Mobile      string `json:"mobile"         gorm:"column:mobile;type:char(11);unique;comment:手机号"`
	Password    string `json:"password"       gorm:"column:password;type:varchar(50);comment:密码"`
	Nickname    string `json:"nickname"       gorm:"column:nickname;type:varchar(30);comment:昵称"`
	Sex         int64  `json:"sex"            gorm:"column:sex;type:tinyint(1);comment:性别 0-未知, 1-男, 2-女"`
	Birthday    string `json:"birthday"       gorm:"column:birthday;type:varchar(255);comment:出生日期"`
	Email       string `json:"email"          gorm:"column:email;type:varchar(255);comment:邮箱"`
	Avatar      string `json:"avatar"         gorm:"column:avatar;type:varchar(255);comment:头像"`
	Salt        string `json:"salt"           gorm:"column:salt;type:varchar(255);comment:加盐"`
	Openid      string `json:"openid"         gorm:"column:openid;type:varchar(50);comment:开放ID"`
	Unionid     string `json:"unionid"        gorm:"column:unionid;type:varchar(50);comment:微信登录唯一标识"`
	State       int64  `json:"state"          gorm:"column:state;type:tinyint(1);comment:状态 0封禁 1 正常 "`
	LoginSource string `json:"login_source"   gorm:"column:login_source;type:varchar(10);comment:登录来源"`
	Points      int64  `json:"points"         gorm:"column:points;type:int(11);comment:用户积分"`
}

User 用户表

func NewUser

func NewUser() *User

func (*User) Delete

func (u *User) Delete(ctx context.Context, id int64) error

func (*User) GetUserInfoByID

func (u *User) GetUserInfoByID(ctx context.Context, id int64) (*User, error)

func (*User) GetUserInfoByMobile

func (u *User) GetUserInfoByMobile(ctx context.Context, mobile string) (*User, error)

func (*User) GetUserInfoByOpenID

func (u *User) GetUserInfoByOpenID(ctx context.Context, openId string) (*User, error)

func (*User) Register

func (u *User) Register(ctx context.Context, in *User) (*User, error)

func (*User) Update

func (u *User) Update(ctx context.Context, id int64, updateInfo *User) error

func (*User) UpdateMobile

func (u *User) UpdateMobile(ctx context.Context, id int64, mobile string) error

func (*User) UpdatePwd

func (u *User) UpdatePwd(ctx context.Context, mobile, password string) error

Jump to

Keyboard shortcuts

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