From 182d4e9612363e20d0bd09dce79a2182cd6c74b5 Mon Sep 17 00:00:00 2001 From: sk <123456@qq.com> Date: Wed, 3 Jul 2024 18:49:48 +0800 Subject: [PATCH] =?UTF-8?q?=E8=B5=9B=E5=AD=A3=E9=80=9A=E8=A1=8C=E8=AF=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- worldsrv/action_task.go | 5 +- worldsrv/etcd.go | 112 ---------------------------------------- 2 files changed, 4 insertions(+), 113 deletions(-) diff --git a/worldsrv/action_task.go b/worldsrv/action_task.go index 93242b5..30fa879 100644 --- a/worldsrv/action_task.go +++ b/worldsrv/action_task.go @@ -177,7 +177,7 @@ func CSTaskReward(s *netlib.Session, packetId int, data interface{}, sid int64) Id: msg.GetId(), Reward: make(map[int64]int64), } - + isPermit := p.GetIsPermit() f := func(id int32) { if IsTaskFinish(p, id) && !IsTaskReward(p, id) { p.WelfData.Task[id].Ts = time.Now().Unix() @@ -185,6 +185,9 @@ func CSTaskReward(s *netlib.Session, packetId int, data interface{}, sid int64) if data != nil { SendReward(p, data.Award, msg.Tp) for k, vv := range data.GetAward() { + if k == common.ItemIDPermit && isPermit { + vv += vv / 2 // 增加50% + } ret.Reward[k] = ret.Reward[k] + vv } } diff --git a/worldsrv/etcd.go b/worldsrv/etcd.go index 01bc2ff..4490274 100644 --- a/worldsrv/etcd.go +++ b/worldsrv/etcd.go @@ -207,118 +207,6 @@ func platformConfigEvent(ctx context.Context, completeKey string, isInit bool, e case *webapi.ActInviteConfig: PlatformMgrSingleton.GetConfig(config.Platform).ActInviteConfig = config 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) - } - LogChannelSingleton.WriteLog(&model.BackendPermitCycle{ - Platform: config.Platform, - StartTs: common.GetDayStartTs(1719646575), - EndTs: common.GetDayStartTs(1719646575) + int64(actConfig.GetDays()*24*3600), - }) - } - return nil - }), nil).StartByExecutor("permit_start_ts") - logger.Logger.Tracef("==> PermitConfig: %v ", actConfig) - // test - break PlatformMgrSingleton.GetConfig(config.Platform).ActPermitConfig = config st := new(model.PermitStartTs) permit := model.GetStrKVGameData(common.PermitStartTsKey + config.Platform)