backstage.go 1.0 KB

12345678910111213141516171819202122232425262728293031323334
  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. }
  25. func (l StaffCld) ValidateLogin() error {
  26. return validation.ValidateStruct(&l,
  27. validation.Field(&l.StaffName, validation.Required.Error("CLD账号不能为空")),
  28. validation.Field(&l.Password, validation.Required.Error("密码不能为空"), validation.Length(6, 18).Error("密码位数6~18之间")),
  29. )
  30. }