backstage.go 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. /*
  2. * @description: 后台模板
  3. * @Author: CP
  4. * @Date: 2021-02-18 10:07:58
  5. * @FilePath: \construction_management\web\viewmodels\backstage.go
  6. */
  7. package viewmodels
  8. import (
  9. validation "github.com/go-ozzo/ozzo-validation/v3"
  10. )
  11. // cld相关
  12. type StaffCld struct {
  13. Id string `from:"id" json:"id"`
  14. StaffId string `from:"staffId" json:"staffId"`
  15. StaffName string `from:"staffName" json:"staffName"`
  16. Password string `from:"password" json:"password"`
  17. CategoryId string `from:"categoryId" json:"categoryId"`
  18. Category string `from:"category" json:"category"`
  19. }
  20. // 接收CLD
  21. type ResultCld struct {
  22. UserName string `from:"username" json:"username"`
  23. Category string `from:"category" json:"category"`
  24. CategoryId string `from:"cid" json:"cid"`
  25. Qq string `from:"qq" json:"qq"`
  26. Telephone string `from:"telephone" json:"telephone"`
  27. Email string `from:"email" json:"email"`
  28. Fixedphone string `from:"phone" json:"phone"`
  29. Position string `from:"position" json:"position"`
  30. Sid string `from:"sid" json:"sid"`
  31. }
  32. func (l StaffCld) ValidateLogin() error {
  33. return validation.ValidateStruct(&l,
  34. validation.Field(&l.StaffName, validation.Required.Error("CLD账号不能为空")),
  35. validation.Field(&l.Password, validation.Required.Error("密码不能为空"), validation.Length(4, 18).Error("密码位数6~18之间")),
  36. )
  37. }