backstage.go 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940
  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. }
  31. func (l StaffCld) ValidateLogin() error {
  32. return validation.ValidateStruct(&l,
  33. validation.Field(&l.StaffName, validation.Required.Error("CLD账号不能为空")),
  34. validation.Field(&l.Password, validation.Required.Error("密码不能为空"), validation.Length(6, 18).Error("密码位数6~18之间")),
  35. )
  36. }