Kaynağa Gözat

event: update

Yi 3 hafta önce
ebeveyn
işleme
54d142a361
1 değiştirilmiş dosya ile 5 ekleme ve 2 silme
  1. 5 2
      module/crontab/neck_ring_merge.go

+ 5 - 2
module/crontab/neck_ring_merge.go

@@ -173,7 +173,8 @@ func (e *Entry) EntryUpdateActiveHabit(pastureId int64) (err error) {
 		Where("id > ?", xToday.LastMaxHabitId).
 		Where("pasture_id = ?", pastureId).
 		Where("is_show = ?", pasturePb.IsShow_No).
-		Order("id desc").First(currMaxHabit).Error; err != nil {
+		Order("id desc").
+		First(currMaxHabit).Error; err != nil {
 		return xerr.WithStack(err)
 	}
 
@@ -260,7 +261,7 @@ func (e *Entry) EntryUpdateActiveHabit(pastureId int64) (err error) {
 func (e *Entry) FirstFilterUpdate(pastureId int64, xToDay *XToday) (processIds []int64, err error) {
 	newNeckActiveHabitList := make([]*model.NeckActiveHabit, 0)
 	if err = e.DB.Model(new(model.NeckActiveHabit)).
-		Where("id BETWEEN ? AND ?", xToDay.LastMaxHabitId, xToDay.CurrMaxHabitId).
+		Where("id > ?", xToDay.LastMaxHabitId).
 		Where("pasture_id = ?", pastureId).
 		Where("is_show = ?", pasturePb.IsShow_No).
 		Where("record_count = ?", model.DefaultRecordCount).
@@ -561,11 +562,13 @@ func (e *Entry) SecondUpdateChangeFilter(pastureId int64, xToday *XToday) (err e
 	if err = e.DB.Model(new(model.NeckActiveHabit)).
 		Select("id", "neck_ring_number", "change_high", "change_filter", "rumina_filter", "change_rumina",
 			"chew_filter", "change_chew", "heat_date", "frameid", "IF(lact = 0, 0.8, 1) as xlc_dis_count").
+		Where("id > ?", xToday.LastMaxHabitId).
 		Where("heat_date >= ?", time.Now().AddDate(0, 0, -2).Format(model.LayoutDate2)).
 		Where("pasture_id = ?", pastureId).
 		Where("change_filter = ?", model.InitChangeFilter).
 		Where("change_high > ?", MinChangeHigh).
 		Order("neck_ring_number,heat_date,frameid").
+		Limit(int(defaultLimit)).
 		Find(&newChangeFilterList).Error; err != nil {
 		return xerr.WithStack(err)
 	}