|
@@ -46,11 +46,10 @@ func (c ConfigCowTypeSlice) ToPB2(userModel *UserModel, optionName string) []*pa
|
|
|
MessageID: v.I18nFieldTag,
|
|
|
})
|
|
|
|
|
|
- if optionName == "breed" {
|
|
|
- if v.Kind == pasturePb.CowType_Breeding_Calf || v.Kind == pasturePb.CowType_Reserve_Calf {
|
|
|
- continue
|
|
|
- }
|
|
|
+ if optionName == "breed" && !isBreedingOrReserveCalf(v.Kind) {
|
|
|
+ continue
|
|
|
}
|
|
|
+
|
|
|
res = append(res, &pasturePb.ConfigOptionsList{
|
|
|
Value: int32(v.Kind),
|
|
|
Label: label,
|
|
@@ -59,3 +58,8 @@ func (c ConfigCowTypeSlice) ToPB2(userModel *UserModel, optionName string) []*pa
|
|
|
}
|
|
|
return res
|
|
|
}
|
|
|
+
|
|
|
+// 辅助函数:判断是否为 Breeding_Calf 或 Reserve_Calf
|
|
|
+func isBreedingOrReserveCalf(kind pasturePb.CowType_Kind) bool {
|
|
|
+ return kind == pasturePb.CowType_Breeding_Calf || kind == pasturePb.CowType_Reserve_Calf
|
|
|
+}
|