user.go 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. package models
  2. import "time"
  3. type User struct {
  4. Id int64 `xorm:"id"`
  5. PastureId int64 `xorm:"pastureid"`
  6. Isgroups int32 `xorm:"isgroups"`
  7. Username string `xorm:"username"`
  8. Empname string `xorm:"empname"`
  9. Password string `xorm:"password"`
  10. Sort int32 `xorm:"sort"`
  11. Enable int32 `xorm:"enable"`
  12. Phone string `xorm:"phone"`
  13. Createmp string `xorm:"createmp"`
  14. Createdtime time.Time `xorm:"createdtime"`
  15. Isdelete int32 `xorm:"isdelete"`
  16. Deletedtime time.Time `xorm:"deletedtime"`
  17. Empid int64 `xorm:"empid"`
  18. CreatedOn int64 `xorm:"created_On"`
  19. DeletedOn int64 `xorm:"deleted_On"`
  20. Roleid int64 `xorm:"roleid"`
  21. Rolename string `xorm:"rolename"`
  22. Imei string `xorm:"imei"`
  23. }
  24. func (u *User) TableName() string {
  25. return "user"
  26. }
  27. func NewUser(pastureId int64, userName, empanme, password, phone string, roleId int64) *User {
  28. return &User{
  29. PastureId: pastureId,
  30. Isgroups: 0,
  31. Username: userName,
  32. Empname: empanme,
  33. Password: password,
  34. Enable: 1,
  35. Phone: phone,
  36. Createmp: userName,
  37. Createdtime: time.Now(),
  38. Isdelete: 0,
  39. Roleid: roleId,
  40. }
  41. }