获奖记录修改

This commit is contained in:
by 2024-07-31 09:36:57 +08:00
parent ac1ee02c4d
commit 195ce9ff69
3 changed files with 9 additions and 22 deletions

View File

@ -8,7 +8,7 @@ import (
) )
type AwardLog struct { type AwardLog struct {
AwardMap map[int32]int64 //key1:1话费 2实物 key2 itemId value:数量 AwardMap map[int32]map[int32]int64 //key1:1话费 2实物 key2 itemId value:数量
Ts int64 Ts int64
} }

2
public

@ -1 +1 @@
Subproject commit 06d6be8fa6d928f7eb30a4c567abfc43e571cbc4 Subproject commit d789cca81a36ddbaf30e5414b6c4fe530e0631f6

View File

@ -30,25 +30,8 @@ func (this *AwardLogManager) ModuleName() string {
func (this *AwardLogManager) GetAwardLog(plt string, typeId int32) map[int32]int64 { func (this *AwardLogManager) GetAwardLog(plt string, typeId int32) map[int32]int64 {
d := PlatformMgrSingleton.GetConfig(plt).AwardItem d := PlatformMgrSingleton.GetConfig(plt).AwardItem
ret := make(map[int32]int64) ret := make(map[int32]int64)
// 1 话费 2实物 if d.AwardMap[typeId] != nil {
switch typeId { ret = d.AwardMap[typeId]
case 1:
for _, v := range srvdata.GameItemMgr.GetArr(plt) {
if v.GetType() == common.ItemTypeChange {
if d.AwardMap[v.GetId()] > 0 {
ret[v.GetId()] += d.AwardMap[v.GetId()]
}
}
}
case 2:
for _, v := range srvdata.GameItemMgr.GetArr(plt) {
if v.GetType() == common.ItemTypeObjective {
if d.AwardMap[v.GetId()] > 0 {
ret[v.GetId()] += d.AwardMap[v.GetId()]
}
}
}
} }
return ret return ret
} }
@ -70,7 +53,11 @@ func (this *AwardLogManager) GetAnnouncerLog(plt string, typeId int32) []model.A
func (this *AwardLogManager) UpdateAwardLog(plt string, itemId int32, num int64) { func (this *AwardLogManager) UpdateAwardLog(plt string, itemId int32, num int64) {
if srvdata.GameItemMgr.Get(plt, itemId).Type == common.ItemTypeObjective || if srvdata.GameItemMgr.Get(plt, itemId).Type == common.ItemTypeObjective ||
srvdata.GameItemMgr.Get(plt, itemId).Type == common.ItemTypeChange { srvdata.GameItemMgr.Get(plt, itemId).Type == common.ItemTypeChange {
PlatformMgrSingleton.AddAwardItem(plt, itemId, num) typeId := int32(1)
if srvdata.GameItemMgr.Get(plt, itemId).Type == common.ItemTypeChange {
typeId = 2
}
PlatformMgrSingleton.AddAwardItem(plt, itemId, num, typeId)
} }
} }