model.go 2.4 KB

123456789101112131415161718192021222324252627282930313233
  1. package model
  2. import (
  3. "time"
  4. "github.com/shopspring/decimal"
  5. )
  6. type User struct {
  7. Id uint `gorm:"primarykey"`
  8. Code string `gorm:"column:code;type:char(16);comment:客户号;NOT NULL" json:"code"`
  9. Amount decimal.Decimal `gorm:"column:amount;type:decimal(20,4) unsigned;default:0.00;comment:账户余额;NOT NULL" json:"amount"`
  10. InvoicableAmount decimal.Decimal `gorm:"column:invoicable_amount;type:decimal(20,4);default:0.00;comment:可开票金额;NOT NULL" json:"invoicable_amount"`
  11. UserName string `gorm:"column:user_name;type:varchar(20);comment:用户名;NOT NULL" json:"user_name"`
  12. Password string `gorm:"column:password;type:char(40);comment:登录密码(SHA1( MD5 (明文密码) + 盐值);NOT NULL" json:"password"`
  13. Salt string `gorm:"column:salt;type:varchar(10);comment:盐值;NOT NULL" json:"salt"`
  14. Icon string `gorm:"column:icon;type:varchar(255);comment:图像链接;NOT NULL" json:"icon"`
  15. Type uint `gorm:"column:type;type:tinyint(1) unsigned;default:1;comment:用户类型(1:个人用户(默认)2:企业用户);NOT NULL" json:"type"`
  16. Environment uint `gorm:"column:environment;type:tinyint(1) unsigned;default:1;comment:环境类型(1:国内 2:国际);NOT NULL" json:"environment"`
  17. PhoneNumber string `gorm:"column:phone_number;type:varchar(20);comment:手机号;NOT NULL" json:"phone_number"`
  18. Email string `gorm:"column:email;type:varchar(64);comment:电子邮箱;NOT NULL" json:"email"`
  19. Description string `gorm:"column:description;type:text;comment:个人介绍" json:"description"`
  20. UpdatedAt time.Time `gorm:"<-:false"`
  21. CreatedAt time.Time `gorm:"<-:false"`
  22. IsDeleted uint `gorm:"column:is_deleted;type:tinyint(1) unsigned;default:2;comment:是否删除(1:是 2:否);NOT NULL" json:"is_deleted"`
  23. }
  24. type UserSimple struct {
  25. Id uint `gorm:"primarykey"`
  26. Code string `gorm:"column:code;type:char(16);comment:客户号;NOT NULL" json:"code"`
  27. UserName string `gorm:"column:user_name;type:varchar(20);comment:用户名;NOT NULL" json:"user_name"`
  28. Password string `gorm:"column:password;type:char(40);comment:登录密码(SHA1( MD5 (明文密码) + 盐值);NOT NULL" json:"password"`
  29. }