ctxdata.go 504 B

12345678910111213141516171819202122232425
  1. //@File ctxdata.go
  2. //@Time 2022/04/27
  3. //@Author #Suyghur,
  4. package ctxdata
  5. import (
  6. "context"
  7. "ylink/ext/jwtdata"
  8. )
  9. func GetPlayerIdFromCtx(ctx context.Context) string {
  10. playerId, _ := ctx.Value(jwtdata.JwtKeyPlayerId).(string)
  11. return playerId
  12. }
  13. func GetGameIdFromCtx(ctx context.Context) string {
  14. gameId, _ := ctx.Value(jwtdata.JwtKeyGameId).(string)
  15. return gameId
  16. }
  17. func GetCsIdFromJwt(ctx context.Context) string {
  18. csId, _ := ctx.Value(jwtdata.JwtKeyCsId).(string)
  19. return csId
  20. }