Documentation ¶
Index ¶
- func DB() *gorm.DB
- func Goods2xlsx()
- type AdminUsers
- func (u *AdminUsers) ChangePassword() error
- func (u *AdminUsers) ComparePasswords(password string) bool
- func (u *AdminUsers) GetUserById(id uint) *AdminUsers
- func (u *AdminUsers) GetUserInfo(username string) *AdminUsers
- func (u *AdminUsers) PasswordHash(pwd string) (string, error)
- func (u *AdminUsers) Register() error
- type BaseModel
- type ContainsDeleteBaseModel
- type GoodBean
- type Goods
- type Orders
- type OrdersDetail
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Goods2xlsx ¶
func Goods2xlsx()
Types ¶
type AdminUsers ¶
type AdminUsers struct { BaseModel IsAdmin int8 `gorm:"column:is_admin;type:tinyint(1);not null;default:0" json:"is_admin"` // 是否是总管理员 Nickname string `gorm:"column:nickname;type:varchar(60);not null;default:''" json:"nickname"` // 用户昵称 Username string `gorm:"uniqueIndex:a_u_username_unique;column:username;type:varchar(60);not null;default:''" json:"username"` // 用户名 Password string `gorm:"column:password;type:varchar(255);not null;default:''" json:"password"` // 密码 Mobile string `gorm:"uniqueIndex:a_u_mobile_unique;column:mobile;type:varchar(15);not null;default:''" json:"mobile"` // 手机号 Email string `gorm:"column:email;type:varchar(120);not null;default:''" json:"email"` // 邮箱 Avatar string `gorm:"column:avatar;type:varchar(160);not null;default:''" json:"avatar"` // 头像 Status bool `gorm:"column:status;type:tinyint(1);not null;default:0" json:"status"` // 状态,0正常,1禁用 LoginAt utils.FormatDate `gorm:"column:login_at;type:timestamp;default:null" json:"login_at"` // 登录时间 LoginIP string `gorm:"column:login_ip;type:varchar(15);not null;default:''" json:"login_ip"` // 最后一次登录ip LastLoginAt utils.FormatDate `gorm:"column:last_login_at;type:timestamp;default:null" json:"last_login_at"` // 上一次登录时间 LastLoginIP string `gorm:"column:last_login_ip;type:varchar(15);not null;default:''" json:"last_login_ip"` // 上一次登录ip DeletedAt soft_delete.DeletedAt `` // 删除时间戳 /* 142-byte string literal not displayed */ }
AdminUsers 总管理员表
func NewAdminUsers ¶
func NewAdminUsers() *AdminUsers
func (*AdminUsers) ComparePasswords ¶
func (u *AdminUsers) ComparePasswords(password string) bool
ComparePasswords 比对用户密码是否正确
func (*AdminUsers) GetUserById ¶
func (u *AdminUsers) GetUserById(id uint) *AdminUsers
GetUserById 根据uid获取用户信息
func (*AdminUsers) GetUserInfo ¶
func (u *AdminUsers) GetUserInfo(username string) *AdminUsers
GetUserInfo 根据名称获取用户信息
func (*AdminUsers) PasswordHash ¶
func (u *AdminUsers) PasswordHash(pwd string) (string, error)
PasswordHash 密码hash并自动加盐
type BaseModel ¶
type BaseModel struct { ID uint `gorm:"column:id;type:int(11) unsigned AUTO_INCREMENT;not null;primarykey" json:"id"` CreatedAt utils.FormatDate `gorm:"column:created_at;type:timestamp;<-:create" json:"created_at"` UpdatedAt utils.FormatDate `gorm:"column:updated_at;type:timestamp" json:"updated_at"` }
type ContainsDeleteBaseModel ¶
type ContainsDeleteBaseModel struct { BaseModel DeletedAt soft_delete.DeletedAt `gorm:"column:deleted_at;type:int(11) unsigned;not null;default:0;index" json:"-"` }
type GoodBean ¶
type GoodBean struct { ID uint `json:"id"` Position uint `json:"position"` //在列表中的位置 GoodsName string `json:"goodsName"` Barcode string `json:"barcode"` Price string `json:"price"` Brand string `json:"brand"` Supplier string `json:"supplier"` Standard string `json:"standard"` Spec string `json:"spec"` }
type Goods ¶
type Goods struct { BaseModel GoodsName string `gorm:"column:goods_name" json:"goodsName"` Barcode string `gorm:"column:barcode" json:"barcode"` Brand string `gorm:"column:brand" json:"brand"` Price string `gorm:"column:price" json:"price"` Spec string `gorm:"column:spec" json:"spec"` Supplier string `gorm:"column:supplier" json:"supplier"` }
func NewGoodsEx ¶
type Orders ¶
type OrdersDetail ¶
type OrdersDetail struct { BaseModel OrdersID uint `gorm:"column:orders_id" json:"ordersID"` // 订单ID GoodsID uint `gorm:"column:goods_id" json:"goodsID"` // 商品ID GoodsName string `gorm:"column:goods_name" json:"goodsName"` Barcode string `gorm:"column:barcode" json:"barcode"` Brand string `gorm:"column:brand" json:"brand"` Price string `gorm:"column:price" json:"price"` Spec string `gorm:"column:spec" json:"spec"` Count uint `gorm:"column:count" json:"count"` //商品计数 }
func (OrdersDetail) TableName ¶
func (OrdersDetail) TableName() string
Click to show internal directories.
Click to hide internal directories.