소스 검색

crontab: neck_ring update

Yi 1 개월 전
부모
커밋
bc26ed3978
1개의 변경된 파일3개의 추가작업 그리고 3개의 파일을 삭제
  1. 3 3
      module/crontab/neck_ring_calculate.go

+ 3 - 3
module/crontab/neck_ring_calculate.go

@@ -97,7 +97,7 @@ func (e *Entry) FirstFilterUpdate(pastureId int64, xToDay *XToday) (processIds [
 	}
 	newNeckActiveHabitList := make([]*model.NeckActiveHabit, 0)
 	if err = e.DB.Model(new(model.NeckActiveHabit)).
-		Where("heat_date >= ?", time.Now().Local().AddDate(0, 0, -7).Format(model.LayoutDate2)).
+		Where("heat_date >= ?", time.Now().Local().AddDate(0, 0, -30).Format(model.LayoutDate2)).
 		Where("pasture_id = ?", pastureId).
 		Where("is_show = ?", pasturePb.IsShow_No).
 		//Where(e.DB.Where("high >= ?", xToDay.High).Or("rumina >= ?", xToDay.Rumina)).
@@ -176,7 +176,7 @@ func (e *Entry) FirstFilterUpdate(pastureId int64, xToDay *XToday) (processIds [
 		}
 
 		processIds = append(processIds, v.Id)
-		// 更新过滤值 // todo 记得更新胎次为牛只胎次,现在为了测试特意改成0
+		// 更新过滤值
 		if err = e.DB.Model(new(model.NeckActiveHabit)).
 			Select("filter_high", "filter_rumina", "filter_chew", "cow_id", "lact", "calving_age", "ear_number", "week_high").
 			Where("id = ?", v.Id).
@@ -185,7 +185,7 @@ func (e *Entry) FirstFilterUpdate(pastureId int64, xToDay *XToday) (processIds [
 				"filter_rumina": firstFilterData.FilterRumina,
 				"filter_chew":   firstFilterData.FilterChew,
 				"cow_id":        cowInfo.Id,
-				"lact":          0,
+				"lact":          cowInfo.Lact,
 				"calving_age":   cowInfo.CalvingAge,
 				"ear_number":    cowInfo.EarNumber,
 				"week_high":     cowWeeklyActive,