胡轶钦 6 vuotta sitten
vanhempi
commit
5d7cad6ff1
1 muutettua tiedostoa jossa 9 lisäystä ja 0 poistoa
  1. 9
    0
      service/booktype/booktype.go

+ 9
- 0
service/booktype/booktype.go Näytä tiedosto

@@ -54,6 +54,15 @@ func (s *BooktypeServ) GetBookTypeById(bookTypeId string) (*model.TaBookType, er
54 54
 }
55 55
 
56 56
 func (s *BooktypeServ) SaveBookType(booktype model.TaBookType) (*model.TaBookType, error) {
57
+	if booktype.BookTypeImg == "" {
58
+		return nil, errors.New("类型图片不能为空")
59
+	}
60
+	if booktype.CaseId == "" {
61
+		return nil, errors.New("案场不能为空")
62
+	}
63
+	if booktype.BookTypeName == "" {
64
+		return nil, errors.New("类型名称不能为空")
65
+	}
57 66
 	if booktype.BookTypeId == "" {
58 67
 		bookType, err := s.dao.AddBookType(booktype)
59 68
 		if err != nil {