gin.go 467 B

12345678910111213141516171819202122
  1. package utils
  2. import "github.com/gin-gonic/gin"
  3. func SetBridgeLogListByClaims(c *gin.Context, logStr string) {
  4. bridgeLogList := GetBridgeLogListByClaims(c)
  5. bridgeLogList = append(bridgeLogList, logStr)
  6. c.Set("bridge_log", bridgeLogList)
  7. return
  8. }
  9. func GetBridgeLogListByClaims(c *gin.Context) (bridgeLogList []string) {
  10. claims, exists := c.Get("bridge_log")
  11. if !exists {
  12. bridgeLogList = []string{}
  13. return
  14. }
  15. bridgeLogList = claims.([]string)
  16. return
  17. }