Skip to content

Commit

Permalink
Fix Lint
Browse files Browse the repository at this point in the history
  • Loading branch information
DataEraserC committed Dec 21, 2023
1 parent 90d8620 commit b95edb0
Showing 1 changed file with 11 additions and 6 deletions.
17 changes: 11 additions & 6 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,10 @@ func main() {
}

// Auto Migrate
db.AutoMigrate(&User{}, &Location{}, &Record{}, &Token{})

err = db.AutoMigrate(&User{}, &Location{}, &Record{}, &Token{})
if err != nil {
panic("failed to AutoMigrate database")
}
r := gin.Default()

// 用户注册接口
Expand Down Expand Up @@ -287,9 +289,9 @@ func main() {

var record Record
record.UserID = tokenData.UserID
if err != nil {
// Handle the error if the conversion fails
}
// if err != nil {
// // Handle the error if the conversion fails
// }
record.LocationID = uint(request.LocationID)
record.Date = request.Date
record.Time = request.Time
Expand Down Expand Up @@ -389,7 +391,10 @@ func main() {
c.JSON(200, gin.H{"code": 0, "message": "查询成功", "data": location})
})

r.Run()
err = r.Run()
if err != nil {
panic("failed at r.Run()")
}
}

func generateToken(userID uint) string {
Expand Down

0 comments on commit b95edb0

Please sign in to comment.