20260110备份

This commit is contained in:
fatiao 2026-01-10 14:39:46 +08:00
parent cd817ff8a8
commit fb24ab09a5
13 changed files with 2091 additions and 1881 deletions

View File

@ -155,15 +155,17 @@ const (
ForceOpenActivityPrefix = "activity:forceopen"
//通用活动数据
CommonActivityPrefix = "commonact:"
CommonActivityRankPrefix = "commonact:rank:"
CommonActivitySnapPrefix = "commonact:ranksnap:" //通用显示数据(不跟活动走)
CommonActivityPrefix = "commonact:"
CommonActivityRankPrefix = "commonact:rank:"
CommonActivitySnapPrefix = "commonact:ranksnap:" //通用显示数据(不跟活动走)
CommonActivitySnapPrefixExpand = "commonact:ranksnap:expand:" //扩展数据(根据活动走,额外的显示信息)
CommonActivityRankAwards = "commonact:rank:awards:" //宠物比拼领取情况
LiveRoomHeartPrefix = "liveroom:heart:"
)
//排行榜每日重置时使用,切记!!!
// 排行榜每日重置时使用,切记!!!
func GetRankScoreDailyReset(val uint64, passTime uint64) uint64 {
//score
var scoreStr = val
@ -182,7 +184,7 @@ func GetValByRankScoreDailyReset(score float64) uint64 {
return val
}
//通用排行榜积分处理
// 通用排行榜积分处理
func GetRankScoreCommon(val uint64, passTime uint64) uint64 {
//score
var scoreStr = val
@ -208,7 +210,7 @@ const (
CompetitionType_Idol //偶像季
)
//数据库相关操作
// 数据库相关操作
func GetMessageFromRedis(module, key string, msg interface{}) error {
ret, err := service.GetRedis().Get(module + key).Result()
if err != nil {
@ -279,7 +281,7 @@ func SetDataToRedis(key string, data string) error {
// 区分不同平台
func ConvertPlatform(openId, platform string) string {
if platform == SDKPlatform_YouYi || platform == SDKPlatform_YouYi_IOS ||
platform == SDKPlatform_U8Server{
platform == SDKPlatform_U8Server {
//除了quick和nb其他渠道都要加上渠道标识
openId = platform + openId
}

View File

@ -369,6 +369,8 @@ func init(){
addRule("SCLiveRoomSendGiftNtf","game,fruit","game",1800)
addRule("SCLiveRoomGiftRankAck","game,fruit","game",1802)
addRule("CSLiveRoomGiftRankReq","game,fruit","game",1803)
addRule("CSLiveRoomAddHeartReq","game,fruit","game",1804)
addRule("SCLiveRoomAddHeartAck","game,fruit","game",1805)
addRule("SSCrossYuanHangTrialViewListReq","crossserver","crossserver",6002)
addRule("SSCrossYuanHangTrialReq","crossserver","crossserver",6004)
addRule("SSCrossYuanHangTrialChallengeReq","crossserver","crossserver",6006)
@ -687,4 +689,5 @@ func init(){
ReqAckKVList[1777] = ReqAckKVInfo{1777, 1778, "CSLiveRoomSendGiftReq|SCLiveRoomSendGiftAck"}
ReqAckKVList[1783] = ReqAckKVInfo{1783, 1784, "CSLiveRoomGetReadyReq|SCLiveRoomGetReadyAck"}
ReqAckKVList[1796] = ReqAckKVInfo{1796, 1797, "CSLiveRoomShowSubmitReq|SCLiveRoomShowSubmitAck"}
ReqAckKVList[1804] = ReqAckKVInfo{1804, 1805, "CSLiveRoomAddHeartReq|SCLiveRoomAddHeartAck"}
}

View File

@ -174,6 +174,7 @@ func (self *LiveCardRoom) ShowStart() {
// 为准备的玩家抽卡
weightCfg := map[string]int{"NORMAL": 50, "MINI": 30, "MVP": 20}
self.rollCards = make([]*serverproto.KeyValueType64, 0)
self.showRewards = make([]*serverproto.KeyValueType64, 0)
for _, uid := range self.LiveRoom.readyUidList {
cards := make([]string, 0)
// 1. 保底抽一张MINI卡

View File

@ -4,6 +4,7 @@ import (
"fmt"
"math"
"math/rand"
"rocommon/service"
"rocommon/util"
"roserver/baseserver/model"
model2 "roserver/game/model"
@ -22,6 +23,8 @@ type LiveRoomInterface interface {
IsReady(uid uint64) bool
SendGift(uid uint64, giftId uint32) int32
RoomId() uint32
Heart() int64
AddHeart() int64
RoomType() uint32
StageSec() uint32
StageTimerSec() uint32
@ -82,6 +85,7 @@ type LiveRoom struct {
readyTimeline map[int32]*TimelineFrame
showTimeline map[int32]*TimelineFrame
resultTimeline map[int32]*TimelineFrame
heart int64
submitDataList []*LiveRoomSubmitData
@ -114,6 +118,7 @@ func newLiveRoom(roomId uint32, roomType uint32, tickInterval uint32) LiveRoom {
stage: LIVEROOM_STAGE_NULL,
roomCfg: serverproto.LiveRoomCfgLoader[int32(roomType)],
sumGiftPoint: 0,
heart: 0,
giftRank: make([]*serverproto.LiveRoomPlayerInfo, 0),
giftRecords: make([]*serverproto.LiveRoomPlayerInfo, 0),
chatRecords: make([]*serverproto.LiveRoomChatData, 0),
@ -195,6 +200,13 @@ func (self *LiveRoom) BaseInit() {
time4 := self.CalcTimelineSec(self.resultTimeline)
util.InfoF("GetTimelineTime: ", time1, time2, time3, time4)
heartStr, err := service.GetRedis().HGet(model.LiveRoomHeartPrefix, string(self.roomType)).Result()
if err != nil {
util.InfoF("ERR: Redis HGet %s:%s err", model.LiveRoomHeartPrefix, string(self.roomType))
}
heartNum, _ := strconv.ParseInt(heartStr, 10, 64)
self.heart = heartNum
self.ChangeStage(LIVEROOM_STAGE_IDLE)
}
@ -473,12 +485,15 @@ func (self *LiveRoom) IsReady(uid uint64) bool {
func (self *LiveRoom) GetReady(currUid uint64) bool {
if self.stage != LIVEROOM_STAGE_READY {
util.InfoF("[GetReady] ERR: current stage is not LIVEROOM_STAGE_READY")
return false
}
if SliceIsExist(self.readyUidList, currUid) {
util.InfoF("[GetReady] ERR: %s already getReady", currUid)
return false
}
if len(self.readyUidList) > self.VF_GetMaxReadyNum(self.roomType) {
util.InfoF("[GetReady] ERR: readyUidList=%d > GetMaxReadyNum", len(self.readyUidList))
return false
}
self.readyUidList = append(self.readyUidList, currUid)
@ -548,6 +563,13 @@ func (self *LiveRoom) RoomId() uint32 {
return self.roomId
}
func (self *LiveRoom) Heart() int64 { return self.heart }
func (self *LiveRoom) AddHeart() int64 {
self.heart = self.heart + 1
return self.heart
}
func (self *LiveRoom) RoomType() uint32 {
return self.roomType
}
@ -620,11 +642,9 @@ func (self *LiveRoom) ChatRecords() []*serverproto.LiveRoomChatData {
func (self *LiveRoom) RecordChatData(chatSN uint64, chatData *serverproto.LiveRoomChatData) {
var maxChatRecordNum int = 10
if len(self.chatRecords) < maxChatRecordNum {
self.chatRecords = append(self.chatRecords, chatData)
} else {
idx := chatSN % uint64(maxChatRecordNum)
self.chatRecords[idx] = chatData
self.chatRecords = append(self.chatRecords, chatData)
if len(self.chatRecords) > maxChatRecordNum {
self.chatRecords = self.chatRecords[1:]
}
}
@ -711,8 +731,11 @@ func (self *LiveRoom) SendGift(uid uint64, giftId uint32) int32 {
self.DeleteItemList(uid, costItems, int32(model2.AddFrom_LiveRoom_Gift), true)
sendGiftInfo := &serverproto.LiveRoomPlayerInfo{
Uid: uid,
Data: fmt.Sprintf("%d:%d", giftId, giftRewardStatus),
Uid: uid,
Nickname: player.Name,
HeadId: player.HeadId,
Level: player.Level,
Data: fmt.Sprintf("gift:%d;status:%d", giftId, giftRewardStatus),
}
self.giftRecords = append(self.giftRecords, sendGiftInfo)
if len(self.giftRecords) > 10 {

View File

@ -69,7 +69,7 @@ func (self *LiveSellRoom) ShowEnd() {
Value: itemNum,
})
}
self.LiveRoom.AddItemList(currUid, items, int32(model2.AddFrom_LiveRoom_Card), false)
self.LiveRoom.AddItemList(currUid, items, int32(model2.AddFrom_LiveRoom_Card), true)
}
}
}

View File

@ -172,6 +172,7 @@ func init() {
Error: int32(serverproto.ErrorCode_ERROR_OK),
RoomType: liveRoom.RoomType(),
RoomId: liveRoom.RoomId(),
Heart: liveRoom.Heart(),
StageSec: liveRoom.StageSec(),
StageTimerSec: liveRoom.StageTimerSec(),
Stage: liveRoom.Stage(),
@ -242,6 +243,21 @@ func init() {
}
})
serverproto.Handle_FRUIT_CSLiveRoomAddHeartReq = model.HandleBackendMessage(func(ev rocommon.ProcEvent, cliId model.ClientID) {
msg := ev.Msg().(*serverproto.CSLiveRoomAddHeartReq)
util.InfoF("receive CSLiveRoomAddHeartReq msg:%v", msg)
liveRoom, _ := model2.RoomMgr.GetLiveRoomByRoomId(msg.RoomId)
if liveRoom != nil {
heart := liveRoom.AddHeart()
ackMsg := &serverproto.SCLiveRoomAddHeartAck{
Uid: msg.Uid,
RoomId: msg.RoomId,
Heart: heart,
}
model.ServiceReplay(ev, ackMsg)
}
})
serverproto.Handle_FRUIT_CSLiveRoomGiftRankReq = model.HandleBackendMessage(func(ev rocommon.ProcEvent, cliId model.ClientID) {
msg := ev.Msg().(*serverproto.CSLiveRoomGiftRankReq)
util.InfoF("receive CSLiveRoomGiftRankReq msg:%v", msg)

View File

@ -312,6 +312,25 @@ func init() {
}
role.ReplayGate(msg, true)
})
serverproto.Handle_GAME_CSLiveRoomAddHeartReq = model.HandleBackendMessage(func(ev rocommon.ProcEvent, cliId model.ClientID) {
msg := ev.Msg().(*serverproto.CSLiveRoomAddHeartReq)
role := model2.RoleMag.GetRoleOrKick(cliId, ev)
if role == nil {
return
}
util.InfoF("uid=%v receive CSLiveRoomAddHeartReq msg=%v", role.GetUUid(), msg)
msg.Uid = role.GetUUid()
role.(*model2.Role).SendAllFruit(msg)
})
serverproto.Handle_GAME_SCLiveRoomAddHeartAck = model.HandleBackendMessage(func(ev rocommon.ProcEvent, cliId model.ClientID) {
msg := ev.Msg().(*serverproto.SCLiveRoomAddHeartAck)
util.InfoF("uid=%v receive SCLiveRoomAddHeartAck msg=%v", msg.Uid, msg)
role := model2.RoleMag.GetRoleFromUUid(msg.Uid)
if role == nil {
return
}
role.ReplayGate(msg, true)
})
serverproto.Handle_GAME_CSLiveRoomGiftRankReq = model.HandleBackendMessage(func(ev rocommon.ProcEvent, cliId model.ClientID) {
msg := ev.Msg().(*serverproto.CSLiveRoomGiftRankReq)

File diff suppressed because it is too large Load Diff

View File

@ -3888,13 +3888,14 @@ message SCLiveRoomJoinAck { //project game|fruit //RouteRule game
int32 error = 2;
uint32 room_type = 3;
uint32 room_id = 4;
uint32 stage = 5;
uint32 stage_timer_sec = 6;
uint32 stage_sec = 7;
bool is_ready = 8;
repeated LiveRoomPlayerInfo gift_records = 9;
repeated LiveRoomChatData chat_datas = 10;
repeated LiveRoomPlayerInfo ready_player_info_list = 11;
int64 heart = 5;
uint32 stage = 6;
uint32 stage_timer_sec = 7;
uint32 stage_sec = 8;
bool is_ready = 9;
repeated LiveRoomPlayerInfo gift_records = 10;
repeated LiveRoomChatData chat_datas = 11;
repeated LiveRoomPlayerInfo ready_player_info_list = 12;
}
message CSLiveRoomLeaveReq { //project game|fruit //RouteRule game
uint64 uid = 1;
@ -3937,6 +3938,16 @@ message SCLiveRoomSendGiftNtf { //project game|fruit //RouteRule game
uint32 room_id = 2;
LiveRoomPlayerInfo send_gift_info = 3;
}
message CSLiveRoomAddHeartReq { //project game|fruit //RouteRule game
uint64 uid = 1;
uint32 room_id = 2;
}
message SCLiveRoomAddHeartAck { //project game|fruit //RouteRule game
uint64 uid = 1;
uint32 room_id = 2;
int64 heart = 3;
}
message CSLiveRoomGiftRankReq { //project game|fruit //RouteRule game
uint64 uid = 1;
uint32 room_id = 2;

File diff suppressed because it is too large Load Diff

View File

@ -771,6 +771,8 @@ enum protoMsgId{
SC_LIVE_ROOM_SEND_GIFT_NTF = 1800; // SCLiveRoomSendGiftNtf **SCLiveRoomSendGiftNtf **login.proto **game,fruit [SCLiveRoomSendGiftNtf]
SC_LIVE_ROOM_GIFT_RANK_ACK = 1802; // SCLiveRoomGiftRankAck **SCLiveRoomGiftRankAck **login.proto **game,fruit [SCLiveRoomGiftRankAck]
CS_LIVE_ROOM_GIFT_RANK_REQ = 1803; // CSLiveRoomGiftRankReq **CSLiveRoomGiftRankReq **login.proto **game,fruit [CSLiveRoomGiftRankReq]
CS_LIVE_ROOM_ADD_HEART_REQ = 1804; // CSLiveRoomAddHeartReq **CSLiveRoomAddHeartReq **login.proto **game,fruit [CSLiveRoomAddHeartReq]
SC_LIVE_ROOM_ADD_HEART_ACK = 1805; // SCLiveRoomAddHeartAck **SCLiveRoomAddHeartAck **login.proto **game,fruit [SCLiveRoomAddHeartAck]
SS_WEB_GM_CHAT_MSG_NTF = 3000; // SSWebGMChatMsgNtf **SSWebGMChatMsgNtf **logic.proto **db [SSWebGMChatMsgNtf]
SS_WEB_GM_ADD_MAIL_NTF = 3001; // SSWebGMAddMailNtf **SSWebGMAddMailNtf **logic.proto **social,game,db [SSWebGMAddMailNtf]
SS_WEB_GM_BAN_NTF = 3002; // SSWebGMBanNtf **SSWebGMBanNtf **logic.proto **social,game [SSWebGMBanNtf]

View File

@ -749,5 +749,7 @@ enum protoMsgId{
SC_LIVE_ROOM_SEND_GIFT_NTF = 1800; // SCLiveRoomSendGiftNtf **SCLiveRoomSendGiftNtf **login.proto **game,fruit [SCLiveRoomSendGiftNtf]
SC_LIVE_ROOM_GIFT_RANK_ACK = 1802; // SCLiveRoomGiftRankAck **SCLiveRoomGiftRankAck **login.proto **game,fruit [SCLiveRoomGiftRankAck]
CS_LIVE_ROOM_GIFT_RANK_REQ = 1803; // CSLiveRoomGiftRankReq **CSLiveRoomGiftRankReq **login.proto **game,fruit [CSLiveRoomGiftRankReq]
CS_LIVE_ROOM_ADD_HEART_REQ = 1804; // CSLiveRoomAddHeartReq **CSLiveRoomAddHeartReq **login.proto **game,fruit [CSLiveRoomAddHeartReq]
SC_LIVE_ROOM_ADD_HEART_ACK = 1805; // SCLiveRoomAddHeartAck **SCLiveRoomAddHeartAck **login.proto **game,fruit [SCLiveRoomAddHeartAck]
}

View File

@ -198,6 +198,8 @@ var(
Handle_FRUIT_SCLiveRoomSendGiftNtf =func(e rocommon.ProcEvent){panic("SCLiveRoomSendGiftNtf not implements")}
Handle_FRUIT_SCLiveRoomGiftRankAck =func(e rocommon.ProcEvent){panic("SCLiveRoomGiftRankAck not implements")}
Handle_FRUIT_CSLiveRoomGiftRankReq =func(e rocommon.ProcEvent){panic("CSLiveRoomGiftRankReq not implements")}
Handle_FRUIT_CSLiveRoomAddHeartReq =func(e rocommon.ProcEvent){panic("CSLiveRoomAddHeartReq not implements")}
Handle_FRUIT_SCLiveRoomAddHeartAck =func(e rocommon.ProcEvent){panic("SCLiveRoomAddHeartAck not implements")}
Handle_FRUIT_SSPlayerOnlineNtf =func(e rocommon.ProcEvent){panic("SSPlayerOnlineNtf not implements")}
Handle_FRUIT_SSPlayerOfflineNtf =func(e rocommon.ProcEvent){panic("SSPlayerOfflineNtf not implements")}
Handle_FRUIT_SSGameRoleAddItemListAck =func(e rocommon.ProcEvent){panic("SSGameRoleAddItemListAck not implements")}
@ -620,6 +622,8 @@ var(
Handle_GAME_SCLiveRoomSendGiftNtf =func(e rocommon.ProcEvent){panic("SCLiveRoomSendGiftNtf not implements")}
Handle_GAME_SCLiveRoomGiftRankAck =func(e rocommon.ProcEvent){panic("SCLiveRoomGiftRankAck not implements")}
Handle_GAME_CSLiveRoomGiftRankReq =func(e rocommon.ProcEvent){panic("CSLiveRoomGiftRankReq not implements")}
Handle_GAME_CSLiveRoomAddHeartReq =func(e rocommon.ProcEvent){panic("CSLiveRoomAddHeartReq not implements")}
Handle_GAME_SCLiveRoomAddHeartAck =func(e rocommon.ProcEvent){panic("SCLiveRoomAddHeartAck not implements")}
Handle_GAME_SSWebGMAddMailNtf =func(e rocommon.ProcEvent){panic("SSWebGMAddMailNtf not implements")}
Handle_GAME_SSWebGMBanNtf =func(e rocommon.ProcEvent){panic("SSWebGMBanNtf not implements")}
Handle_GAME_SSWebGMNoticeNtf =func(e rocommon.ProcEvent){panic("SSWebGMNoticeNtf not implements")}
@ -1224,6 +1228,8 @@ func GetMessageHandler(sreviceName string) rocommon.EventCallBack {
case *SCLiveRoomSendGiftNtf: Handle_FRUIT_SCLiveRoomSendGiftNtf(e)
case *SCLiveRoomGiftRankAck: Handle_FRUIT_SCLiveRoomGiftRankAck(e)
case *CSLiveRoomGiftRankReq: Handle_FRUIT_CSLiveRoomGiftRankReq(e)
case *CSLiveRoomAddHeartReq: Handle_FRUIT_CSLiveRoomAddHeartReq(e)
case *SCLiveRoomAddHeartAck: Handle_FRUIT_SCLiveRoomAddHeartAck(e)
case *SSPlayerOnlineNtf: Handle_FRUIT_SSPlayerOnlineNtf(e)
case *SSPlayerOfflineNtf: Handle_FRUIT_SSPlayerOfflineNtf(e)
case *SSGameRoleAddItemListAck: Handle_FRUIT_SSGameRoleAddItemListAck(e)
@ -1651,6 +1657,8 @@ func GetMessageHandler(sreviceName string) rocommon.EventCallBack {
case *SCLiveRoomSendGiftNtf: Handle_GAME_SCLiveRoomSendGiftNtf(e)
case *SCLiveRoomGiftRankAck: Handle_GAME_SCLiveRoomGiftRankAck(e)
case *CSLiveRoomGiftRankReq: Handle_GAME_CSLiveRoomGiftRankReq(e)
case *CSLiveRoomAddHeartReq: Handle_GAME_CSLiveRoomAddHeartReq(e)
case *SCLiveRoomAddHeartAck: Handle_GAME_SCLiveRoomAddHeartAck(e)
case *SSWebGMAddMailNtf: Handle_GAME_SSWebGMAddMailNtf(e)
case *SSWebGMBanNtf: Handle_GAME_SSWebGMBanNtf(e)
case *SSWebGMNoticeNtf: Handle_GAME_SSWebGMNoticeNtf(e)
@ -2839,6 +2847,8 @@ func init() {
registerInfo(1800, reflect.TypeOf((*SCLiveRoomSendGiftNtf)(nil)).Elem(), 0)
registerInfo(1802, reflect.TypeOf((*SCLiveRoomGiftRankAck)(nil)).Elem(), 0)
registerInfo(1803, reflect.TypeOf((*CSLiveRoomGiftRankReq)(nil)).Elem(), 0)
registerInfo(1804, reflect.TypeOf((*CSLiveRoomAddHeartReq)(nil)).Elem(), 0)
registerInfo(1805, reflect.TypeOf((*SCLiveRoomAddHeartAck)(nil)).Elem(), 0)
registerInfo(3000, reflect.TypeOf((*SSWebGMChatMsgNtf)(nil)).Elem(), 0)
registerInfo(3001, reflect.TypeOf((*SSWebGMAddMailNtf)(nil)).Elem(), 0)
registerInfo(3002, reflect.TypeOf((*SSWebGMBanNtf)(nil)).Elem(), 0)