auth_check_manager.go 3.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119
  1. package model
  2. import (
  3. "rocommon"
  4. )
  5. type AuthCheckMag struct {
  6. rocommon.UpdateModule
  7. authHttpList chan interface{}
  8. }
  9. func NewAuthCheckMag() *AuthCheckMag {
  10. mag := &AuthCheckMag{}
  11. mag.authHttpList = make(chan interface{}, 2000)
  12. return mag
  13. }
  14. func (this *AuthCheckMag) AddCheckList(response interface{}) {
  15. this.authHttpList <- response
  16. }
  17. func (this *AuthCheckMag) Update(ms uint64) {
  18. for {
  19. select {
  20. case msg := <-this.authHttpList:
  21. switch t := msg.(type) {
  22. case *SDKQuickLoginAuthCheckResp:
  23. DoLoginQuickVerifySign(t)
  24. case *SDKNBLoginAuthCheckResp:
  25. DoLoginNBSDKVerifySign(t)
  26. case *SDKUniLoginAuthCheckResp:
  27. DoLoginUniSDKVerifySign(t)
  28. }
  29. default:
  30. return
  31. }
  32. }
  33. }
  34. ////response of http
  35. type CommonInfo struct {
  36. ClintId uint64 //
  37. GateServiceNode string
  38. }
  39. type LoginCheckResponse struct {
  40. CInfo CommonInfo
  41. errorCode int32
  42. platform string
  43. openId string
  44. }
  45. type LoginCheckRequest struct {
  46. CommonInfo
  47. }
  48. //SDK Quick
  49. type SDKQuickLoginAuthCheckReq struct {
  50. Token string
  51. Product_code string
  52. Uid string //从客户端接口获取到的渠道原始uid,无需任何加工如拼接渠道ID等(openid)
  53. }
  54. type SDKQuickLoginAuthCheckResp struct {
  55. RetCode string
  56. ClientId uint64
  57. ServiceId string
  58. OpenId string
  59. Platform string
  60. }
  61. //SDK NB
  62. type SDKNBLoginAuthCheckResp struct {
  63. RetCode string
  64. ClientId uint64
  65. ServiceId string
  66. OpenId string
  67. Platform string
  68. }
  69. //SDK UniSDK
  70. type SDKUniLoginAuthCheckReq struct {
  71. KVList map[string]interface{}
  72. //GameId string `json:"gameid""` //游戏id(手游即游戏代号,小写)
  73. //HostId int `json:"hostid"` //大于等于0, 游戏服务器id(指游戏划分的区服),如果有则传,没有传0
  74. //LoginChannel string `json:"login_channel"` //登录渠道( 如用网易sdk登录login_channel=netease,苹果支付pay_chan nel=app_store)
  75. //AppChannel string `json:"app_channel"` //发行(分发)渠道,支持多级结构,通过UniSDK获取。格式如:netease.gs.123456
  76. //Platform string `json:"platform"` //平台名
  77. //Ip string `json:"ip"` //游戏登录时客户端用户ip, 形如255.255.255.255
  78. //SdkUid string `json:"sdkuid"` //渠道uid,不需要包含域名, 有些渠道的uid中包含有@符号 | wechat_mp_vr渠道传openid
  79. //SessionId string `json:"sessionid"` //sdk返回的session
  80. //SDKVersion string `json:"sdk_version"` //接入渠道sdk的版本号,从UniSDK获取
  81. //Udid string `json:"udid"` //玩家登录的移动设备号,通过UniSDK提供的接口获取
  82. }
  83. type SDKUniLoginAuthCheckResp struct {
  84. Code int `json:"code"` //接口返回码
  85. SubCode int `json:"subcode"` //接口返回子码
  86. Status string `json:"status"` //接口调用状态
  87. UniSDKLoginJson string `json:"unisdk_login_json"`
  88. RetCode string
  89. ClientId uint64
  90. ServiceId string
  91. OpenId string
  92. Platform string
  93. }
  94. type UniSDKLoginJsonSt struct {
  95. Aid string `json:"aid"`
  96. Sdkuid string `json:"sdkUid"`
  97. Username string `json:"username"`
  98. AccessToken string `json:"access_token"`
  99. ExpiresIn string `json:"expires_in"`
  100. }
  101. type SDKCheckUserInfo struct {
  102. Code int `json:"code"`
  103. Aid string `json:"aid"`
  104. ExpireTime uint64 `json:"expiretime"`
  105. LoginChannel string `json:"login_channel"` //登录渠道( 如用网易sdk登录login_channel=netease,苹果支付pay_chan nel=app_store)
  106. AppChannel string `json:"app_channel"` //发行(分发)渠道,支持多级结构,通过UniSDK获取。格式如:netease.gs.123456
  107. EnterSN string `json:"enter_sn"`
  108. }