user.go 452 B

1234567891011121314151617181920212223242526272829
  1. package user_service
  2. import (
  3. "github.com/casbin/casbin"
  4. "kpt.xdmy/apiserver/routers/restful"
  5. "kpt.xdmy/pkg/util"
  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. PageNum int
  17. PageSize int
  18. Enforcer *casbin.Enforcer `inject:""`
  19. }
  20. func (a *User) Check() (bool, error) {
  21. return restful.CheckUser(a.Username, util.EncodeMD5(a.Password))
  22. }