header.go 766 B

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. package Utils
  2. import "strings"
  3. func CheckUserAgent(userAgent string) bool {
  4. Status := false
  5. if strings.Contains(userAgent, "GodotEngine") {
  6. Status = true
  7. }
  8. return Status
  9. }
  10. func CheckGame(token string) (int, int, bool) {
  11. Status := false
  12. GameId := 0
  13. GameAccountId := 0
  14. if token != "" {
  15. tokenMap, _ := DecodeId(128, token)
  16. if len(tokenMap) == 2 {
  17. GameId = tokenMap[0]
  18. GameAccountId = tokenMap[1]
  19. Status = true
  20. }
  21. }
  22. if GameId == 0 || GameAccountId == 0 {
  23. Status = false
  24. }
  25. return GameId, GameAccountId, Status
  26. }
  27. func CheckUser(token string) (int, bool) {
  28. Status := false
  29. Uid := 0
  30. if token != "" {
  31. tokenMap, _ := DecodeId(32, token)
  32. if len(tokenMap) == 3 {
  33. Uid = tokenMap[0]
  34. Status = true
  35. }
  36. }
  37. return Uid, Status
  38. }