user.go 782 B

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. package user_service
  2. import (
  3. "tmr-watch/http/handle/restful"
  4. "tmr-watch/pkg/util"
  5. "github.com/casbin/casbin"
  6. )
  7. type User struct {
  8. ID int
  9. Username string
  10. Password string
  11. Fullname string
  12. Deptid int
  13. Role int
  14. CreatedBy string
  15. ModifiedBy string
  16. Imei string
  17. PastureId string
  18. PageNum int
  19. PageSize int
  20. Enforcer *casbin.Enforcer `inject:""`
  21. }
  22. func (a *User) Check() (bool, error) {
  23. return restful.CheckUser(a.Username, a.Password)
  24. }
  25. func (a *User) MD5Check() (bool, error) {
  26. return restful.CheckUser(a.Username, util.EncodeMD5(a.Password))
  27. }
  28. func (a *User) CheckFace() (bool, error) {
  29. return restful.CheckUser(a.Username, a.Password)
  30. }
  31. // func (a *User) CheckImei() (bool, error) {
  32. // return restful.CheckImei(a.Username, a.Imei)
  33. // }