| | |
| | | m.LastDirection = val |
| | | } |
| | | } |
| | | |
| | | } |
| | | |
| | | logger.Debugf("DisappearModel init finish ...task id:%s, name:%s, rule:%+v", task.ID, task.Name, m) |
| | |
| | | if isOlderThanGivenHours(p.LastAppearanceTime, m.DisappearTime) { |
| | | result := &db.ModelTaskResults{ |
| | | Title: m.Task.Name, |
| | | Event: eventFormat(p.LastAppearanceTime, p.LastDirection), |
| | | Event: m.eventFormat(p.LastAppearanceTime, p.LastDirection), |
| | | ModelID: m.Task.ModelID, |
| | | ModelTaskID: m.Task.ID, |
| | | CommunityId: p.CommunityId, |
| | |
| | | return timestampTime.Before(timeThreshold) |
| | | } |
| | | |
| | | func eventFormat(lastAppearTime int64, lastDirection string) string { |
| | | func (m *DisappearModel) eventFormat(lastAppearTime int64, lastDirection string) string { |
| | | lastTime := time.Unix(lastAppearTime, 0) |
| | | currentTime := time.Now() |
| | | |