| | |
| | | task.mutex.Unlock() |
| | | |
| | | var req vo.RequestSubscribeNotification |
| | | req.SubscribeNotificationListObject.SubscribeNotificationObject[0] = notification |
| | | req.SubscribeNotificationListObject.SubscribeNotificationObject = append(req.SubscribeNotificationListObject.SubscribeNotificationObject, notification) |
| | | |
| | | return &req |
| | | } |
| | | |
| | | func (task *NotificationTask) packPersonNotificationMsg() *vo.RequestSubscribeNotification { |
| | | triggerTime := time.Now().Format("20060102150405") |
| | | if len(task.faceList) == 0 { |
| | | return nil |
| | | } |
| | | |
| | | var notification = vo.PersonNotification{ |
| | | NotificationID: triggerTime + snowflake.GenerateIdStr(), |
| | | SubscribeID: task.conf.Id, |
| | | Title: task.conf.Ext.Title, |
| | | TriggerTime: triggerTime, |
| | | ExecuteOperation: 1, |
| | | } |
| | | |
| | | var ids []string |
| | | for idx, _ := range task.personList { |
| | | // 按海康示例填充修改字段 |
| | | for i, _ := range task.personList[idx].SubImageList.SubImageInfoObject { |
| | | task.personList[idx].SubImageList.SubImageInfoObject[i].EventSort = 2 |
| | | } |
| | | |
| | | ids = append(ids, task.personList[idx].PersonID) |
| | | notification.PersonObjectList.PersonObject = append(notification.PersonObjectList.PersonObject, *task.personList[idx]) |
| | | } |
| | | |
| | | notification.InfoIDs = strings.Join(ids, ";") |
| | | |
| | | task.mutex.Lock() |
| | | task.personList = []*vo.PersonObject{} |
| | | task.mutex.Unlock() |
| | | |
| | | var req vo.RequestSubscribeNotification |
| | | req.SubscribeNotificationListObject.SubscribeNotificationObject = append(req.SubscribeNotificationListObject.SubscribeNotificationObject, notification) |
| | | |
| | | return &req |
| | | } |
| | |
| | | notification.InfoIDs = strings.Join(ids, ";") |
| | | |
| | | var req vo.RequestSubscribeNotification |
| | | req.SubscribeNotificationListObject.SubscribeNotificationObject[0] = notification |
| | | req.SubscribeNotificationListObject.SubscribeNotificationObject = append(req.SubscribeNotificationListObject.SubscribeNotificationObject, notification) |
| | | |
| | | return &req |
| | | } |