From fe8bf39ee6e69e1723b1585968fa089375733bf9 Mon Sep 17 00:00:00 2001 From: heimoshuiyu Date: Wed, 19 Jul 2023 23:59:29 +0800 Subject: [PATCH] record ip --- record.go | 2 ++ 1 file changed, 2 insertions(+) diff --git a/record.go b/record.go index 237a3c5..5f1921f 100644 --- a/record.go +++ b/record.go @@ -14,6 +14,7 @@ import ( type Record struct { ID uuid.UUID `gorm:"type:uuid"` CreatedAt time.Time + IP string Body string Response string } @@ -23,6 +24,7 @@ func recordUserMessage(c *gin.Context, db *gorm.DB, trackID uuid.UUID, body []by requestRecord := Record{ Body: bodyStr, ID: trackID, + IP: c.ClientIP(), } err := db.Create(&requestRecord).Error if err != nil {