refactor: eiblog

This commit is contained in:
deepzz0
2021-04-26 15:51:16 +08:00
parent bd69c62254
commit 68e01cdf1f
843 changed files with 3606 additions and 1007377 deletions

18
pkg/mid/u.go Normal file
View File

@@ -0,0 +1,18 @@
// Package mid provides ...
package mid
import (
"github.com/gin-gonic/gin"
"github.com/gofrs/uuid"
)
// UserMiddleware 用户cookie标记
func UserMiddleware() gin.HandlerFunc {
return func(c *gin.Context) {
cookie, err := c.Cookie("u")
if err != nil || cookie == "" {
u1 := uuid.Must(uuid.NewV4()).String()
c.SetCookie("u", u1, 86400*730, "/", "", true, true)
}
}
}