feat: 为通知接口添加CRUD
This commit is contained in:
parent
ae9fd0d5b0
commit
c8b33a27f6
@ -9,3 +9,15 @@ import (
|
||||
func GetNotifications(c *gin.Context) {
|
||||
response.NewResponse().WithData(onvif.Notifications).Send(c)
|
||||
}
|
||||
|
||||
func GetNotificationByXaddr(c *gin.Context) {
|
||||
xaddr := c.Param("xaddr")
|
||||
response.NewResponse().WithData(onvif.Notifications[xaddr]).Send(c)
|
||||
}
|
||||
|
||||
func DeleteNotificationByXaddr(c *gin.Context) {
|
||||
xaddr := c.Param("xaddr")
|
||||
delete(onvif.Notifications, xaddr)
|
||||
|
||||
response.NewResponse().Success().Send(c)
|
||||
}
|
||||
|
@ -71,7 +71,7 @@ func GetSessionByXaddr(c *gin.Context) {
|
||||
response.NewResponse().WithData(info).Send(c)
|
||||
}
|
||||
|
||||
func DeleteSession(c *gin.Context) {
|
||||
func DeleteSessionByXaddr(c *gin.Context) {
|
||||
xaddr := c.Param("xaddr")
|
||||
delete(onvif.Sessions, xaddr)
|
||||
|
||||
|
@ -17,7 +17,7 @@ func SetupRoutes(r *gin.Engine) {
|
||||
connectionGroup.POST("/", onvif.CreateSession)
|
||||
connectionGroup.GET("/", onvif.GetSessions)
|
||||
connectionGroup.GET("/:xaddr", onvif.GetSessionByXaddr)
|
||||
connectionGroup.DELETE("/:xaddr", onvif.DeleteSession)
|
||||
connectionGroup.DELETE("/:xaddr", onvif.DeleteSessionByXaddr)
|
||||
}
|
||||
|
||||
subscriptionGroup := onvifGroup.Group("/subscriptions")
|
||||
@ -29,6 +29,8 @@ func SetupRoutes(r *gin.Engine) {
|
||||
notificationGroup := onvifGroup.Group("/notifications")
|
||||
{
|
||||
notificationGroup.GET("/", onvif.GetNotifications)
|
||||
notificationGroup.GET("/:xaddr", onvif.GetNotificationByXaddr)
|
||||
notificationGroup.DELETE("/:xaddr", onvif.DeleteNotificationByXaddr)
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user