035611b97af1bbfb429d8bf1dad0ff8903ae3737.svn-base 578 B

1234567891011121314151617181920212223242526272829303132333435
  1. package user_service
  2. import (
  3. "github.com/casbin/casbin"
  4. "../../pkg/util"
  5. "../../routers/restful"
  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, util.EncodeMD5(a.Password))
  24. }
  25. func (a *User) CheckFace() (bool, error) {
  26. return restful.CheckUser(a.Username, util.EncodeMD5(a.Password))
  27. }