Commit 34aa5a1989f340f90ca4eb6df3ca737e2a3d7e10

Authored by 王家文
1 parent 0b461d56
Exists in master

feat✨:卡牌活动星星商店的卡包可能为多个

service/cardholder/dto-player.go
... ... @@ -40,26 +40,26 @@ func NewPlayer(uid int64) *Player {
40 40  
41 41 // PlayerDetails 详情
42 42 type PlayerDetails struct {
43   - Cards map[int]int // 每张卡集了多少张 k=卡牌ID v=数量
44   - Album map[int]int // 卡组奖励领取 k=卡组ID v=数量
45   - StarSequenceScales map[string]int // 星级序列刻度 k=ID_用户序列_用户分组 v=刻度
46   - CardSequenceScales map[string]int // 卡牌序列刻度 k=ID_用户序列_用户分组 v=刻度
47   - Round int // 卡册当前轮次
48   - StarCount int // 星星点数
49   - LastStarCount int // 上期活动剩余星星点数
50   - AutoExchangeHolder []int // 活动切换时自动兑换的卡包
51   - SequenceId int // 用户序列组ID
  43 + Cards map[int]int // 每张卡集了多少张 k=卡牌ID v=数量
  44 + Album map[int]int // 卡组奖励领取 k=卡组ID v=数量
  45 + StarSequenceScales map[string]int // 星级序列刻度 k=ID_用户序列_用户分组 v=刻度
  46 + CardSequenceScales map[string]int // 卡牌序列刻度 k=ID_用户序列_用户分组 v=刻度
  47 + Round int // 卡册当前轮次
  48 + StarCount int // 星星点数
  49 + LastStarCount int // 上期活动剩余星星点数
  50 + AutoExchangeHolderIds []int // 活动切换时自动兑换的卡包
  51 + SequenceId int // 用户序列组ID
52 52 }
53 53  
54 54 func NewPlayerDetails() *PlayerDetails {
55 55 return &PlayerDetails{
56   - Cards: make(map[int]int),
57   - Album: make(map[int]int),
58   - StarSequenceScales: make(map[string]int),
59   - CardSequenceScales: make(map[string]int),
60   - Round: 1,
61   - StarCount: 0,
62   - AutoExchangeHolder: make([]int, 0),
  56 + Cards: make(map[int]int),
  57 + Album: make(map[int]int),
  58 + StarSequenceScales: make(map[string]int),
  59 + CardSequenceScales: make(map[string]int),
  60 + Round: 1,
  61 + StarCount: 0,
  62 + AutoExchangeHolderIds: make([]int, 0),
63 63 }
64 64 }
65 65  
... ...
service/cardholder/handle.go
... ... @@ -353,7 +353,7 @@ func HandleAutoExchangeInfo(req *models.ReqAutoExchangeInfo) (code string, rsp m
353 353 }
354 354  
355 355 rsp.LastStarCount = player.Details.LastStarCount
356   - rsp.AutoExchangeHolder = player.Details.AutoExchangeHolder
  356 + rsp.AutoExchangeHolder = player.Details.AutoExchangeHolderIds
357 357  
358 358 // 把当前的卡包内数据放在新卡数据里给客户端
359 359 for i1, i2 := range player.Details.Cards {
... ... @@ -363,7 +363,7 @@ func HandleAutoExchangeInfo(req *models.ReqAutoExchangeInfo) (code string, rsp m
363 363 }
364 364  
365 365 player.Details.LastStarCount = 0
366   - player.Details.AutoExchangeHolder = make([]int, 0)
  366 + player.Details.AutoExchangeHolderIds = make([]int, 0)
367 367 // 存档
368 368 SavePlayer(gameId, player)
369 369  
... ...
service/cardholder/logic.go
... ... @@ -392,7 +392,7 @@ func NextActivityAutoExchange(gameId string, player *Player, config *confcardhol
392 392 // 遍历
393 393 for _, configStarShop := range list {
394 394 if player.Details.LastStarCount >= configStarShop.NeedStarNumber {
395   - player.Details.AutoExchangeHolder = GetCardholder(configStarShop)
  395 + player.Details.AutoExchangeHolderIds = GetCardholder(configStarShop)
396 396 break
397 397 }
398 398 }
... ... @@ -402,7 +402,7 @@ func NextActivityAutoExchange(gameId string, player *Player, config *confcardhol
402 402 sequenceId := player.Details.SequenceId
403 403 cohort := GetCohort(player.Uid)
404 404 allNewCards := make([]int, 0)
405   - for _, cardholderId := range player.Details.AutoExchangeHolder {
  405 + for _, cardholderId := range player.Details.AutoExchangeHolderIds {
406 406 confCardholder, okCardholder := config.CardholderConfig[cardholderId]
407 407 if !okCardholder {
408 408 lxalilog.Errors("StarShopConfig.CardBagIds error", cardholderId)
... ...