兑换商城地址

This commit is contained in:
sk 2024-11-12 15:08:16 +08:00
parent 4da947cd56
commit 90e11a0dad
5 changed files with 624 additions and 421 deletions

View File

@ -92,6 +92,7 @@ type GameParam struct {
CloseCustomRoomCreate bool // 关闭自定义房间创建
ClientVersion int32 // 客户端版本号
ClientVersionChannel []string // 客户端版本号包渠道
SwapShopUrl string // 交换商城地址
}
var GameParamPath = "../data/gameparam.json"
@ -237,4 +238,7 @@ func InitGameParam() {
if GameParamData.AdminPassword == "" {
GameParamData.AdminPassword = "fjslowopcserg"
}
if GameParamData.SwapShopUrl == "" {
GameParamData.SwapShopUrl = "https://user.hinasakimiu.com/login"
}
}

File diff suppressed because it is too large Load Diff

View File

@ -240,6 +240,8 @@ enum PlayerPacketID {
PACKET_SCPopUpWindowConfig = 2849; //
PACKET_CSUpdateGuide = 2850; //
PACKET_SCUpdateGuide = 2851; //
PACKET_CSGetSwapShopInfo = 2852; //
PACKET_SCGetSwapShopInfo = 2853; //
}
//
@ -1439,4 +1441,13 @@ message PopUpWindowInfo{
string Key = 3;
int32 OpenStatus = 4;//1- 0-
int32 Weight = 5;//
}
//
// PACKET_CSGetSwapShopInfo
message CSGetSwapShopInfo{
}
// PACKET_SCGetSwapShopInfo
message SCGetSwapShopInfo{
string Url = 1;
}

View File

@ -15,6 +15,7 @@ import (
"mongo.games.com/game/model"
"mongo.games.com/game/proto"
"mongo.games.com/game/protocol/friend"
"mongo.games.com/game/protocol/welfare"
"mongo.games.com/game/srvdata"
)
@ -601,6 +602,30 @@ func (this *CSFuzzyQueryPlayerHandler) Process(s *netlib.Session, packetid int,
logger.Logger.Warn("CSFuzzyQueryPlayerHandler p == nil")
return nil
}
pack2 := &welfare.NotifyLotteryAward{
Info: &welfare.LotteryInfo{
Id: 45,
StartTs: time.Now().Unix(),
Index: int32(5),
Award: []*welfare.PropInfo{
{
ItemId: 100001,
ItemNum: 100,
},
},
SnId: p.SnId,
Name: p.Name,
RoleId: p.Roles.ModId,
Price: 1000,
WinCode: "123456",
},
}
// 广播中奖结果
PlayerMgrSington.BroadcastMessageToPlatform(p.Platform, int(welfare.SPacketID_PACKET_NotifyLotteryAward), pack2)
logger.Logger.Tracef("广播中奖信息: %v", pack2)
queryContent := msg.GetQueryContent()
if utf8.RuneCountInString(queryContent) < 3 {
return nil

View File

@ -16,6 +16,7 @@ import (
"time"
"unicode/utf8"
"github.com/golang-jwt/jwt/v4"
"mongo.games.com/goserver/core/basic"
"mongo.games.com/goserver/core/i18n"
"mongo.games.com/goserver/core/logger"
@ -3300,6 +3301,38 @@ func CSPopUpWindowConfig(s *netlib.Session, packetId int, data interface{}, sid
return nil
}
func CSGetSwapShopInfo(s *netlib.Session, packetId int, data interface{}, sid int64) error {
logger.Logger.Tracef("CSGetSwapShopInfo %v", data)
p := PlayerMgrSington.GetOnlinePlayer(sid)
if p == nil {
return nil
}
_, ok := data.(*player_proto.CSGetSwapShopInfo)
if !ok {
return nil
}
token := jwt.NewWithClaims(jwt.SigningMethodHS256, jwt.MapClaims{
"snid": p.SnId,
"platform": p.Platform,
"exp": time.Hour.Seconds() * 24,
})
str, err := token.SignedString("5c56d1644966f078bfb90c71")
if err != nil {
logger.Logger.Errorf("CSGetSwapShopInfo err:%v", err)
return nil
}
pack := &player_proto.SCGetSwapShopInfo{
Url: fmt.Sprintf("%s?access_token=%s", model.GameParamData.SwapShopUrl, str),
}
p.SendToClient(int(player_proto.PlayerPacketID_PACKET_SCGetSwapShopInfo), pack)
logger.Logger.Tracef("SCGetSwapShopInfo %v", pack)
return nil
}
func init() {
// 用户信息
common.Register(int(player_proto.PlayerPacketID_PACKET_CS_PLAYERDATA), player_proto.CSPlayerData{}, CSPlayerData)
@ -3339,4 +3372,6 @@ func init() {
common.Register(int(player_proto.PlayerPacketID_PACKET_CSDollConfig), player_proto.CSCLAWDOLLConfig{}, CSCLAWDOLLConfig)
//客户端请求弹窗配置信息
common.Register(int(player_proto.PlayerPacketID_PACKET_CSPopUpWindowConfig), player_proto.CSPopUpWindowConfig{}, CSPopUpWindowConfig)
// 获取兑换商城网页地址
common.Register(int(player_proto.PlayerPacketID_PACKET_CSGetSwapShopInfo), player_proto.CSGetSwapShopInfo{}, CSGetSwapShopInfo)
}