Compare commits
2 Commits
78d6a109fe
...
83cfbe6381
Author | SHA1 | Date |
---|---|---|
|
83cfbe6381 | |
|
aaf15d2b3d |
Binary file not shown.
|
@ -801,7 +801,7 @@
|
||||||
1,
|
1,
|
||||||
0
|
0
|
||||||
],
|
],
|
||||||
"Type": 13,
|
"Type": 19,
|
||||||
"Effect0": [
|
"Effect0": [
|
||||||
0,
|
0,
|
||||||
0,
|
0,
|
||||||
|
|
Binary file not shown.
BIN
data/DB_Task.dat
BIN
data/DB_Task.dat
Binary file not shown.
|
@ -75,6 +75,7 @@ type PlayerDiffData struct {
|
||||||
RankScore map[int32]int64 // 排位积分
|
RankScore map[int32]int64 // 排位积分
|
||||||
PhoneScore int64 //手机积分
|
PhoneScore int64 //手机积分
|
||||||
InviteScore int64 // 邀请积分
|
InviteScore int64 // 邀请积分
|
||||||
|
Long int64 // 龙币
|
||||||
}
|
}
|
||||||
|
|
||||||
type PlayerBaseData struct {
|
type PlayerBaseData struct {
|
||||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -318,6 +318,7 @@ message PlayerData {
|
||||||
int32 Age = 47; // 年龄
|
int32 Age = 47; // 年龄
|
||||||
repeated WeekInfo WeekCard = 48;//周卡
|
repeated WeekInfo WeekCard = 48;//周卡
|
||||||
repeated int32 RequestAddFriend = 49;//请求添加好友信息
|
repeated int32 RequestAddFriend = 49;//请求添加好友信息
|
||||||
|
int64 Long = 50; // 龙币
|
||||||
}
|
}
|
||||||
|
|
||||||
//周卡数据
|
//周卡数据
|
||||||
|
@ -360,6 +361,7 @@ message SCPlayerDataUpdate {
|
||||||
map<int32,int64> RankScore = 12; // 排位积分
|
map<int32,int64> RankScore = 12; // 排位积分
|
||||||
int64 PhoneScore = 13; //手机积分
|
int64 PhoneScore = 13; //手机积分
|
||||||
int64 InviteScore = 14; // 邀请积分
|
int64 InviteScore = 14; // 邀请积分
|
||||||
|
int64 Long = 15; // 龙币
|
||||||
}
|
}
|
||||||
|
|
||||||
//获取第三方玩家信息
|
//获取第三方玩家信息
|
||||||
|
|
2
public
2
public
|
@ -1 +1 @@
|
||||||
Subproject commit 8c59aeb37871428f135c6423cde777c09ad0e3f0
|
Subproject commit 63eadb869736b9d3e16c993cd99675c0e0de638c
|
|
@ -595,7 +595,7 @@ func CSPermitInfo(s *netlib.Session, packetid int, data interface{}, sid int64)
|
||||||
pack := &welfare.SCPermitInfo{
|
pack := &welfare.SCPermitInfo{
|
||||||
Exp: exp,
|
Exp: exp,
|
||||||
Level: level,
|
Level: level,
|
||||||
Timestamp: []int64{startTs, endTs},
|
Timestamp: []int64{startTs, endTs - 1},
|
||||||
IsPermit: p.GetIsPermit(),
|
IsPermit: p.GetIsPermit(),
|
||||||
RefreshTs: common.GetDayNextStartTs(time.Now().Unix()),
|
RefreshTs: common.GetDayNextStartTs(time.Now().Unix()),
|
||||||
}
|
}
|
||||||
|
@ -698,13 +698,12 @@ func CSPermitAward(s *netlib.Session, packetid int, data interface{}, sid int64)
|
||||||
}
|
}
|
||||||
startTs := PlatformMgrSingleton.GetConfig(p.Platform).PermitStartTs
|
startTs := PlatformMgrSingleton.GetConfig(p.Platform).PermitStartTs
|
||||||
endTs := PlatformMgrSingleton.GetConfig(p.Platform).PermitEndTs
|
endTs := PlatformMgrSingleton.GetConfig(p.Platform).PermitEndTs
|
||||||
if startTs == 0 || endTs == 0 {
|
now := time.Now()
|
||||||
|
if startTs == 0 || endTs == 0 || now.Unix() < startTs || now.Unix() >= endTs {
|
||||||
logger.Logger.Errorf("CSPermitAward not startTs %v", p.SnId)
|
logger.Logger.Errorf("CSPermitAward not startTs %v", p.SnId)
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
now := time.Now()
|
|
||||||
|
|
||||||
pack := &welfare.SCPermitAward{
|
pack := &welfare.SCPermitAward{
|
||||||
OpRetCode: welfare.OpResultCode_OPRC_Sucess,
|
OpRetCode: welfare.OpResultCode_OPRC_Sucess,
|
||||||
Tp: msg.GetTp(),
|
Tp: msg.GetTp(),
|
||||||
|
@ -777,8 +776,8 @@ func CSPermitAward(s *netlib.Session, packetid int, data interface{}, sid int64)
|
||||||
p.WelfData.PermitAward[v.GetRank()*1000] = now.Unix()
|
p.WelfData.PermitAward[v.GetRank()*1000] = now.Unix()
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if v.GetRank() == msg.GetId() {
|
if v.GetRank()*1000 == msg.GetId() {
|
||||||
if IsPermitCanReward(p, v.GetRank()*1000) {
|
if IsPermitCanReward(p, msg.GetId()) {
|
||||||
for _, vv := range v.GetAward2() {
|
for _, vv := range v.GetAward2() {
|
||||||
pack.Award2 = append(pack.Award2, &welfare.PropInfo{
|
pack.Award2 = append(pack.Award2, &welfare.PropInfo{
|
||||||
ItemId: vv.GetItemId(),
|
ItemId: vv.GetItemId(),
|
||||||
|
@ -978,13 +977,12 @@ func CSPermitExchange(s *netlib.Session, packetid int, data interface{}, sid int
|
||||||
}
|
}
|
||||||
startTs := PlatformMgrSingleton.GetConfig(p.Platform).PermitStartTs
|
startTs := PlatformMgrSingleton.GetConfig(p.Platform).PermitStartTs
|
||||||
endTs := PlatformMgrSingleton.GetConfig(p.Platform).PermitEndTs
|
endTs := PlatformMgrSingleton.GetConfig(p.Platform).PermitEndTs
|
||||||
if startTs == 0 || endTs == 0 {
|
now := time.Now()
|
||||||
|
if startTs == 0 || endTs == 0 || now.Unix() < startTs || now.Unix() >= endTs {
|
||||||
logger.Logger.Errorf("CSPermitExchange not startTs %v", p.SnId)
|
logger.Logger.Errorf("CSPermitExchange not startTs %v", p.SnId)
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
now := time.Now()
|
|
||||||
|
|
||||||
isExchange, code := GetPermitCanExchange(p, msg.GetId())
|
isExchange, code := GetPermitCanExchange(p, msg.GetId())
|
||||||
pack := &welfare.SCPermitExchange{
|
pack := &welfare.SCPermitExchange{
|
||||||
OpRetCode: welfare.OpResultCode_OPRC_Sucess,
|
OpRetCode: welfare.OpResultCode_OPRC_Sucess,
|
||||||
|
@ -1020,26 +1018,26 @@ func CSPermitExchange(s *netlib.Session, packetid int, data interface{}, sid int
|
||||||
// 检查背包是否足够
|
// 检查背包是否足够
|
||||||
var items []*Item
|
var items []*Item
|
||||||
var costItems []*Item
|
var costItems []*Item
|
||||||
for k, v := range exchangeConfig.GetCost() {
|
for _, v := range exchangeConfig.GetCost() {
|
||||||
item := BagMgrSingleton.GetItem(p.SnId, int32(k))
|
item := BagMgrSingleton.GetItem(p.SnId, v.GetItemId())
|
||||||
if item == nil || item.ItemNum < v.GetItemNum() {
|
if item == nil || item.ItemNum < v.GetItemNum() {
|
||||||
send(welfare.OpResultCode_OPRC_ErrCost)
|
send(welfare.OpResultCode_OPRC_ErrCost)
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
info := srvdata.PBDB_GameItemMgr.GetData(int32(k))
|
info := srvdata.PBDB_GameItemMgr.GetData(v.GetItemId())
|
||||||
if info != nil {
|
if info != nil {
|
||||||
costItems = append(costItems, &Item{
|
costItems = append(costItems, &Item{
|
||||||
ItemId: int32(k),
|
ItemId: v.GetItemId(),
|
||||||
ItemNum: v.GetItemNum(),
|
ItemNum: v.GetItemNum(),
|
||||||
Name: info.Name,
|
Name: info.Name,
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
for k, v := range exchangeConfig.GetGain() {
|
for _, v := range exchangeConfig.GetGain() {
|
||||||
info := srvdata.PBDB_GameItemMgr.GetData(int32(k))
|
info := srvdata.PBDB_GameItemMgr.GetData(v.GetItemId())
|
||||||
if info != nil {
|
if info != nil {
|
||||||
items = append(items, &Item{
|
items = append(items, &Item{
|
||||||
ItemId: int32(k),
|
ItemId: v.GetItemId(),
|
||||||
ItemNum: v.GetItemNum(),
|
ItemNum: v.GetItemNum(),
|
||||||
Name: info.Name,
|
Name: info.Name,
|
||||||
})
|
})
|
||||||
|
@ -1055,11 +1053,7 @@ func CSPermitExchange(s *netlib.Session, packetid int, data interface{}, sid int
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if !isExchange {
|
send(welfare.OpResultCode_OPRC_Sucess)
|
||||||
pack.OpRetCode = welfare.OpResultCode_OPRC_Error
|
|
||||||
}
|
|
||||||
p.SendToClient(int(welfare.SPacketID_PACKET_SCPermitExchange), pack)
|
|
||||||
logger.Logger.Tracef("SCPermitExchange: %v", pack)
|
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -314,6 +314,9 @@ func (this *BagMgr) AddItems(p *Player, addItems []*Item, add int64, gainWay int
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if v == common.ItemIDLong {
|
||||||
|
p.SendDiffData()
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if code != bag.OpResultCode_OPRC_Sucess {
|
if code != bag.OpResultCode_OPRC_Sucess {
|
||||||
|
|
211
worldsrv/etcd.go
211
worldsrv/etcd.go
|
@ -207,6 +207,112 @@ func platformConfigEvent(ctx context.Context, completeKey string, isInit bool, e
|
||||||
case *webapi.ActInviteConfig:
|
case *webapi.ActInviteConfig:
|
||||||
PlatformMgrSingleton.GetConfig(config.Platform).ActInviteConfig = config
|
PlatformMgrSingleton.GetConfig(config.Platform).ActInviteConfig = config
|
||||||
case *webapi.ActPermitConfig:
|
case *webapi.ActPermitConfig:
|
||||||
|
// test
|
||||||
|
actConfig := &webapi.ActPermitConfig{
|
||||||
|
Platform: "1",
|
||||||
|
StartTs: 1719646575,
|
||||||
|
Days: 7,
|
||||||
|
}
|
||||||
|
channelConfig := webapi.PermitChannelConfig{
|
||||||
|
Channel: "Official",
|
||||||
|
}
|
||||||
|
for i := 0; i < 100; i++ {
|
||||||
|
channelConfig.LevelConfig = append(channelConfig.LevelConfig, &webapi.PermitLevelConfig{
|
||||||
|
Rank: int32(i + 1),
|
||||||
|
Score: int64((i + 1) * 100),
|
||||||
|
Award1: []*webapi.ItemInfo{
|
||||||
|
{
|
||||||
|
ItemId: common.ItemIDCoin,
|
||||||
|
ItemNum: 100,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
Award2: []*webapi.ItemInfo{
|
||||||
|
{
|
||||||
|
ItemId: common.ItemIDLong,
|
||||||
|
ItemNum: 100,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
ItemId: common.ItemIDDiamond,
|
||||||
|
ItemNum: 100,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
})
|
||||||
|
}
|
||||||
|
itemId := []int32{100001, 100002, 10001, 20001, 20002, 20003}
|
||||||
|
for i := 0; i < 10; i++ {
|
||||||
|
level := 0
|
||||||
|
if common.RandInt(0, 3) == 0 {
|
||||||
|
level = common.RandInt(1, 101)
|
||||||
|
}
|
||||||
|
channelConfig.ExchangeConfig = append(channelConfig.ExchangeConfig, &webapi.PermitExchangeConfig{
|
||||||
|
Id: int32(i + 1),
|
||||||
|
SortId: int32(100 - i),
|
||||||
|
Gain: []*webapi.ItemInfo{
|
||||||
|
{
|
||||||
|
ItemId: itemId[common.RandInt(len(itemId))],
|
||||||
|
ItemNum: 1,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
Cost: []*webapi.ItemInfo{{
|
||||||
|
ItemId: common.ItemIDLong,
|
||||||
|
ItemNum: int64(common.RandInt(50, 101)),
|
||||||
|
}},
|
||||||
|
IsPermit: common.RandInt(0, 3) == 0,
|
||||||
|
Level: int64(level),
|
||||||
|
Times: int64(common.RandInt(0, 5)),
|
||||||
|
IsShow: common.RandInt(0, 4) != 0,
|
||||||
|
})
|
||||||
|
}
|
||||||
|
rankN := 1
|
||||||
|
for i := 0; i < 3; i++ {
|
||||||
|
sub := common.RandInt(0, 3)
|
||||||
|
items := []*webapi.ItemInfo{
|
||||||
|
{
|
||||||
|
ItemId: common.ItemIDCoin,
|
||||||
|
ItemNum: 100,
|
||||||
|
},
|
||||||
|
}
|
||||||
|
if common.RandInt(2) == 0 {
|
||||||
|
items = append(items, &webapi.ItemInfo{
|
||||||
|
ItemId: common.ItemIDDiamond,
|
||||||
|
ItemNum: 100,
|
||||||
|
})
|
||||||
|
}
|
||||||
|
channelConfig.RankConfig = append(channelConfig.RankConfig, &webapi.PermitRankConfig{
|
||||||
|
Start: int32(rankN),
|
||||||
|
End: int32(rankN + sub),
|
||||||
|
ItemId: items,
|
||||||
|
})
|
||||||
|
rankN = rankN + sub + 1
|
||||||
|
}
|
||||||
|
|
||||||
|
actConfig.Configs = append(actConfig.Configs, &channelConfig)
|
||||||
|
webConfig := channelConfig
|
||||||
|
webConfig.Channel = "Web"
|
||||||
|
actConfig.Configs = append(actConfig.Configs, &webConfig)
|
||||||
|
googleConfig := channelConfig
|
||||||
|
googleConfig.Channel = "GooglePlay"
|
||||||
|
actConfig.Configs = append(actConfig.Configs, &googleConfig)
|
||||||
|
PlatformMgrSingleton.GetConfig("1").ActPermitConfig = actConfig
|
||||||
|
PlatformMgrSingleton.GetConfig("1").PermitStartTs = common.GetDayStartTs(1719646575)
|
||||||
|
PlatformMgrSingleton.GetConfig("1").PermitEndTs = common.GetDayStartTs(1719646575) + int64(actConfig.GetDays()*24*3600)
|
||||||
|
task.New(nil, task.CallableWrapper(func(o *basic.Object) interface{} {
|
||||||
|
b, err := json.Marshal(&model.PermitStartTs{
|
||||||
|
StartTs: common.GetDayStartTs(1719646575),
|
||||||
|
EndTs: common.GetDayStartTs(1719646575) + int64(actConfig.GetDays()*24*3600),
|
||||||
|
})
|
||||||
|
if err != nil {
|
||||||
|
logger.Logger.Errorf("permit startts save error: %v", err)
|
||||||
|
} else {
|
||||||
|
err := model.UptStrKVGameData(common.PermitStartTsKey+"1", string(b))
|
||||||
|
if err != nil {
|
||||||
|
logger.Logger.Errorf("permit startts update error:%v", err)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return nil
|
||||||
|
}), nil).StartByExecutor("permit_start_ts")
|
||||||
|
logger.Logger.Tracef("==> PermitConfig: %v ", actConfig)
|
||||||
|
// test
|
||||||
break
|
break
|
||||||
PlatformMgrSingleton.GetConfig(config.Platform).ActPermitConfig = config
|
PlatformMgrSingleton.GetConfig(config.Platform).ActPermitConfig = config
|
||||||
st := new(model.PermitStartTs)
|
st := new(model.PermitStartTs)
|
||||||
|
@ -251,112 +357,7 @@ func platformConfigEvent(ctx context.Context, completeKey string, isInit bool, e
|
||||||
default:
|
default:
|
||||||
logger.Logger.Errorf("etcd completeKey:%s, Not processed", completeKey)
|
logger.Logger.Errorf("etcd completeKey:%s, Not processed", completeKey)
|
||||||
}
|
}
|
||||||
// test
|
|
||||||
actConfig := &webapi.ActPermitConfig{
|
|
||||||
Platform: "1",
|
|
||||||
StartTs: 1719646575,
|
|
||||||
Days: 7,
|
|
||||||
}
|
|
||||||
channelConfig := webapi.PermitChannelConfig{
|
|
||||||
Channel: "Official",
|
|
||||||
}
|
|
||||||
for i := 0; i < 100; i++ {
|
|
||||||
channelConfig.LevelConfig = append(channelConfig.LevelConfig, &webapi.PermitLevelConfig{
|
|
||||||
Rank: int32(i + 1),
|
|
||||||
Score: int64((i + 1) * 100),
|
|
||||||
Award1: []*webapi.ItemInfo{
|
|
||||||
{
|
|
||||||
ItemId: common.ItemIDCoin,
|
|
||||||
ItemNum: 100,
|
|
||||||
},
|
|
||||||
},
|
|
||||||
Award2: []*webapi.ItemInfo{
|
|
||||||
{
|
|
||||||
ItemId: common.ItemIDLong,
|
|
||||||
ItemNum: 100,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
ItemId: common.ItemIDDiamond,
|
|
||||||
ItemNum: 100,
|
|
||||||
},
|
|
||||||
},
|
|
||||||
})
|
|
||||||
}
|
|
||||||
itemId := []int32{100001, 100002, 10001, 20001, 20002, 20003}
|
|
||||||
for i := 0; i < 10; i++ {
|
|
||||||
level := 0
|
|
||||||
if common.RandInt(0, 3) == 0 {
|
|
||||||
level = common.RandInt(1, 101)
|
|
||||||
}
|
|
||||||
channelConfig.ExchangeConfig = append(channelConfig.ExchangeConfig, &webapi.PermitExchangeConfig{
|
|
||||||
Id: int32(i + 1),
|
|
||||||
SortId: int32(100 - i),
|
|
||||||
Gain: []*webapi.ItemInfo{
|
|
||||||
{
|
|
||||||
ItemId: itemId[common.RandInt(len(itemId))],
|
|
||||||
ItemNum: 1,
|
|
||||||
},
|
|
||||||
},
|
|
||||||
Cost: []*webapi.ItemInfo{{
|
|
||||||
ItemId: common.ItemIDLong,
|
|
||||||
ItemNum: int64(common.RandInt(50, 101)),
|
|
||||||
}},
|
|
||||||
IsPermit: common.RandInt(0, 3) == 0,
|
|
||||||
Level: int64(level),
|
|
||||||
Times: int64(common.RandInt(0, 5)),
|
|
||||||
IsShow: common.RandInt(0, 4) != 0,
|
|
||||||
})
|
|
||||||
}
|
|
||||||
rankN := 1
|
|
||||||
for i := 0; i < 3; i++ {
|
|
||||||
sub := common.RandInt(0, 3)
|
|
||||||
items := []*webapi.ItemInfo{
|
|
||||||
{
|
|
||||||
ItemId: common.ItemIDCoin,
|
|
||||||
ItemNum: 100,
|
|
||||||
},
|
|
||||||
}
|
|
||||||
if common.RandInt(2) == 0 {
|
|
||||||
items = append(items, &webapi.ItemInfo{
|
|
||||||
ItemId: common.ItemIDDiamond,
|
|
||||||
ItemNum: 100,
|
|
||||||
})
|
|
||||||
}
|
|
||||||
channelConfig.RankConfig = append(channelConfig.RankConfig, &webapi.PermitRankConfig{
|
|
||||||
Start: int32(rankN),
|
|
||||||
End: int32(rankN + sub),
|
|
||||||
ItemId: items,
|
|
||||||
})
|
|
||||||
rankN = rankN + sub + 1
|
|
||||||
}
|
|
||||||
|
|
||||||
actConfig.Configs = append(actConfig.Configs, &channelConfig)
|
|
||||||
webConfig := channelConfig
|
|
||||||
webConfig.Channel = "Web"
|
|
||||||
actConfig.Configs = append(actConfig.Configs, &webConfig)
|
|
||||||
googleConfig := channelConfig
|
|
||||||
googleConfig.Channel = "GooglePlay"
|
|
||||||
actConfig.Configs = append(actConfig.Configs, &googleConfig)
|
|
||||||
PlatformMgrSingleton.GetConfig("1").ActPermitConfig = actConfig
|
|
||||||
PlatformMgrSingleton.GetConfig("1").PermitStartTs = common.GetDayStartTs(1719646575)
|
|
||||||
PlatformMgrSingleton.GetConfig("1").PermitEndTs = common.GetDayStartTs(1719646575) + int64(actConfig.GetDays()*24*3600)
|
|
||||||
task.New(nil, task.CallableWrapper(func(o *basic.Object) interface{} {
|
|
||||||
b, err := json.Marshal(&model.PermitStartTs{
|
|
||||||
StartTs: common.GetDayStartTs(1719646575),
|
|
||||||
EndTs: common.GetDayStartTs(1719646575) + int64(actConfig.GetDays()*24*3600),
|
|
||||||
})
|
|
||||||
if err != nil {
|
|
||||||
logger.Logger.Errorf("permit startts save error: %v", err)
|
|
||||||
} else {
|
|
||||||
err := model.UptStrKVGameData(common.PermitStartTsKey+"1", string(b))
|
|
||||||
if err != nil {
|
|
||||||
logger.Logger.Errorf("permit startts update error:%v", err)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return nil
|
|
||||||
}), nil).StartByExecutor("permit_start_ts")
|
|
||||||
logger.Logger.Tracef("==> PermitConfig: %v ", actConfig)
|
|
||||||
// test
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func handlerEvent(ctx context.Context, completeKey string, isInit bool, event *clientv3.Event, data interface{}) {
|
func handlerEvent(ctx context.Context, completeKey string, isInit bool, event *clientv3.Event, data interface{}) {
|
||||||
|
|
|
@ -27,11 +27,12 @@ func (r *PermitMgr) OnDayTimer() {
|
||||||
logger.Logger.Info("(this *PermitMgr) OnDayTimer")
|
logger.Logger.Info("(this *PermitMgr) OnDayTimer")
|
||||||
now := time.Now()
|
now := time.Now()
|
||||||
for _, v := range PlatformMgrSingleton.GetPlatforms() {
|
for _, v := range PlatformMgrSingleton.GetPlatforms() {
|
||||||
pl := PlatformMgrSingleton.GetConfig(v.IdStr).ActPermitConfig
|
platform := v.IdStr
|
||||||
|
pl := PlatformMgrSingleton.GetConfig(platform).ActPermitConfig
|
||||||
if pl == nil {
|
if pl == nil {
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
b := model.GetStrKVGameData(common.PermitStartTsKey + v.IdStr)
|
b := model.GetStrKVGameData(common.PermitStartTsKey + platform)
|
||||||
if b == "" {
|
if b == "" {
|
||||||
logger.Logger.Errorf("(this *PermitMgr) OnDayTimer GetStrKVGameData not found")
|
logger.Logger.Errorf("(this *PermitMgr) OnDayTimer GetStrKVGameData not found")
|
||||||
continue
|
continue
|
||||||
|
@ -41,6 +42,7 @@ func (r *PermitMgr) OnDayTimer() {
|
||||||
logger.Logger.Errorf("(this *PermitMgr) OnDayTimer json.Unmarshal err:%v", err)
|
logger.Logger.Errorf("(this *PermitMgr) OnDayTimer json.Unmarshal err:%v", err)
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
|
logger.Logger.Tracef("(this *PermitMgr) OnDayTimer se:%+v now:%v", *se, now)
|
||||||
if se.StartTs <= now.Unix() && now.Unix() < se.EndTs {
|
if se.StartTs <= now.Unix() && now.Unix() < se.EndTs {
|
||||||
// 在活动内
|
// 在活动内
|
||||||
continue
|
continue
|
||||||
|
@ -57,18 +59,18 @@ func (r *PermitMgr) OnDayTimer() {
|
||||||
var players []*model.PlayerBaseInfo
|
var players []*model.PlayerBaseInfo
|
||||||
task.New(nil, task.CallableWrapper(func(o *basic.Object) interface{} {
|
task.New(nil, task.CallableWrapper(func(o *basic.Object) interface{} {
|
||||||
list, err = model.FindPlayerPermitList(&model.FindPlayerPermitListArgs{
|
list, err = model.FindPlayerPermitList(&model.FindPlayerPermitListArgs{
|
||||||
Platform: v.IdStr,
|
Platform: platform,
|
||||||
StartTs: startTs,
|
StartTs: startTs,
|
||||||
})
|
})
|
||||||
for _, vv := range list.List {
|
for _, vv := range list.List {
|
||||||
player := PlayerMgrSington.GetPlayerBySnId(vv.SnId)
|
player := PlayerMgrSington.GetPlayerBySnId(vv.SnId)
|
||||||
if player != nil {
|
if player != nil {
|
||||||
players = append(players, &model.PlayerBaseInfo{
|
players = append(players, &model.PlayerBaseInfo{
|
||||||
SnId: 0,
|
SnId: player.SnId,
|
||||||
LastChannel: player.LastChannel,
|
LastChannel: player.LastChannel,
|
||||||
})
|
})
|
||||||
} else {
|
} else {
|
||||||
baseInfo := model.GetPlayerBaseInfo(v.IdStr, vv.SnId)
|
baseInfo := model.GetPlayerBaseInfo(platform, vv.SnId)
|
||||||
players = append(players, baseInfo)
|
players = append(players, baseInfo)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -83,8 +85,9 @@ func (r *PermitMgr) OnDayTimer() {
|
||||||
logger.Logger.Errorf("PermitMgr OnDayTimer FindPlayerPermitList player is nil %v", list.List[k].SnId)
|
logger.Logger.Errorf("PermitMgr OnDayTimer FindPlayerPermitList player is nil %v", list.List[k].SnId)
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
|
curPlayer := player
|
||||||
// 发送奖励
|
// 发送奖励
|
||||||
cfg := PlatformMgrSingleton.GetPermitConfig(v.IdStr, player.LastChannel).GetRankConfig()
|
cfg := PlatformMgrSingleton.GetPermitConfig(platform, player.LastChannel).GetRankConfig()
|
||||||
rank := k + 1
|
rank := k + 1
|
||||||
for _, rankInfo := range cfg {
|
for _, rankInfo := range cfg {
|
||||||
var has bool
|
var has bool
|
||||||
|
@ -99,21 +102,22 @@ func (r *PermitMgr) OnDayTimer() {
|
||||||
if len(items) == 0 {
|
if len(items) == 0 {
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
|
logger.Logger.Infof("PermitMgr rank award snid:%v rank:%v", player.SnId, rank)
|
||||||
// 发邮件
|
// 发邮件
|
||||||
var newMsg *model.Message
|
var newMsg *model.Message
|
||||||
task.New(nil, task.CallableWrapper(func(o *basic.Object) interface{} {
|
task.New(nil, task.CallableWrapper(func(o *basic.Object) interface{} {
|
||||||
title := i18n.Tr("languages", "PermitAwardTitle")
|
title := i18n.Tr("languages", "PermitAwardTitle")
|
||||||
content := i18n.Tr("languages", "PermitAward", []int{rank, rank, rank, rank})
|
content := i18n.Tr("languages", "PermitAward", []int{rank, rank, rank, rank})
|
||||||
newMsg = model.NewMessage("", 0, "", player.SnId, model.MSGTYPE_RANK_REWARD,
|
newMsg = model.NewMessage("", 0, "", curPlayer.SnId, model.MSGTYPE_RANK_REWARD,
|
||||||
title, content, 0, 0, model.MSGSTATE_UNREAD, time.Now().Unix(), 0, "", items, v.IdStr, model.HallTienlen, nil)
|
title, content, 0, 0, model.MSGSTATE_UNREAD, time.Now().Unix(), 0, "", items, platform, model.HallTienlen, nil)
|
||||||
err := model.InsertMessage(v.IdStr, newMsg)
|
err := model.InsertMessage(platform, newMsg)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
logger.Logger.Errorf("发送邮件失败 snid:%v err:%v", player.SnId, err)
|
logger.Logger.Errorf("发送邮件失败 snid:%v err:%v", curPlayer.SnId, err)
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
return nil
|
return nil
|
||||||
}), task.CompleteNotifyWrapper(func(i interface{}, t task.Task) {
|
}), task.CompleteNotifyWrapper(func(i interface{}, t task.Task) {
|
||||||
p := PlayerMgrSington.GetPlayerBySnId(player.SnId)
|
p := PlayerMgrSington.GetPlayerBySnId(curPlayer.SnId)
|
||||||
if p != nil {
|
if p != nil {
|
||||||
p.AddMessage(newMsg)
|
p.AddMessage(newMsg)
|
||||||
}
|
}
|
||||||
|
@ -135,15 +139,15 @@ func (r *PermitMgr) OnDayTimer() {
|
||||||
se.StartTs = common.GetDayStartTs(now.Unix())
|
se.StartTs = common.GetDayStartTs(now.Unix())
|
||||||
se.EndTs = se.StartTs + int64(pl.Days*24*3600)
|
se.EndTs = se.StartTs + int64(pl.Days*24*3600)
|
||||||
}
|
}
|
||||||
PlatformMgrSingleton.GetConfig(v.IdStr).PermitStartTs = se.StartTs
|
PlatformMgrSingleton.GetConfig(platform).PermitStartTs = se.StartTs
|
||||||
PlatformMgrSingleton.GetConfig(v.IdStr).PermitEndTs = se.EndTs
|
PlatformMgrSingleton.GetConfig(platform).PermitEndTs = se.EndTs
|
||||||
b, err := json.Marshal(se)
|
b, err := json.Marshal(se)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
logger.Logger.Errorf("(this *PermitMgr) OnDayTimer json.Marshal err:%v", err)
|
logger.Logger.Errorf("(this *PermitMgr) OnDayTimer json.Marshal err:%v", err)
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
task.New(nil, task.CallableWrapper(func(o *basic.Object) interface{} {
|
task.New(nil, task.CallableWrapper(func(o *basic.Object) interface{} {
|
||||||
model.UptStrKVGameData(common.PermitStartTsKey+v.IdStr, string(b))
|
model.UptStrKVGameData(common.PermitStartTsKey+platform, string(b))
|
||||||
return nil
|
return nil
|
||||||
}), nil).StartByExecutor("permit_start_ts")
|
}), nil).StartByExecutor("permit_start_ts")
|
||||||
}
|
}
|
||||||
|
|
|
@ -60,6 +60,7 @@ const (
|
||||||
UpdateField_RankScore
|
UpdateField_RankScore
|
||||||
UpdateField_PhoneScore
|
UpdateField_PhoneScore
|
||||||
UpdateField_InviteScore
|
UpdateField_InviteScore
|
||||||
|
UpdateField_Long
|
||||||
)
|
)
|
||||||
|
|
||||||
const (
|
const (
|
||||||
|
@ -2269,6 +2270,10 @@ func (this *Player) ResetPermit() {
|
||||||
permitStartTs := PlatformMgrSingleton.GetConfig(this.Platform).PermitStartTs
|
permitStartTs := PlatformMgrSingleton.GetConfig(this.Platform).PermitStartTs
|
||||||
if (this.PermitStartTs == 0 || this.PermitStartTs < permitStartTs) && permitStartTs > 0 {
|
if (this.PermitStartTs == 0 || this.PermitStartTs < permitStartTs) && permitStartTs > 0 {
|
||||||
this.PermitStartTs = permitStartTs
|
this.PermitStartTs = permitStartTs
|
||||||
|
this.Permit = time.Time{}
|
||||||
|
this.WelfData.PermitAward = make(map[int32]int64)
|
||||||
|
this.WelfData.PermitExchange = make(map[int32][]int64)
|
||||||
|
this.dirty = true
|
||||||
// 清理数据
|
// 清理数据
|
||||||
bag := BagMgrSingleton.GetBagInfo(this.SnId)
|
bag := BagMgrSingleton.GetBagInfo(this.SnId)
|
||||||
if bag != nil {
|
if bag != nil {
|
||||||
|
@ -2281,13 +2286,10 @@ func (this *Player) ResetPermit() {
|
||||||
ItemNum: model.GameParamData.PermitInitScore,
|
ItemNum: model.GameParamData.PermitInitScore,
|
||||||
ObtainTime: time.Now().Unix(),
|
ObtainTime: time.Now().Unix(),
|
||||||
}
|
}
|
||||||
|
this.Permit = time.Now()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
this.Permit = time.Time{}
|
|
||||||
this.WelfData.PermitAward = make(map[int32]int64)
|
|
||||||
this.WelfData.PermitExchange = make(map[int32][]int64)
|
|
||||||
this.dirty = true
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2557,6 +2559,14 @@ func (this *Player) SendDiffData() {
|
||||||
if len(pack.RankScore) == 0 {
|
if len(pack.RankScore) == 0 {
|
||||||
pack.RankScore = nil
|
pack.RankScore = nil
|
||||||
}
|
}
|
||||||
|
// 龙币
|
||||||
|
itemLong := BagMgrSingleton.GetItem(this.SnId, common.ItemIDLong)
|
||||||
|
if itemLong != nil && this.diffData.Long != itemLong.ItemNum {
|
||||||
|
dirty = true
|
||||||
|
pack.Long = proto.Int64(itemLong.ItemNum)
|
||||||
|
this.diffData.Long = itemLong.ItemNum
|
||||||
|
pack.UpdateField += UpdateField_Long
|
||||||
|
}
|
||||||
|
|
||||||
if dirty {
|
if dirty {
|
||||||
FriendMgrSington.UpdateInfo(this.Platform, this.SnId)
|
FriendMgrSington.UpdateInfo(this.Platform, this.SnId)
|
||||||
|
@ -2996,10 +3006,12 @@ func (this *Player) SendPlayerInfo() {
|
||||||
scPlayerData.Data.ReliefFundTimes = this.WelfData.ReliefFundTimes
|
scPlayerData.Data.ReliefFundTimes = this.WelfData.ReliefFundTimes
|
||||||
}
|
}
|
||||||
if item := BagMgrSingleton.GetItem(this.SnId, VCard); item != nil {
|
if item := BagMgrSingleton.GetItem(this.SnId, VCard); item != nil {
|
||||||
scPlayerData.Data.VCoin = int64(item.ItemNum) //V卡
|
scPlayerData.Data.VCoin = item.ItemNum //V卡
|
||||||
|
}
|
||||||
|
// 龙币
|
||||||
|
if item := BagMgrSingleton.GetItem(this.SnId, common.ItemIDLong); item != nil {
|
||||||
|
scPlayerData.Data.Long = item.ItemNum
|
||||||
}
|
}
|
||||||
|
|
||||||
// 排位积分
|
// 排位积分
|
||||||
scPlayerData.Data.RankScore = RankMgrSingleton.GetPlayerRankScore(this.SnId)
|
scPlayerData.Data.RankScore = RankMgrSingleton.GetPlayerRankScore(this.SnId)
|
||||||
|
|
||||||
|
|
Binary file not shown.
Loading…
Reference in New Issue