Merge remote-tracking branch 'origin/develop' into dev_slots

This commit is contained in:
tomas 2024-10-17 17:05:53 +08:00
commit ce931c98b6
34 changed files with 3493 additions and 2819 deletions

View File

@ -1,22 +1,128 @@
stages:
- lock
- build
- deploy
- save
- sync
- unlock
variables:
GIT_DEPTH: 0
ProjectPath: "mongo.games.com/game"
default:
tags:
- game-develop
- gitlab
# 锁定作业,防止并发流水线执行
lock_job:
stage: lock
script:
- |
if [ -f /tmp/ci_lock ]; then
echo "流水线已在运行,等待..."
exit 1
else
touch /tmp/ci_lock
echo "获得锁定,开始流水线。"
fi
build-job:
stage: build
only:
- develop
- release
script:
- echo "Compiling the code..."
- echo "Compile complete."
- git checkout $CI_COMMIT_REF_NAME
- git pull origin $CI_COMMIT_REF_NAME
# 拷贝到GOPATH
- echo '拷贝到GOPATH'
- cp -rfp ./* $GOPATH/src/$ProjectPath
# 进入项目目录
- cd $GOPATH/src/$ProjectPath
# 编译
- echo '编译'
- go env -w GO111MODULE=off
- |
while IFS= read -r line
do
cd $line
echo "编译 $line"
go build -v
cd ..
done < shell/programs.txt
deploy-job:
stage: deploy
save-job:
stage: save
only:
- develop
- release
script:
- echo "Deploying application..."
- echo "Application successfully deployed."
- cd $GOPATH/src/$ProjectPath
# 拷贝文件
- echo '拷贝文件'
- rm -rf ./temp
- mkdir ./temp
- mkdir ./temp/data
- cp -rfp ./data/* ./temp/data
# 删除自定义配置
- echo '删除自定义配置'
- |
while IFS= read -r line
do
echo "删除 $line 配置"
rm ./temp/data/$line
done < ./shell/exclude.txt
# 拷贝可执行程序
- echo '拷贝可执行程序'
- |
while IFS= read -r line
do
echo "拷贝 $line"
mv ./$line/$line ./temp/$line
done < ./shell/programs.txt
sync_job:
stage: sync
only:
- develop
- release
script:
- cd $GOPATH/src/$ProjectPath
- if [ "$CI_COMMIT_BRANCH" == "develop" ]; then
SSH_PRIVATE_KEY="$SSH_PRIVATE_KEY_DEVELOP";
REMOTE_HOST="$REMOTE_HOST_DEVELOP";
REMOTE_USER="$REMOTE_USER_DEVELOP";
SERVER_CI_TOKEN="$REMOTE_CI_TOKEN_DEVELOP";
ServerName="develop";
elif [ "$CI_COMMIT_BRANCH" == "release" ]; then
SSH_PRIVATE_KEY="$SSH_PRIVATE_KEY_BETA";
REMOTE_HOST="$REMOTE_HOST_BETA";
REMOTE_USER="$REMOTE_USER_BETA";
SERVER_CI_TOKEN="$REMOTE_CI_TOKEN_BETA";
ServerName="beta";
else
echo "不支持的分支";
exit 1;
fi
# 设置 .ssh 目录并写入 SSH 私钥
- echo "设置 SSH keys..."
- mkdir -p ~/.ssh
- echo "$SSH_PRIVATE_KEY" | tr -d '\r' > ~/.ssh/id_rsa
- chmod 600 ~/.ssh/id_rsa
- ssh-keyscan -H "$REMOTE_HOST" >> ~/.ssh/known_hosts
# 使用 rsync 将文件同步到远程服务器
- echo "同步到服务器"
- echo "Deploying to remote server using rsync..."
- rsync -avz --delete ./temp/ $REMOTE_USER@$REMOTE_HOST:$REMOTE_DEPLOY_PATH
# 触发部署
- "curl -X POST --fail -F token=$SERVER_CI_TOKEN -F ref=release -F variables[ServerName]=$ServerName https://git.pogorockgames.com/api/v4/projects/31/trigger/pipeline"
# 解锁作业,释放锁定
unlock_job:
stage: unlock
script:
- rm -f /tmp/ci_lock
- echo "释放锁定,流水线结束。"
when: always

View File

@ -320,6 +320,7 @@ const (
GainWayClawdollCatch = 112 // 娃娃机抓取到娃娃获取卡
GainWayItemBagChangeDollRevocation = 113 //娃娃兑换后台撤销
GainWayPermitReset = 114 //赛季通行证积分重置
GainWayClientUpgrade = 115 //客户端升级奖励
)
// 后台选择 金币变化类型 的充值 类型id号起始

View File

@ -52,7 +52,11 @@ func InsertAnnouncerLog(logs ...*model.AnnouncerLog) (err error) {
// 取最新100条数据
func FetchAnnouncerLog(plt string) (recs []model.AnnouncerLog, err error) {
query := bson.M{}
err = AnnouncerLogCollection(plt).Find(query).Sort("-_id").Limit(100).All(&recs)
c := AnnouncerLogCollection(plt)
if c == nil {
return recs, AnnouncerLogDBErr
}
err = c.Find(query).Sort("-_id").Limit(100).All(&recs)
return
}

View File

@ -26,7 +26,11 @@ func AwardLogCollection(plt string) *mongo.Collection {
}
func FetchAwardLog(plt string) (recs model.AwardLog, err error) {
err = AwardLogCollection(plt).Find(bson.M{}).One(&recs)
c := AwardLogCollection(plt)
if c == nil {
return recs, AwardLogDBErr
}
err = c.Find(bson.M{}).One(&recs)
return
}

View File

@ -30,20 +30,21 @@ const (
ETCDKEY_PLAYERPOOL = "/game/plt/playerpool/" // 个人水池调控配置
ETCDKEY_GAME_CONFIG = "/game/plt/gameconfig/" // 游戏管理/全局配置
ETCDKEY_ACT_PHONELOTTERY = "/game/act_phoneLottery"
ETCDKEY_ChannelSwitch = "/game/channel/switch" // 渠道开关
ETCDKEY_ACT_Invite = "/game/act_invite" // 邀请活动配置
ETCDKEY_ACT_Permit = "/game/act_permit" // 赛季通行证配置
ETCDKEY_DIAMOND_LOTTERY = "/game/diamond_lottery" // 钻石抽奖配置
ETCDKEY_Item = "/game/item" // 道具列表
ETCDKEY_SKin = "/game/skin_config" // 皮肤配置
ETCDKEY_RANK_TYPE = "/game/RankType" // 排行榜奖励配置
ETCDKEY_AWARD_CONFIG = "/game/awardlog_config" //获奖记录
ETCDKEY_GUIDE = "/game/guide_config" //新手引导配置
ETCDKEY_MACHINE = "/game/machine_config" //娃娃机配置
ETCDKEY_MatchAudience = "/game/match_audience" //比赛观众
ETCDKEY_Spirit = "/game/spirit" // 小精灵配置
ETCDKEY_RoomType = "/game/room_type" // 房间类型配置
ETCDKEY_RoomConfig = "/game/room_config" // 房间配置
ETCDKEY_RoomConfigSystem = "/game/room_system" // 系统房间配置
ETCDKEY_ClientUpgrade = "/game/client_upgrade" // 客户端升级奖励配置
ETCDKEY_ChannelSwitch = "/game/channel/switch" // 渠道开关
ETCDKEY_ACT_Invite = "/game/act_invite" // 邀请活动配置
ETCDKEY_ACT_Permit = "/game/act_permit" // 赛季通行证配置
ETCDKEY_DIAMOND_LOTTERY = "/game/diamond_lottery" // 钻石抽奖配置
ETCDKEY_Item = "/game/item" // 道具列表
ETCDKEY_SKin = "/game/skin_config" // 皮肤配置
ETCDKEY_RANK_TYPE = "/game/RankType" // 排行榜奖励配置
ETCDKEY_AWARD_CONFIG = "/game/awardlog_config" //获奖记录
ETCDKEY_GUIDE = "/game/guide_config" //新手引导配置
ETCDKEY_MACHINE = "/game/machine_config" //娃娃机配置
ETCDKEY_MatchAudience = "/game/match_audience" //比赛观众
ETCDKEY_Spirit = "/game/spirit" // 小精灵配置
ETCDKEY_RoomType = "/game/room_type" // 房间类型配置
ETCDKEY_RoomConfig = "/game/room_config" // 房间配置
ETCDKEY_RoomConfigSystem = "/game/room_system" // 系统房间配置
ETCDKEY_ClientUpgrade = "/game/client_upgrade" // 客户端升级奖励配置
ETCDKEY_PopUpWindow = "/game/PopUpWindowConfig" //弹窗配置
)

View File

@ -631,7 +631,7 @@ func GetPressCards(cards, lastCards []int32, data *tienlenApi.PredictRequest, po
})
isWin := data.IsWin
//测试代码
//isWin = false
isWin = true
logger.Logger.Trace("压牌 调控输赢 isWin = ", isWin)
outCards := []int32{}
//压牌测试代码
@ -1734,7 +1734,7 @@ func GetOutCards(cards []int32, data *tienlenApi.PredictRequest, pos int32) []in
})
isWin := data.IsWin
//测试代码
//isWin = false
isWin = true
logger.Logger.Trace("出牌 调控输赢 isWin = ", isWin)
//测试代码
//cards = []int32{51, 4, 5}

View File

@ -512,7 +512,7 @@ func ZegoRTCStreamAction(Action string, machineInfo *webapi.MachineInfo) rule.Ze
timestamp := time.Now().Unix()
queryParams := url.Values{}
queryParams.Set("StreamId", "test")
queryParams.Set("StreamId", machineInfo.StreamId)
queryParams.Set("Sequence", fmt.Sprintf("%d", timestamp))
// 生成16进制随机字符串(16位)

View File

@ -409,6 +409,9 @@ func (this *TienLenSceneData) BroadcastOpPos() {
if B < 0 {
isWin = false
}
if this.WGCreateScene.GetCloseCtrl() {
isWin = true
}
isTienLenYule := this.IsTienLenYule()
pack := &tienlen.SCTienLenAIData{
BombNum: 0, //炸弹数量
@ -554,10 +557,12 @@ func (this *TienLenSceneData) GetFreeGameSceneType() int32 {
return this.GetSceneType()
}
// SendHandCard_Match 发牌
// 比赛场发牌
// 纯真人,随机发牌
// 有机器人和真人,真人拿好牌
func (this *TienLenSceneData) SendHandCard_Match() {
// mustRandom 必须随机发牌
func (this *TienLenSceneData) SendHandCard_Match(mustRandom bool) {
this.poker.Shuffle()
buf := this.poker.GetPokerBuf()
cardss := map[int][]int32{}
@ -579,7 +584,7 @@ func (this *TienLenSceneData) SendHandCard_Match() {
}
}
}
if len(realPlayers) > 0 && len(robotPlayers) > 0 {
if !mustRandom && len(realPlayers) > 0 && len(robotPlayers) > 0 {
type gradeInfo struct {
id int
grade int

View File

@ -991,14 +991,17 @@ func (this *SceneHandCardStateTienLen) OnEnter(s *base.Scene) {
if rule.TestOpen {
sceneEx.SendHandCardTest()
} else {
if len(sceneEx.testPokers) > 1 {
sceneEx.SendHandCardOdds()
} else {
if sceneEx.IsMatchScene() || sceneEx.IsCustom() {
sceneEx.SendHandCard_Match()
if sceneEx.WGCreateScene.GetCloseCtrl() {
sceneEx.SendHandCard_Match(true)
} else {
sceneEx.SendHandCardOdds()
if sceneEx.IsMatchScene() || sceneEx.IsCustom() {
sceneEx.SendHandCard_Match(false)
} else {
sceneEx.SendHandCardOdds()
}
}
}
}

View File

@ -173,6 +173,9 @@ func SMDollMachineGrabHandler(session *netlib.Session, packetId int, data interf
// 监听抓取结果返回
func DollMachineGrabResult(conn *machinedoll.Conn, snid, id int32) {
if conn == nil {
return
}
num := int64(1)
for {
// 读取数据
@ -183,6 +186,7 @@ func DollMachineGrabResult(conn *machinedoll.Conn, snid, id int32) {
logger.Logger.Error("Failed to read response from client:", err)
err := conn.Conn.Close()
if err != nil {
logger.Logger.Error("conn.Conn.Close():", err)
return
}
return

View File

@ -151,7 +151,7 @@ func (this *MachineManager) UpdateToGameServer(conn *Conn, status int32) {
}
func SendToGameServer(pid int, msg interface{}) {
GameConn = srvlib.ServerSessionMgrSington.GetSession(1, 7, 777)
GameConn = srvlib.ServerSessionMgrSington.GetSession(1, 7, 706)
if GameConn != nil {
GameConn.Send(pid, msg)
} else {

View File

@ -155,6 +155,8 @@ type AllConfig struct {
RoomConfigSystem map[int32]*webapi.RoomConfigSystem
// 客户端升级奖励配置
*webapi.ClientUpgrade
//弹窗配置
*webapi.PopUpWindowConfig
}
type GlobalConfig struct {

View File

@ -39,6 +39,7 @@ const (
MSGTYPE_RANK_REWARD //排行榜奖励
MSGTYPE_ITEM_CHANGE //背包使用兑换
MSGTYPE_RANK_PermitReward // 通行证排行奖励
MSGTYPE_ClientUpgrade // 客户端升级
)
const (

View File

@ -2,7 +2,9 @@ package model
import (
"bytes"
"crypto/md5"
"encoding/gob"
"encoding/hex"
"encoding/json"
"errors"
"fmt"
@ -108,10 +110,12 @@ const (
SystemFreeGive_PhoneLotterySwap // 手机积分兑换奖励
SystemFreeGive_CollectBox // 开启卡片礼盒奖励
SystemFreeGive_CollectBoxSwap // 卡片礼盒兑换奖励
SystemFreeGive_ClientUpgrade // 客户端升级奖励
)
const (
SystemFreeGive_CoinType_Coin int32 = iota //金币
SystemFreeGive_CoinType_Diamond //钻石
SystemFreeGive_CoinType_Tiem // 道具
)
type PlayerGameCtrlData struct {
@ -907,7 +911,13 @@ func NewPlayerData(acc string, name, headUrl string, id int32, channel, platform
logger.Logger.Trace("New player name is empty.")
return nil
}
raw := fmt.Sprintf("%v%v", DEFAULT_PLAYER_SAFEBOX_PWD, common.GetAppId())
h := md5.New()
io.WriteString(h, raw)
pwd := hex.EncodeToString(h.Sum(nil))
tNow := time.Now()
isRobot := channel == common.Channel_Rob
pd := &PlayerData{
Id: bson.NewObjectId(),
AccountId: acc,
@ -918,6 +928,7 @@ func NewPlayerData(acc string, name, headUrl string, id int32, channel, platform
SnId: id,
Head: rand.Int31n(common.HeadRange),
HeadUrl: headUrl,
SafeBoxPassword: pwd,
Ip: ip,
RegIp: ip,
Params: params,
@ -927,7 +938,7 @@ func NewPlayerData(acc string, name, headUrl string, id int32, channel, platform
CreateTime: tNow.Local(),
Ver: VER_PLAYER_MAX - 1,
HeadOutLine: 1,
IsRob: false,
IsRob: isRobot,
PackageID: packTag,
YesterdayGameData: NewPlayerGameCtrlData(),
TodayGameData: NewPlayerGameCtrlData(),

View File

@ -20,6 +20,20 @@ func GenerateLogin(o *PlayerLoginEvent) *mq.RabbitMQData {
return NewRabbitMQData(mq.BackLogin, o)
}
type SystemFreeGive struct {
Snid int32 `json:"snid,omitempty"`
Channel string `json:"Channel,omitempty"`
AppChannel string `json:"AppChannel,omitempty"`
ChannelId string `json:"ChannelId,omitempty"`
Platform string `json:"platform,omitempty"`
Name string `json:"name,omitempty"`
GiveWay int32 `json:"givetype,omitempty"`
GiveType int32 `json:"cointype,omitempty"`
Count int64 `json:"count,omitempty"`
Ts int64 `json:"ts,omitempty"`
ItemId int32 `json:"itemid,omitempty"`
}
// GenerateSystemFreeGive 系统免费赠送
func GenerateSystemFreeGive(snid int32, name, platform, channel string, givetype, cointype int32, count int64) *mq.RabbitMQData {
params := make(map[string]string)

File diff suppressed because it is too large Load Diff

View File

@ -236,6 +236,8 @@ enum PlayerPacketID {
PACKET_SCClawdollItemLog = 2845;//
PACKET_CSDollConfig = 2846; //
PACKET_SCDollConfig = 2847; //
PACKET_CSPopUpWindowConfig = 2848; //
PACKET_SCPopUpWindowConfig = 2849; //
}
//
@ -1407,4 +1409,20 @@ message MachineInfo{
int32 ItemNum = 4;//
int32 MachineId = 5;
string Name = 6;
}
//
//PACKET_CSPopUpWindowConfig
message CSPopUpWindowConfig{
}
//
//PACKET_SCPopUpWindowConfig
message SCPopUpWindowConfig{
repeated PopUpWindowInfo Info = 1;
}
message PopUpWindowInfo{
int32 Id = 1;
string Name = 2;
string Key = 3;
int32 OpenStatus = 4;//1- 0-
int32 Weight = 5;//
}

File diff suppressed because it is too large Load Diff

View File

@ -205,6 +205,7 @@ message WGCreateScene {
MatchParam Match = 16; //
repeated int32 ChessRank = 26; //
repeated int64 Params = 27; // ,GameRule中定义,
bool CloseCtrl = 28; //
}
//PACKET_WG_DESTROYSCENE

File diff suppressed because it is too large Load Diff

View File

@ -109,6 +109,7 @@ message GameFree {
int32 GroupId = 1; // ID
bool Status = 2; //
server.DB_GameFree DbGameFree = 3; // excel导出结构
bool CloseCtrl = 4; //
}
//
@ -988,4 +989,17 @@ message ClientUpgrade{
int32 On = 2; // 1 2
int32 OnForce = 3; // 1 2
repeated ItemInfo Reward = 4; //
}
//etcd /game/PopUpWindowConfig
message PopUpWindowConfig{
string Platform = 1; //
repeated PopUpWindowInfo Info = 2;
}
message PopUpWindowInfo{
int32 Id = 1;
string Name = 2;
string Key = 3;
int32 OpenStatus = 4;//1- 2-
int32 Weight = 5;//
}

View File

@ -327,11 +327,11 @@ func CSShieldMsgHandler(s *netlib.Session, packetid int, data interface{}, sid i
func init() {
//聊天消息
common.Register(int(chat.ChatPacketID_PACKET_SCChatMsg), &chat.CSChatMsg{}, CSChatMsgHandler)
common.Register(int(chat.ChatPacketID_PACKET_CSChatMsg), &chat.CSChatMsg{}, CSChatMsgHandler)
//聊天记录
common.Register(int(chat.ChatPacketID_PACKET_CSGetChatLog), &chat.CSGetChatLog{}, CSGetChatLogHandler)
//读消息
common.Register(int(chat.ChatPacketID_PACKET_CSReadChatMsg), &chat.CSReadChatMsg{}, CSReadChatMsgHandler)
//屏蔽玩家
common.Register(int(chat.ChatPacketID_PACKET_SCShieldMsg), &chat.SCShieldMsg{}, CSShieldMsgHandler)
common.Register(int(chat.ChatPacketID_PACKET_CSShieldMsg), &chat.SCShieldMsg{}, CSShieldMsgHandler)
}

View File

@ -3273,6 +3273,32 @@ func CSCLAWDOLLConfig(s *netlib.Session, packetId int, data interface{}, sid int
}
return nil
}
// 客户端请求弹窗配置
func CSPopUpWindowConfig(s *netlib.Session, packetId int, data interface{}, sid int64) error {
p := PlayerMgrSington.GetPlayer(sid)
if p == nil {
return nil
}
config := PlatformMgrSingleton.GetConfig(p.Platform).PopUpWindowConfig
if config == nil {
return nil
}
pack := &player_proto.SCPopUpWindowConfig{}
for _, value := range config.Info {
info := &player_proto.PopUpWindowInfo{
Id: value.Id,
Name: value.Name,
Key: value.Key,
OpenStatus: value.OpenStatus,
Weight: value.Weight,
}
pack.Info = append(pack.Info, info)
}
p.SendToClient(int(player_proto.PlayerPacketID_PACKET_SCPopUpWindowConfig), pack)
return nil
}
func init() {
// 用户信息
common.Register(int(player_proto.PlayerPacketID_PACKET_CS_PLAYERDATA), player_proto.CSPlayerData{}, CSPlayerData)
@ -3310,4 +3336,6 @@ func init() {
common.Register(int(player_proto.PlayerPacketID_PACKET_CSClawdollItemLog), player_proto.CSClawdollItemLog{}, CSClawdollItemLog)
//客户端请求配置信息
common.Register(int(player_proto.PlayerPacketID_PACKET_CSDollConfig), player_proto.CSCLAWDOLLConfig{}, CSCLAWDOLLConfig)
//客户端请求弹窗配置信息
common.Register(int(player_proto.PlayerPacketID_PACKET_CSPopUpWindowConfig), player_proto.CSPopUpWindowConfig{}, CSPopUpWindowConfig)
}

View File

@ -236,7 +236,7 @@ func init() {
netlib.RegisterHandler(int(serverproto.SSPacketID_PACKET_GW_SCENESTART), netlib.HandlerWrapper(func(s *netlib.Session, packetid int, pack interface{}) error {
logger.Logger.Trace("receive SSPacketID_PACKET_GW_SCENESTART GWSceneStart:", pack)
if msg, ok := pack.(*serverproto.GWSceneStart); ok {
scene := SceneMgrSingleton.GetScene(int(msg.GetRoomId()))
scene := SceneMgrSingleton.GetScene(int(msg.GetRoomId()), true)
if scene != nil {
scene.starting = msg.GetStart()
scene.currRound = msg.GetCurrRound()
@ -264,7 +264,7 @@ func init() {
netlib.RegisterHandler(int(serverproto.SSPacketID_PACKET_GW_SCENESTATE), netlib.HandlerWrapper(func(s *netlib.Session, packetid int, pack interface{}) error {
logger.Logger.Trace("receive SSPacketID_PACKET_GW_SCENESTATE GWSceneState:", pack)
if msg, ok := pack.(*serverproto.GWSceneState); ok {
scene := SceneMgrSingleton.GetScene(int(msg.GetRoomId()))
scene := SceneMgrSingleton.GetScene(int(msg.GetRoomId()), true)
if scene != nil {
scene.sp.OnSceneState(scene, int(msg.GetRoomState()))
}
@ -339,7 +339,7 @@ func init() {
netlib.RegisterHandler(int(serverproto.SSPacketID_PACKET_GW_PLAYERFORCELEAVE), netlib.HandlerWrapper(func(s *netlib.Session, packetid int, pack interface{}) error {
if msg, ok := pack.(*serverproto.GWPlayerForceLeave); ok {
logger.Logger.Warn("receive GWPlayerForceLeave:", msg)
scene := SceneMgrSingleton.GetScene(int(msg.GetRoomId()))
scene := SceneMgrSingleton.GetScene(int(msg.GetRoomId()), true)
if scene != nil {
p := PlayerMgrSington.GetPlayerBySnId(msg.GetPlayerId())
if p != nil {
@ -384,7 +384,7 @@ func init() {
netlib.RegisterHandler(int(serverproto.SSPacketID_PACKET_GW_PLAYERDATA), netlib.HandlerWrapper(func(s *netlib.Session, packetid int, pack interface{}) error {
logger.Logger.Trace("receive GWPlayerBet:", pack)
if msg, ok := pack.(*serverproto.GWPlayerData); ok {
scene := SceneMgrSingleton.GetScene(int(msg.GetSceneId()))
scene := SceneMgrSingleton.GetScene(int(msg.GetSceneId()), true)
if scene == nil {
return nil
}

View File

@ -118,7 +118,7 @@ func AddMailClientUpgrade(snid int32, items []*webapi.ItemInfo) {
content := i18n.Tr("languages", "Upgrade")
AddMail(&AddMailParam{
Tp: model.MSGTYPE_ITEM,
Tp: model.MSGTYPE_ClientUpgrade,
SnId: snid,
Title: title,
Content: content,

View File

@ -175,7 +175,7 @@ func (m *CoinSceneMgr) PlayerLeave(p *Player, reason int) bool {
// 游戏服解散房间消息触发
// sceneId 房间id
func (m *CoinSceneMgr) OnDestroyScene(sceneId int) {
if s := SceneMgrSingleton.GetScene(sceneId); s != nil && s.csp != nil {
if s := SceneMgrSingleton.GetScene(sceneId, true); s != nil && s.csp != nil {
s.csp.onDestroyScene(sceneId)
}
}

View File

@ -102,6 +102,8 @@ func init() {
etcd.Register(etcd.ETCDKEY_MACHINE, webapi.MachineConfig{}, platformConfigEvent)
//客户端升级奖励配置
etcd.Register(etcd.ETCDKEY_ClientUpgrade, webapi.ClientUpgrade{}, platformConfigEvent)
//弹窗活动配置
etcd.Register(etcd.ETCDKEY_PopUpWindow, webapi.PopUpWindowConfig{}, platformConfigEvent)
}
func platformConfigEvent(ctx context.Context, completeKey string, isInit bool, event *clientv3.Event, data interface{}) {
@ -338,6 +340,8 @@ func platformConfigEvent(ctx context.Context, completeKey string, isInit bool, e
}
case *webapi.ClientUpgrade:
PlatformMgrSingleton.GetConfig(config.Platform).ClientUpgrade = config
case *webapi.PopUpWindowConfig:
PlatformMgrSingleton.GetConfig(config.Platform).PopUpWindowConfig = config
default:
logger.Logger.Errorf("etcd completeKey:%s, Not processed", completeKey)
}

View File

@ -163,6 +163,7 @@ func (this *GameSession) AddScene(args *AddSceneParam) {
Custom: args.S.CustomParam,
Match: args.S.MatchParam,
Params: args.S.params,
CloseCtrl: args.S.CloseCtrl,
}
if args.S.CustomParam.GetRoomConfigId() != 0 {
cfg := PlatformMgrSingleton.GetConfig(args.S.platform.IdStr).RoomConfig[args.S.CustomParam.GetRoomConfigId()]

View File

@ -111,7 +111,7 @@ func (this *HundredSceneMgr) PlayerTryLeave(p *Player) gamehallproto.OpResultCod
// OnDestroyScene 房间销毁
func (this *HundredSceneMgr) OnDestroyScene(sceneId int) {
s := SceneMgrSingleton.GetScene(sceneId)
s := SceneMgrSingleton.GetScene(sceneId, true)
if s == nil {
return
}
@ -416,7 +416,7 @@ func (this *HundredSceneMgr) OnPlatformDestroyByGameFreeId(p *Platform, gameFree
}
func init() {
module.RegisteModule(HundredSceneMgrSingleton, time.Second*5, 0)
module.RegisteModule(HundredSceneMgrSingleton, time.Hour, 0)
PlatformMgrSingleton.RegisterObserver(HundredSceneMgrSingleton)
PlatformGameGroupMgrSington.RegisteObserver(HundredSceneMgrSingleton)
}

View File

@ -31,6 +31,7 @@ func init() {
mq.RegisterMessage(&mq.RegisterMessageParam{Name: mq.BackClientLog, Data: &model.ClientLogMysql{}})
mq.RegisterMessage(&mq.RegisterMessageParam{Name: mq.BackSystemJyb, Data: &model.JybLog{}})
mq.RegisterMessage(&mq.RegisterMessageParam{Name: mq.DBVipGiftLog, Data: &model.DbVip{}})
mq.RegisterMessage(&mq.RegisterMessageParam{Name: mq.BackSystemFreeGive, Data: &model.SystemFreeGive{}})
}
func init() {

View File

@ -127,6 +127,7 @@ func (cfg *GameList) GetGameConfig(gameFreeId int32) *webapiproto.GameFree {
func CompareGameFreeConfigChanged(oldCfg, newCfg *webapiproto.GameFree) bool {
if oldCfg.Status != newCfg.Status ||
oldCfg.GroupId != newCfg.GroupId ||
oldCfg.GetCloseCtrl() != newCfg.GetCloseCtrl() ||
oldCfg.DbGameFree.GetBot() != newCfg.DbGameFree.GetBot() ||
oldCfg.DbGameFree.GetBaseScore() != newCfg.DbGameFree.GetBaseScore() ||
oldCfg.DbGameFree.GetLimitCoin() != newCfg.DbGameFree.GetLimitCoin() ||

View File

@ -1110,16 +1110,28 @@ func (this *Player) GetMessageAttach(id string) {
ItemNum: msg.Params[i+1], // 数量
ObtainTime: time.Now().Unix(),
})
if gainWay == common.GainWayItemPermitRank {
tp := int32(-1)
if msg.Params[i] == common.ItemIDCoin {
tp = model.SystemFreeGive_CoinType_Coin
} else if msg.Params[i] == common.ItemIDDiamond {
tp = model.SystemFreeGive_CoinType_Diamond
tp := int32(-1)
switch msg.Params[i] {
case common.ItemIDCoin:
tp = model.SystemFreeGive_CoinType_Coin
case common.ItemIDDiamond:
tp = model.SystemFreeGive_CoinType_Diamond
default:
tp = model.SystemFreeGive_CoinType_Tiem
}
if tp != -1 {
giveType := int32(-1)
switch gainWay {
case common.GainWayItemPermitRank:
giveType = model.SystemFreeGive_GiveType_TaskPermitRank
case common.GainWayClientUpgrade:
giveType = model.SystemFreeGive_ClientUpgrade
}
if tp != -1 {
if giveType != -1 && msg.Oper == 0 && !this.IsRob {
mq.Write(model.GenerateSystemFreeGive(this.SnId, this.Name, this.Platform, this.Channel,
model.SystemFreeGive_GiveType_TaskPermitRank, tp, msg.Params[i+1]))
giveType, tp, msg.Params[i+1]))
}
}
}
@ -1196,6 +1208,10 @@ func (this *Player) GetMessageAttach(id string) {
remark = "通行证排行奖励"
gainWay = common.GainWayItemPermitRank
addItem()
case model.MSGTYPE_ClientUpgrade:
remark = "客户端升级奖励"
gainWay = common.GainWayClientUpgrade
addItem()
}
if msg.Coin > 0 {
this.AddCoin(msg.Coin, 0, gainWay, msg.Id.Hex(), remark)

View File

@ -65,8 +65,10 @@ type Scene struct {
*serverproto.CustomParam // 房卡场参数
*serverproto.MatchParam // 比赛场参数
*webapiproto.RoomConfigSystem // 系统竞技馆房间
csp *CoinScenePool // 所在场景池
hp *HundredSceneMgr // 百人场房间池
CloseCtrl bool // 调控开关
csp *CoinScenePool // 所在场景池
hp *HundredSceneMgr // 百人场房间池
}
// NewScene 创建房间
@ -146,6 +148,10 @@ func NewScene(args *CreateSceneParam) *Scene {
if s.RoomConfigSystem == nil {
s.RoomConfigSystem = new(webapiproto.RoomConfigSystem)
}
gf := PlatformMgrSingleton.GetGameFree(args.Platform.IdStr, args.GF.GetId())
if gf != nil {
s.CloseCtrl = gf.GetCloseCtrl()
}
return s
}

View File

@ -94,7 +94,7 @@ func (m *SceneMgr) GenPassword() string {
}
func (m *SceneMgr) GetPlatformBySceneId(sceneId int) string {
s := m.GetScene(sceneId)
s := m.GetScene(sceneId, true)
if s != nil && s.platform != nil {
return s.platform.IdStr
}