Ver Fonte

cronb: 更新脖环发情数据

Yi há 2 meses atrás
pai
commit
bd654fab77
3 ficheiros alterados com 10 adições e 1 exclusões
  1. 1 1
      go.mod
  2. 2 0
      go.sum
  3. 7 0
      module/crontab/neck_ring_estrus.go

+ 1 - 1
go.mod

@@ -3,7 +3,7 @@ module kpt-pasture
 go 1.17
 
 require (
-	gitee.com/xuyiping_admin/go_proto v0.0.0-20250124085242-ce995d9353fb
+	gitee.com/xuyiping_admin/go_proto v0.0.0-20250205095115-901ea79b7e1f
 	gitee.com/xuyiping_admin/pkg v0.0.0-20241108060137-caea58c59f5b
 	github.com/dgrijalva/jwt-go v3.2.0+incompatible
 	github.com/eclipse/paho.mqtt.golang v1.4.3

+ 2 - 0
go.sum

@@ -136,6 +136,8 @@ gitee.com/xuyiping_admin/go_proto v0.0.0-20250124065849-a3be4cfe11ab h1:wRGHkMoi
 gitee.com/xuyiping_admin/go_proto v0.0.0-20250124065849-a3be4cfe11ab/go.mod h1:BKrFW6YLDectlQcQk3FYKBeXvjEiodAKJ5rq7O/QiPE=
 gitee.com/xuyiping_admin/go_proto v0.0.0-20250124085242-ce995d9353fb h1:NYaR6KruC/8osHF5VKierJw+rWCsdQ/sahOUMxtgCl4=
 gitee.com/xuyiping_admin/go_proto v0.0.0-20250124085242-ce995d9353fb/go.mod h1:BKrFW6YLDectlQcQk3FYKBeXvjEiodAKJ5rq7O/QiPE=
+gitee.com/xuyiping_admin/go_proto v0.0.0-20250205095115-901ea79b7e1f h1:sVJ/ZSR4r1h2bO0HEf7IVZppBjJ/UzEqCu1hptptgrM=
+gitee.com/xuyiping_admin/go_proto v0.0.0-20250205095115-901ea79b7e1f/go.mod h1:BKrFW6YLDectlQcQk3FYKBeXvjEiodAKJ5rq7O/QiPE=
 gitee.com/xuyiping_admin/pkg v0.0.0-20241108060137-caea58c59f5b h1:w05MxH7yqveRlaRbxHhbif5YjPrJFodRPfOjYhXn7Zk=
 gitee.com/xuyiping_admin/pkg v0.0.0-20241108060137-caea58c59f5b/go.mod h1:8tF25X6pE9WkFCczlNAC0K2mrjwKvhhp02I7o0HtDxY=
 github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU=

+ 7 - 0
module/crontab/neck_ring_estrus.go

@@ -54,6 +54,13 @@ func (e *Entry) EntryCowEstrus(pastureId int64) (err error) {
 	if err = e.CowEstrusWarning(pastureId, xToday); err != nil {
 		zaplog.Error("EntryCowEstrus", zap.Any("CowEstrusWarning", err), zap.Any("xToday", xToday))
 	}
+
+	// 将历史发情预警数据更新为已过期
+	if err = e.DB.Model(new(model.EventEstrus)).
+		Where("estrus_start_date >= ?", time.Now().AddDate(0, 0, -4).Format(model.LayoutTime)).
+		Update("is_show", pasturePb.IsShow_No).Error; err != nil {
+		zaplog.Error("EntryCowEstrus", zap.Any("UpdateEventEstrus", err))
+	}
 	return nil
 }