refactor: 使用配置文件的 URL 来拼接回调 URL
This commit is contained in:
@ -1,17 +1,20 @@
|
||||
package onvif
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"github.com/IOTechSystems/onvif/event"
|
||||
"github.com/IOTechSystems/onvif/gosoap"
|
||||
"github.com/gin-gonic/gin"
|
||||
"log"
|
||||
"net/http"
|
||||
"onvif-agent/config"
|
||||
)
|
||||
|
||||
func CreateEventSubscription(c *gin.Context) {
|
||||
xaddr := c.Param("xaddr")
|
||||
// FIXME: 把参数变成传入的参数
|
||||
result, err := conns[xaddr].SubscribeEvents("http://172.16.19.230:8080/events/callback", "PT60S")
|
||||
callbackURL := event.AttributedURIType(fmt.Sprintf("%s/subscriptions/callback", config.Conf.App.URL))
|
||||
result, err := conns[xaddr].SubscribeEvents(callbackURL, "PT60S")
|
||||
if err != nil {
|
||||
c.JSON(http.StatusServiceUnavailable, gin.H{
|
||||
"message": err.Error(),
|
||||
|
Reference in New Issue
Block a user