logical_log.go 17 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549
  1. package loging
  2. import (
  3. "context"
  4. "encoding/json"
  5. "errors"
  6. "fmt"
  7. "github.com/go-redis/redis/v8"
  8. "log-server/global"
  9. "log-server/model/log"
  10. "log-server/model/log/request"
  11. "log-server/service/cache"
  12. "strconv"
  13. "strings"
  14. "time"
  15. )
  16. var (
  17. FailStatus = "fail"
  18. OkStatus = "ok"
  19. NoLogStatus = "notStatus"
  20. GameCacheKey = "%s:game"
  21. NodeGameCacheKey = "%s:log"
  22. reportPointsKey = "%s:logUuid:"
  23. logUuidAccountGameId = "%s:logUuid:account:gameId"
  24. ComputerCacheKey = "%s:computer:list"
  25. ComputerPullAccountCacheKey = "%s:computer:%s:pullAccount:"
  26. ComputerTaskSuccessCacheKey = "%s:computer:%s:taskSuccess:"
  27. )
  28. type LogicalLog struct {
  29. Status int // 状态
  30. Request request.AddLogRequest
  31. cache cache.Cache
  32. ScriptType int
  33. }
  34. func (s *LogicalLog) CurrentDate() (current string) {
  35. current = time.Now().Format("2006-01-02")
  36. return
  37. }
  38. func (s *LogicalLog) YesterdayDate() (yesterday string) {
  39. yesterday = time.Now().Add(-time.Hour * 24).Format("2006-01-02")
  40. return
  41. }
  42. func (s *LogicalLog) DataAdd() (err error) {
  43. logInfo, err := s.RepositoryData()
  44. if err != nil {
  45. return err
  46. }
  47. err = s.LogAdd(logInfo)
  48. if err != nil {
  49. return
  50. }
  51. /*if s.Status == 0 {
  52. _ = s.errLogAdd(logInfo)
  53. }*/
  54. err = s.SetGameCache(context.Background(), s.CurrentDate(), logInfo.GameId)
  55. if err != nil {
  56. return
  57. }
  58. err = s.SetAccountGameIdCache(context.Background(), s.CurrentDate(), logInfo)
  59. if err != nil {
  60. return
  61. }
  62. if logInfo.PcCode != "" {
  63. err = s.SetComputerCache(context.Background(), s.CurrentDate(), logInfo.PcCode, logInfo.Operator)
  64. }
  65. return
  66. }
  67. func (s *LogicalLog) NoLogStatusDataAdd(ctx context.Context) (err error) {
  68. logInfo, err := s.RepositoryData()
  69. if err != nil {
  70. return err
  71. }
  72. err = s.LogAdd(logInfo)
  73. return
  74. }
  75. func (s *LogicalLog) getLogByUuid(uuid string) (log log.Loging, err error) {
  76. db := global.GVA_DB.Table("loging")
  77. db = db.Where("log_uuid = ?", uuid)
  78. db = db.Where("coding = 4101099 or coding = 4103099")
  79. db.First(&log)
  80. return
  81. }
  82. func (s *LogicalLog) GetLogByUuidCoding(uuid string, coding int, scriptType int) (log log.Loging, err error) {
  83. db := global.GVA_DB.Table("loging")
  84. db = db.Where("log_uuid = ?", uuid)
  85. db = db.Where("coding = ?", coding)
  86. db = db.Where("script_type = ?", scriptType)
  87. db.First(&log)
  88. return
  89. }
  90. func (s *LogicalLog) RepositoryData() (*log.Loging, error) {
  91. nodeCode, typeCode, err := s.codeData()
  92. if err != nil {
  93. return nil, err
  94. }
  95. if s.Request.GameId == 0 {
  96. loging, err := s.GetAccountGameIdCache(context.Background(), s.CurrentDate(), s.Request.LogUuid)
  97. if err != nil {
  98. return nil, err
  99. }
  100. if loging.GameId == 0 {
  101. return nil, errors.New("没有找到数据" + s.Request.LogUuid)
  102. }
  103. s.Request.GameId = loging.GameId
  104. s.Request.Account = loging.Account
  105. s.Request.DeviceId = loging.DeviceId
  106. s.Request.ComputerType = loging.ComputerType
  107. s.Request.EnvCode = loging.EnvCode
  108. s.Request.Operator = loging.Operator
  109. s.Request.PcCode = loging.PcCode
  110. s.Request.PcIp = loging.PcIp
  111. s.Request.PcMac = loging.PcMac
  112. s.Request.SimulatorIp = loging.SimulatorIp
  113. s.Request.SimulatorMac = loging.SimulatorMac
  114. s.Request.AccountType = loging.AccountType
  115. s.Request.TaskType = loging.TaskType
  116. }
  117. logInfo := new(log.Loging)
  118. logInfo.Coding = s.Request.Coding
  119. logInfo.GameId = s.Request.GameId
  120. logInfo.Status = s.Status
  121. logInfo.Account = s.Request.Account
  122. logInfo.NodeCoding = nodeCode
  123. logInfo.TypeCoding = typeCode
  124. logInfo.DeviceId = s.Request.DeviceId
  125. logInfo.ComputerType = s.Request.ComputerType
  126. logInfo.EnvCode = s.Request.EnvCode
  127. logInfo.LogUuid = s.Request.LogUuid
  128. logInfo.Operator = s.Request.Operator
  129. logInfo.PcCode = s.Request.PcCode
  130. logInfo.PcIp = s.Request.PcIp
  131. logInfo.SimulatorIp = s.Request.SimulatorIp
  132. logInfo.SimulatorMac = s.Request.SimulatorMac
  133. logInfo.PcMac = s.Request.PcMac
  134. logInfo.AccountType = s.Request.AccountType
  135. logInfo.TaskType = s.Request.TaskType
  136. logInfo.ScriptType = s.ScriptType
  137. logInfo.CreateDate = time.Now().Format("2006-01-02")
  138. logInfo.CreateTime = time.Now().Format("2006-01-02 15:04:05")
  139. return logInfo, err
  140. }
  141. func (s *LogicalLog) codeData() (nodeCode, typeCode int, err error) {
  142. code := strconv.Itoa(s.Request.Coding)
  143. nodeCodeStr := code[:3]
  144. typeCodeStr := code[:5]
  145. nodeCode, err = strconv.Atoi(nodeCodeStr)
  146. if err != nil {
  147. return
  148. }
  149. typeCode, err = strconv.Atoi(typeCodeStr)
  150. return
  151. }
  152. func (s *LogicalLog) LogAdd(l *log.Loging) error {
  153. return global.GVA_DB.Create(&l).Error
  154. }
  155. func (s *LogicalLog) errLogAdd(l *log.Loging) error {
  156. return global.GVA_DB.Table("err_log").Create(&l).Error
  157. }
  158. func (s *LogicalLog) ReportPointsLog(ctx context.Context, request1 request.AddLogRequest) (err error) {
  159. key := reportPointsKey + request1.LogUuid
  160. status, err := global.GVA_REDIS.Exists(ctx, key).Result()
  161. if err != nil {
  162. return
  163. }
  164. var reportPointsData []*request.ReportPointsData
  165. if status == 0 {
  166. reportData := new(request.ReportPointsData)
  167. reportData.Data = request1.ReportPointsData
  168. reportData.Date = time.Now().Format("2006-01-02 15:04:05")
  169. reportPointsData = append(reportPointsData, reportData)
  170. str, _ := json.Marshal(reportPointsData)
  171. global.GVA_REDIS.Set(ctx, key, str, time.Minute*20)
  172. } else {
  173. str, _ := global.GVA_REDIS.Get(ctx, key).Result()
  174. err := json.Unmarshal([]byte(str), &reportPointsData)
  175. if err != nil {
  176. return err
  177. }
  178. reportData := new(request.ReportPointsData)
  179. reportData.Data = request1.ReportPointsData
  180. reportData.Date = time.Now().Format("2006-01-02 15:04:05")
  181. reportPointsData = append(reportPointsData, reportData)
  182. str1, _ := json.Marshal(reportPointsData)
  183. global.GVA_REDIS.Set(ctx, key, str1, time.Minute*20)
  184. }
  185. return err
  186. }
  187. func (s *LogicalLog) ReportPointsLogAdd(ctx context.Context, request1 request.AddLogRequest, status int) (err error) {
  188. key := reportPointsKey + request1.LogUuid
  189. isNull, err := global.GVA_REDIS.Exists(ctx, key).Result()
  190. if err != nil {
  191. return
  192. }
  193. if isNull == 0 {
  194. return
  195. } else {
  196. str, err := global.GVA_REDIS.Get(ctx, key).Result()
  197. if err != nil {
  198. return err
  199. }
  200. logIfo, _ := s.GetAccountGameIdCache(ctx, s.CurrentDate(), request1.LogUuid)
  201. var reportPointsData []*request.ReportPointsData
  202. err = json.Unmarshal([]byte(str), &reportPointsData)
  203. if err != nil {
  204. return err
  205. }
  206. reportPoints := new(log.ReportPointsLog)
  207. reportPoints.ReportPointsData = str
  208. reportPoints.LogUuid = request1.LogUuid
  209. reportPoints.Status = status
  210. reportPoints.Account = logIfo.Account
  211. reportPoints.GameId = logIfo.GameId
  212. reportPoints.Coding = logIfo.Coding
  213. reportPoints.ReportPointsNum = len(reportPointsData)
  214. reportPoints.CreateDate = time.Now().Format("2006-01-02")
  215. reportPoints.CreateTime = time.Now().Format("2006-01-02 15:04:05")
  216. err = global.GVA_DB.Create(&reportPoints).Error
  217. if err != nil {
  218. return err
  219. }
  220. global.GVA_REDIS.Del(ctx, key)
  221. err = s.DelAccountGameIdCache(ctx, s.CurrentDate(), logIfo.LogUuid)
  222. }
  223. return
  224. }
  225. func (s *LogicalLog) ExistsKey(ctx context.Context, key string) (bool, error) {
  226. isNull, err := global.GVA_REDIS.Exists(ctx, key).Result()
  227. if err != nil {
  228. return false, err
  229. }
  230. if isNull == 0 {
  231. return false, nil
  232. } else {
  233. return true, nil
  234. }
  235. }
  236. func (s *LogicalLog) ExistsHsKey(ctx context.Context, key string, field string) (bool, error) {
  237. isNull, err := global.GVA_REDIS.HExists(ctx, key, field).Result()
  238. if err != nil {
  239. return false, err
  240. }
  241. return isNull, err
  242. }
  243. // 前3个编号
  244. func (s *LogicalLog) NodeLogSetNum(ctx context.Context, date string, gameId int, code string, status string, taskType int) (err error) {
  245. node := code[:3]
  246. err = s.LogSetNum(ctx, date, gameId, node, status, taskType)
  247. return
  248. }
  249. // 前5个编号
  250. func (s *LogicalLog) TypeLogSetNum(ctx context.Context, date string, gameId int, code string, status string, taskType int) (err error) {
  251. node := code[:5]
  252. err = s.LogSetNum(ctx, date, gameId, node, status, taskType)
  253. return
  254. }
  255. // 整个编号
  256. func (s *LogicalLog) CodeLogSetNum(ctx context.Context, date string, gameId int, code string, status string, taskType int) (err error) {
  257. err = s.LogSetNum(ctx, date, gameId, code, status, taskType)
  258. return
  259. }
  260. // 前5个编号和整个编号缓存
  261. func (s *LogicalLog) PartTypeLogSetNum(ctx context.Context, date string, gameId int, code string, status string, taskType int) (err error) {
  262. node := code[:5]
  263. err = s.LogSetNum(ctx, date, gameId, node, status, taskType)
  264. if err != nil {
  265. return
  266. }
  267. err = s.LogSetNum(ctx, date, gameId, code, status, taskType)
  268. return
  269. }
  270. func (s *LogicalLog) LogSetNum(ctx context.Context, date string, gameId int, code string, status string, taskType int) (err error) {
  271. strGameId := strconv.Itoa(gameId)
  272. nodeGameCacheKey := fmt.Sprintf(NodeGameCacheKey, date)
  273. key := nodeGameCacheKey + ":" + strGameId + ":" + strconv.Itoa(taskType) + ":" + status + ":" + code
  274. err = s.SetCacheNum(ctx, key)
  275. return
  276. }
  277. func (s *LogicalLog) SetCacheNum(ctx context.Context, key string) (err error) {
  278. bl, err := s.ExistsKey(ctx, key)
  279. if err != nil {
  280. return err
  281. }
  282. if !bl {
  283. err = global.GVA_REDIS.Set(ctx, key, 1, time.Hour*48).Err()
  284. return err
  285. } else {
  286. err = global.GVA_REDIS.Incr(ctx, key).Err()
  287. return err
  288. }
  289. }
  290. func (s *LogicalLog) NodeLogGetNum(ctx context.Context, date string, gameId int, code string, status string, taskType int) (num int, err error) {
  291. node := code[:3]
  292. num, err = s.LogGetNum(ctx, date, gameId, node, status, taskType)
  293. return
  294. }
  295. func (s *LogicalLog) TypeLogGetNum(ctx context.Context, date string, gameId int, code string, status string, taskType int) (num int, err error) {
  296. node := code[:5]
  297. num, err = s.LogGetNum(ctx, date, gameId, node, status, taskType)
  298. return
  299. }
  300. func (s *LogicalLog) CodeLogGetNum(ctx context.Context, date string, gameId int, code string, status string, taskType int) (num int, err error) {
  301. num, err = s.LogGetNum(ctx, date, gameId, code, status, taskType)
  302. return
  303. }
  304. func (s *LogicalLog) LogGetNum(ctx context.Context, date string, gameId int, code string, status string, taskType int) (num int, err error) {
  305. strGameId := strconv.Itoa(gameId)
  306. nodeGameCacheKey := fmt.Sprintf(NodeGameCacheKey, date)
  307. key := nodeGameCacheKey + ":" + strGameId + ":" + strconv.Itoa(taskType) + ":" + status + ":" + code
  308. num, err = s.GetCacheNum(ctx, key)
  309. return
  310. }
  311. func (s *LogicalLog) GetCacheNum(ctx context.Context, key string) (num int, err error) {
  312. num, err = global.GVA_REDIS.Get(ctx, key).Int()
  313. if err != nil {
  314. if err == redis.Nil {
  315. return 0, nil
  316. }
  317. return 0, err
  318. }
  319. return num, err
  320. }
  321. func (s *LogicalLog) SetGameCache(ctx context.Context, date string, gameId int) (err error) {
  322. key := fmt.Sprintf(GameCacheKey, date)
  323. _, err = global.GVA_REDIS.HSet(ctx, key, gameId, 1).Result()
  324. if err != nil {
  325. return err
  326. }
  327. return err
  328. }
  329. func (s *LogicalLog) GetGameCache(ctx context.Context, date string) (mps map[string]string, err error) {
  330. key := fmt.Sprintf(GameCacheKey, date)
  331. mps, err = global.GVA_REDIS.HGetAll(ctx, key).Result()
  332. if err != nil {
  333. return mps, err
  334. }
  335. return mps, err
  336. }
  337. func (s *LogicalLog) SetAccountGameIdCache(ctx context.Context, date string, logInfo *log.Loging) (err error) {
  338. key := fmt.Sprintf(logUuidAccountGameId, date)
  339. value, _ := json.Marshal(logInfo)
  340. _, err = global.GVA_REDIS.HGet(ctx, key, logInfo.LogUuid).Result()
  341. if err != nil {
  342. if err == redis.Nil {
  343. _, err = global.GVA_REDIS.HSet(ctx, key, logInfo.LogUuid, value).Result()
  344. if err != nil {
  345. return err
  346. }
  347. } else {
  348. return err
  349. }
  350. }
  351. return err
  352. }
  353. func (s *LogicalLog) GetAccountGameIdCache(ctx context.Context, date string, uuid string) (logInfo log.Loging, err error) {
  354. key := fmt.Sprintf(logUuidAccountGameId, date)
  355. data, err := global.GVA_REDIS.HGet(ctx, key, uuid).Result()
  356. if err != nil {
  357. if err == redis.Nil {
  358. logInfo, err = s.getLogByUuid(uuid)
  359. return logInfo, nil
  360. }
  361. return logInfo, err
  362. }
  363. err = json.Unmarshal([]byte(data), &logInfo)
  364. return
  365. }
  366. func (s *LogicalLog) DelAccountGameIdCache(ctx context.Context, date string, uuid string) (err error) {
  367. key := fmt.Sprintf(logUuidAccountGameId, date)
  368. _, err = global.GVA_REDIS.HDel(ctx, key, uuid).Result()
  369. return
  370. }
  371. func (s *LogicalLog) GetGameStatisticsCacheKeys(ctx context.Context, date string, gameId int, taskType int) (keys []string, err error) {
  372. strGameId := strconv.Itoa(gameId)
  373. nodeGameCacheKey := fmt.Sprintf(NodeGameCacheKey, date)
  374. key := nodeGameCacheKey + ":" + strGameId + ":" + strconv.Itoa(taskType) + ":*"
  375. keys, err = global.GVA_REDIS.Keys(ctx, key).Result()
  376. return
  377. }
  378. func (s *LogicalLog) ByCacheKeyGetEndNode(key string) (code string) {
  379. str := strings.Split(key, ":")
  380. code = str[len(str)-1]
  381. return
  382. }
  383. func (s *LogicalLog) SetUuidCodeCache(ctx context.Context, date string, uuid string, code int, gameId int) (err error) {
  384. key := fmt.Sprintf(reportPointsKey, date) + strconv.Itoa(gameId) + ":" + uuid
  385. _, err = global.GVA_REDIS.HSet(ctx, key, code, 1).Result()
  386. if err != nil {
  387. return err
  388. }
  389. return err
  390. }
  391. func (s *LogicalLog) ExistsUuidCodeCache(ctx context.Context, date string, uuid string, code int, gameId int) (b bool, err error) {
  392. key := fmt.Sprintf(reportPointsKey, date) + strconv.Itoa(gameId) + ":" + uuid
  393. b, err = s.ExistsHsKey(ctx, key, strconv.Itoa(code))
  394. if err != nil {
  395. return false, err
  396. }
  397. return
  398. }
  399. func (s *LogicalLog) GetCacheKeys(ctx context.Context, keys string) (key []string, err error) {
  400. key, err = global.GVA_REDIS.Keys(ctx, keys).Result()
  401. return
  402. }
  403. func (s *LogicalLog) DelStatisticsNumCache(ctx context.Context, date string, gameId int) (err error) {
  404. key1FailStatus := fmt.Sprintf(NodeGameCacheKey, date) + ":" + strconv.Itoa(gameId) + ":" + "1" + ":" + FailStatus + ":*"
  405. key1NoLogStatus := fmt.Sprintf(NodeGameCacheKey, date) + ":" + strconv.Itoa(gameId) + ":" + "1" + ":" + NoLogStatus + ":*"
  406. key1OkStatus := fmt.Sprintf(NodeGameCacheKey, date) + ":" + strconv.Itoa(gameId) + ":" + "1" + ":" + OkStatus + ":*"
  407. key0FailStatus := fmt.Sprintf(NodeGameCacheKey, date) + ":" + strconv.Itoa(gameId) + ":" + "0" + ":" + FailStatus + ":*"
  408. key0NoLogStatus := fmt.Sprintf(NodeGameCacheKey, date) + ":" + strconv.Itoa(gameId) + ":" + "0" + ":" + NoLogStatus + ":*"
  409. key0OkStatus := fmt.Sprintf(NodeGameCacheKey, date) + ":" + strconv.Itoa(gameId) + ":" + "0" + ":" + OkStatus + ":*"
  410. fmt.Println(key1FailStatus)
  411. fmt.Println(key1NoLogStatus)
  412. fmt.Println(key1OkStatus)
  413. fmt.Println(key0FailStatus)
  414. fmt.Println(key0NoLogStatus)
  415. fmt.Println(key0OkStatus)
  416. err = s.cache.DelBatheCache(ctx, key1FailStatus)
  417. err = s.cache.DelBatheCache(ctx, key1NoLogStatus)
  418. err = s.cache.DelBatheCache(ctx, key1OkStatus)
  419. err = s.cache.DelBatheCache(ctx, key0FailStatus)
  420. err = s.cache.DelBatheCache(ctx, key0NoLogStatus)
  421. err = s.cache.DelBatheCache(ctx, key0OkStatus)
  422. if err != nil {
  423. return err
  424. }
  425. return
  426. }
  427. func (s *LogicalLog) DelUuidCodeCache(ctx context.Context, date string, gameId int) (err error) {
  428. key := fmt.Sprintf(reportPointsKey, date) + strconv.Itoa(gameId) + ":*"
  429. keys, err := global.GVA_REDIS.Keys(ctx, key).Result()
  430. for _, v := range keys {
  431. err = s.cache.DelBatheHsCache(ctx, v)
  432. }
  433. if err != nil {
  434. return err
  435. }
  436. return err
  437. }
  438. // 统计电脑使用的记录
  439. func (s *LogicalLog) SetComputerCache(ctx context.Context, date string, pcCode, operator string) (err error) {
  440. key := fmt.Sprintf(ComputerCacheKey, date)
  441. _, err = global.GVA_REDIS.HSet(ctx, key, pcCode, operator).Result()
  442. if err != nil {
  443. return err
  444. }
  445. return err
  446. }
  447. // 获取统计电脑使用的记录
  448. func (s *LogicalLog) GetComputerCache(ctx context.Context, date string) (mps map[string]string, err error) {
  449. key := fmt.Sprintf(ComputerCacheKey, date)
  450. mps, err = global.GVA_REDIS.HGetAll(ctx, key).Result()
  451. if err != nil {
  452. return mps, err
  453. }
  454. return mps, err
  455. }
  456. // 统计电脑拉取账号的数量
  457. func (s *LogicalLog) SetComputerPullAccountNumCache(ctx context.Context, date string, pcCode string, gameId int) (err error) {
  458. key := fmt.Sprintf(ComputerPullAccountCacheKey, date, pcCode) + strconv.Itoa(gameId)
  459. err = s.cache.SetCacheNum(ctx, key)
  460. return err
  461. }
  462. // 获取统计电脑拉取账号的数量
  463. func (s *LogicalLog) GetComputerPullAccountNumCache(ctx context.Context, date string, pcCode string) (mps map[string]int, err error) {
  464. key := fmt.Sprintf(ComputerPullAccountCacheKey, date, pcCode)
  465. mps, err = s.GetByPcCodeGameNumCache(ctx, key)
  466. if len(mps) == 0 {
  467. return
  468. }
  469. return
  470. }
  471. // 统计电脑任务成功的数量
  472. func (s *LogicalLog) SetComputerTaskSuccessNumCache(ctx context.Context, date string, pcCode string, gameId int) (err error) {
  473. key := fmt.Sprintf(ComputerTaskSuccessCacheKey, date, pcCode) + strconv.Itoa(gameId)
  474. err = s.cache.SetCacheNum(ctx, key)
  475. return err
  476. }
  477. // 获取统计电脑任务成功的数量
  478. func (s *LogicalLog) GetComputerTaskSuccessNumCache(ctx context.Context, date string, pcCode string) (mps map[string]int, err error) {
  479. key := fmt.Sprintf(ComputerTaskSuccessCacheKey, date, pcCode)
  480. mps, err = s.GetByPcCodeGameNumCache(ctx, key)
  481. if len(mps) == 0 {
  482. return
  483. }
  484. return
  485. }
  486. // 通过电脑code获取游戏缓存的数量
  487. func (s *LogicalLog) GetByPcCodeGameNumCache(ctx context.Context, key string) (mps map[string]int, err error) {
  488. key += "*"
  489. data, err := s.cache.GetCacheKeys(ctx, key)
  490. if len(data) == 0 {
  491. return
  492. }
  493. mps = make(map[string]int)
  494. for _, k := range data {
  495. gameId := s.ByCacheKeyGetEndNode(k)
  496. num, _ := s.cache.GetCacheNum(ctx, k)
  497. mps[gameId] = num
  498. }
  499. return
  500. }