announcement.go 374 B

1234567891011121314151617181920
  1. package forms
  2. import (
  3. "errors"
  4. )
  5. type AnnouncementAddReq struct {
  6. Title string `json:"title" form:"title"`
  7. Content string `json:"content" form:"content"`
  8. }
  9. func (req *AnnouncementAddReq) Check() error {
  10. if req.Content == "" {
  11. return errors.New("公告内容不能为空")
  12. }
  13. if req.Title == "" {
  14. return errors.New("公告标题不能为空")
  15. }
  16. return nil
  17. }