auth_check_manager.go 4.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140
  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. case *SDKHwQuickLoginAuthCheckResp:
  29. DoLoginHwQuickVerifySign(t)
  30. }
  31. default:
  32. return
  33. }
  34. }
  35. }
  36. // //response of http
  37. type CommonInfo struct {
  38. ClintId uint64 //
  39. GateServiceNode string
  40. }
  41. type LoginCheckResponse struct {
  42. CInfo CommonInfo
  43. errorCode int32
  44. platform string
  45. openId string
  46. }
  47. type LoginCheckRequest struct {
  48. CommonInfo
  49. }
  50. // SDK Quick
  51. type SDKQuickLoginAuthCheckReq struct {
  52. Token string
  53. Product_code string
  54. Uid string //从客户端接口获取到的渠道原始uid,无需任何加工如拼接渠道ID等(openid)
  55. }
  56. type SDKQuickLoginAuthCheckResp struct {
  57. RetCode string
  58. ClientId uint64
  59. ServiceId string
  60. OpenId string
  61. Platform string
  62. }
  63. // SDK NB
  64. type SDKNBLoginAuthCheckResp struct {
  65. RetCode string
  66. ClientId uint64
  67. ServiceId string
  68. OpenId string
  69. Platform string
  70. }
  71. // SDK UniSDK
  72. type SDKUniLoginAuthCheckReq struct {
  73. KVList map[string]interface{}
  74. //GameId string `json:"gameid""` //游戏id(手游即游戏代号,小写)
  75. //HostId int `json:"hostid"` //大于等于0, 游戏服务器id(指游戏划分的区服),如果有则传,没有传0
  76. //LoginChannel string `json:"login_channel"` //登录渠道( 如用网易sdk登录login_channel=netease,苹果支付pay_chan nel=app_store)
  77. //AppChannel string `json:"app_channel"` //发行(分发)渠道,支持多级结构,通过UniSDK获取。格式如:netease.gs.123456
  78. //Platform string `json:"platform"` //平台名
  79. //Ip string `json:"ip"` //游戏登录时客户端用户ip, 形如255.255.255.255
  80. //SdkUid string `json:"sdkuid"` //渠道uid,不需要包含域名, 有些渠道的uid中包含有@符号 | wechat_mp_vr渠道传openid
  81. //SessionId string `json:"sessionid"` //sdk返回的session
  82. //SDKVersion string `json:"sdk_version"` //接入渠道sdk的版本号,从UniSDK获取
  83. //Udid string `json:"udid"` //玩家登录的移动设备号,通过UniSDK提供的接口获取
  84. }
  85. type SDKUniLoginAuthCheckResp struct {
  86. Code int `json:"code"` //接口返回码
  87. SubCode int `json:"subcode"` //接口返回子码
  88. Status string `json:"status"` //接口调用状态
  89. UniSDKLoginJson string `json:"unisdk_login_json"`
  90. RetCode string
  91. ClientId uint64
  92. ServiceId string
  93. OpenId string
  94. Platform string
  95. }
  96. type UniSDKLoginJsonSt struct {
  97. Aid string `json:"aid"`
  98. Sdkuid string `json:"sdkUid"`
  99. Username string `json:"username"`
  100. AccessToken string `json:"access_token"`
  101. ExpiresIn string `json:"expires_in"`
  102. }
  103. type SDKCheckUserInfo struct {
  104. Code int `json:"code"`
  105. Aid string `json:"aid"`
  106. ExpireTime uint64 `json:"expiretime"`
  107. LoginChannel string `json:"login_channel"` //登录渠道( 如用网易sdk登录login_channel=netease,苹果支付pay_chan nel=app_store)
  108. AppChannel string `json:"app_channel"` //发行(分发)渠道,支持多级结构,通过UniSDK获取。格式如:netease.gs.123456
  109. EnterSN string `json:"enter_sn"`
  110. }
  111. // SDK Quick海外
  112. type SDKHwQuickLoginAuthCheckReq struct {
  113. Token string
  114. Product_code string
  115. Uid string //从客户端接口获取到的渠道原始uid,无需任何加工如拼接渠道ID等(openid)
  116. }
  117. type SDKHwQuickLoginAuthCheckResp struct {
  118. RetCode string
  119. ClientId uint64
  120. ServiceId string
  121. OpenId string
  122. Platform string
  123. Status bool `json:"status"`
  124. Message string `json:"message"`
  125. Data interface{} `json:"data"`
  126. Uid string `json:"uid"`
  127. Guid string `json:"guid"`
  128. }