Update main.go
This commit is contained in:
7
main.go
7
main.go
@@ -321,6 +321,10 @@ func gpsHandler(c *gin.Context) {
|
|||||||
|
|
||||||
wg.Wait()
|
wg.Wait()
|
||||||
|
|
||||||
|
// Log forwarding results
|
||||||
|
log.Printf("Dawarich forwarding: success=%t, error=%s", dawarichResult.Success, dawarichResult.Error)
|
||||||
|
log.Printf("HomeAssistant forwarding: success=%t, error=%s", haResult.Success, haResult.Error)
|
||||||
|
|
||||||
response := Response{
|
response := Response{
|
||||||
Timestamp: time.Now().Format(time.RFC3339),
|
Timestamp: time.Now().Format(time.RFC3339),
|
||||||
ReceivedData: gpsData,
|
ReceivedData: gpsData,
|
||||||
@@ -337,6 +341,9 @@ func gpsHandler(c *gin.Context) {
|
|||||||
statusCode := http.StatusInternalServerError
|
statusCode := http.StatusInternalServerError
|
||||||
if dawarichResult.Success || haResult.Success {
|
if dawarichResult.Success || haResult.Success {
|
||||||
statusCode = http.StatusOK
|
statusCode = http.StatusOK
|
||||||
|
log.Printf("GPS data processed successfully (status=%d)", statusCode)
|
||||||
|
} else {
|
||||||
|
log.Printf("All forwarding services failed, returning status=%d", statusCode)
|
||||||
}
|
}
|
||||||
|
|
||||||
c.JSON(statusCode, response)
|
c.JSON(statusCode, response)
|
||||||
|
|||||||
Reference in New Issue
Block a user