feat: import services and standardize Go 1.26.5

This commit is contained in:
2026-08-09 10:43:45 +08:00
parent 689c74b28f
commit 86024fa81d
1456 changed files with 220765 additions and 2 deletions

View File

@@ -0,0 +1,35 @@
package hello
import (
"fmt"
"github.com/gin-contrib/sessions"
"github.com/gin-gonic/gin"
)
// Ping
func Ping(ctx *gin.Context) {
// file, err := ctx.FormFile("fileContent")
// if err != nil {
// fmt.Println("err", err)
// return
// }
// ctx.SaveUploadedFile(file, "./tmp/"+file.Filename)
// ctx.JSON(200, gin.H{
// "msg": file,
// })
ctx.JSON(200, gin.H{"message": "Pong"})
}
func SessionDemo(ctx *gin.Context) {
session := sessions.Default(ctx)
session.Set("key", "12345")
if err := session.Save(); err != nil {
ctx.JSON(500, gin.H{"error": err.Error()})
return
}
value := session.Get("key")
fmt.Println("session value: ", value)
ctx.JSON(200, gin.H{"message": "Pong"})
}