浏览代码

同步360test分支修改

gitxsm 1 月之前
父节点
当前提交
b60dcb84b5

+ 3 - 0
script/common/ProtoID.lua

@@ -1831,3 +1831,6 @@ _ENV[1904]="CG_ZHUANPAN_DY_DESKTOP_SET"
 _ENV[1905]="CG_ZHUANPAN_DY_DESKTOP_QUERY"
 _ENV[1906]="GC_ZHUANPAN_DY_DESKTOP_QUERY"
 
+_ENV[1907]="CG_BATTLE_HANG_FULL_TIME_QUERY"
+_ENV[1908]="GC_BATTLE_HANG_FULL_TIME_QUERY"
+

+ 7 - 1
script/module/absAct/CommonActLoginGift.lua

@@ -175,7 +175,7 @@ function onCharge(human, nBuyID, buyNum)
 end
 
 function updateDaily(human, funcID)
-    if isOpenAct(human, COMMONACT_LOGINGIFT_ID) then
+    if not isOpenAct(human, COMMONACT_LOGINGIFT_ID) then
         return
     end
 
@@ -187,6 +187,9 @@ end
 
 -- 查询
 function CommonActLoginGift_Query(human)
+    if not isOpenAct(human, COMMONACT_LOGINGIFT_ID) then
+        return Broadcast.sendErr(human, Lang.YUNYING_ERR_TIME)
+    end
     local msgRet = Msg.gc.GC_ABS_COMONACT_LOGINGIFT_QUERY
     msgRet.giftDatafree[0] = 0
     msgRet.giftData68[0] = 0
@@ -254,6 +257,9 @@ end
 
 -- 领取奖励
 function CommonActLoginGift_GetReward(human, targetGiftType)
+    if not isOpenAct(human, COMMONACT_LOGINGIFT_ID) then
+        return Broadcast.sendErr(human, Lang.YUNYING_ERR_TIME)
+    end
     local type_2_cfg = transformCfg()
     local giftArr = type_2_cfg[targetGiftType]
     if not giftArr then

+ 3 - 0
script/module/absAct/CommonActMoneyTree.lua

@@ -184,6 +184,9 @@ end
 
 -- 查询
 function CommonActMoneyTree_Query(human)
+    if not isOpenAct(human, COMMONACT_MONEYTREE_ID) then
+        return Broadcast.sendErr(human, Lang.YUNYING_ERR_TIME)
+    end
     local msgRet = Msg.gc.GC_ABS_COMONACT_MONEYTREE_QUERY
     msgRet.rewardBasket[0] = 0
     msgRet.weighMax = BASKET_WEIGHT_MAX

+ 14 - 1
script/module/battle/BattleLogic.lua

@@ -2761,6 +2761,19 @@ local function hangExpGet(human,isDiamond)
     return 0, items
 end
 
+-- 下发挂机奖励满载时间戳
+-- fullTime = expTs1 + maxHangTime
+--   若 fullTime <= now  则奖励已满,满的时刻为 fullTime
+--   若 fullTime >  now  则奖励未满,将在 fullTime 时满
+function sendHangFullTime(human)
+    local tBattleOut = BattleLogic_GetBattleOut(human)
+    if not tBattleOut then return end
+    local maxHangTime = getHangMaxTime(human)
+    local msgRet = Msg.gc.GC_BATTLE_HANG_FULL_TIME_QUERY
+    msgRet.fullTime = tBattleOut.expTs1 + maxHangTime
+    Msg.send(msgRet, human.fd)
+end
+
 -- 获取挂机收益
 function hangGet(human,isDiamond)
     local ret, items = hangExpGet(human,false)
@@ -2770,7 +2783,7 @@ function hangGet(human,isDiamond)
         return Broadcast.sendErr(human, Lang.COMMON_ADD_JINBI_LIMIT)
     elseif ret == 0 then
         query(human)
-        
+        sendHangFullTime(human)
         RoleSystemLogic.onDot(human, RoleSystemDefine.ROLE_SYS_ID_1101)
         TreasureChestLogic.TreasureChestLogic_GetAllBoxNum(human)
     end

+ 4 - 0
script/module/battle/Handler.lua

@@ -12,6 +12,10 @@ function CG_BATTLE_HANG_GET(human)
 	BattleLogic.hangGet(human)
 end
 
+function CG_BATTLE_HANG_FULL_TIME_QUERY(human)
+	BattleLogic.sendHangFullTime(human)
+end
+
 function CG_BATTLE_NODE_SET(human, msg)
 	BattleLogic.nodeSet(human, msg.battleID)
 end

+ 9 - 0
script/module/battle/Proto.lua

@@ -153,6 +153,15 @@ GC_BATTLE_HANG_QUERY = {
 CG_BATTLE_HANG_GET = {
 }
 
+-- 挂机奖励满载时间查询
+-- fullTime: 满载时刻的Unix时间戳
+--   fullTime <= 当前时间  => 已经满了,满的时间是fullTime
+--   fullTime >  当前时间  => 还没满,将在fullTime时满
+CG_BATTLE_HANG_FULL_TIME_QUERY = {}
+
+GC_BATTLE_HANG_FULL_TIME_QUERY = {
+    {"fullTime", 1, "int"},   -- 挂机满载时的时间戳
+}
 
 -- 战役节点详细信息查询
 CG_BATTLE_NODE_DETAIL_QUERY = {

+ 5 - 0
script/module/chengjiu/ChengjiuLogic.lua

@@ -376,6 +376,11 @@ function checkTaskState(human)
             human.db.chengjiu.task = human.db.chengjiu.task or {}
             human.db.chengjiu.task[k] = CJ_TASK_STATE_1
             RoleSystemLogic.onDot(human, RoleSystemDefine.ROLE_SYS_ID_2001)
+            -- 同时刷新秘宝/圣遗物/精灵入口的红点(强制发送,确保可解封时客户端能看到提示)
+            RoleSystemLogic.onDot(human, RoleSystemDefine.ROLE_SYS_ID_2002,true)
+            RoleSystemLogic.onDot(human, RoleSystemDefine.ROLE_SYS_ID_2006, true)
+            RoleSystemLogic.onDot(human, RoleSystemDefine.ROLE_SYS_ID_2021, true)
+            RoleSystemLogic.onDot(human, RoleSystemDefine.ROLE_SYS_ID_2031, true)
             local msgRet = Msg.gc.GC_DAILYSHARE_SET
             msgRet.type = 2
             msgRet.desc = v.desc

+ 21 - 1
script/module/combat/BeSkill.lua

@@ -507,6 +507,7 @@ end
 -- 连击检测
 local function comboCheck(targetObj, side)
 	if Skill.GroupSkillCnt ~= 1 then return end--技能包首次技能攻击才能触发
+	if CombatImpl.isFanji or CombatImpl.comboType > 0 then return end
 
 	for _,pos in ipairs(CombatDefine.SIDE2POS[side]) do
 		local obj = CombatImpl.objList[pos]
@@ -514,6 +515,25 @@ local function comboCheck(targetObj, side)
 			for _, skillInfo in ipairs(obj.beSkillList[BESKILL_TYPE72] or {}) do
 				local skillCfg = Skill.GetSkillConfig(skillInfo[1])
 				if skillCfg and skillCfg.cmd == "comboProb" then
+					local targetType = skillCfg.beSkillArgs[2] or 0
+					local targetList = skillCfg.beSkillArgs[3]
+					if targetType <= 0 or not targetList then
+						return
+					end
+
+					local bl = false
+					if targetType == 1 then -- 职业
+						if table.find(targetList, targetObj.job) then
+							bl = true
+						end
+					elseif targetType == 2 then -- 种族
+						if table.find(targetList, targetObj.camp) then
+							bl = true
+						end
+					end
+
+					if not bl then return end
+
 					local comboProbVal = skillCfg.beSkillArgs[1] or 0
 					local randval = math.random(0, 10000)
 					if comboProbVal >= randval then
@@ -834,7 +854,7 @@ function onHit(attacker,targets,skillID)
 
 
 	local target = targets[1]
-	if target and target.side == defendSide and CombatObj.getValue(attacker,RoleDefine.RATE_COMBAT_NOW) > 0 then
+	if target and target.side == defendSide and CombatObj.getValue(attacker,RoleDefine.HURT_COMBAT_NOW) > 0 then
 		if attacker.beSkillList[BESKILL_TYPE73] then
 			for _,v in ipairs(attacker.beSkillList[BESKILL_TYPE73]) do
 				use(attacker,targets,v)

+ 9 - 0
script/module/combat/CombatBuff.lua

@@ -306,9 +306,18 @@ local function isMiankong(obj, cmd, attacker, skillKongRate)
 	end
 end
 
+local sp_notBan_buff_list = {
+	["hp"] = true,
+}
+
 -- 是否可能被禁止增加buff
 local function isBanBuff(obj, cmd)
+	if sp_notBan_buff_list[cmd] then
+		return false
+	end
+
 	initCombatBufferType()
+
 	if BUFFER_COMBAT_TYPE[cmd] and BUFFER_COMBAT_TYPE[cmd] == 2 then
 		local res, _, ind = isStatus(obj, { "linglun" })
 		if not res then

+ 2 - 2
script/module/elf/ElfLogic.lua

@@ -257,8 +257,8 @@ end
 local function updateDot(human, targetQuality)
     local cfgHtbl = generateCfgByQuality(targetQuality)
 
-    -- 该品质的所有精灵不能升星和升级了
-    if not dotJudgment(human, cfgHtbl) then
+    -- 如果该品质的精灵存在可激活或可升级的情况,发送红点
+    if dotJudgment(human, cfgHtbl) then
         local dotID = 0
         if targetQuality == 1 then
             dotID = RoleSystemDefine.ROLE_SYS_ID_2032

+ 21 - 0
script/module/scene/Handler.lua

@@ -37,6 +37,23 @@ local function isBan(uuid, channelId, account, appId)
 	return BanLogic.CheckBan(uuid, channelId, account, appId)
 end
 
+-- 判断是否属于白名单IP
+local function isWhiteIp(ip)
+	if not ip then
+		return false
+	end
+
+	if not Config.WHITEIP_LIST or #Config.WHITEIP_LIST == 0 then
+		return true
+	end
+
+	if table.find(Config.WHITEIP_LIST, ip) then
+		return true
+	end
+
+	return false
+end
+
 
 --在线玩家列表不再从 ObjHuman.onlineAccount 获取, 改为从 ObjHuman.onlineNewUniqueTag 获取
 function CG_TEST_PROTO(fd,msg)
@@ -220,6 +237,10 @@ function CG_ASK_LOGIN(fd, msg)
 		return sendDisconnect(fd, CommonDefine.DISCONNECT_AUTH_FAIL)
 	end
 
+	if Config.IS_CHECK_IP == true and not isWhiteIp(msg.ip) then
+		return
+	end
+
 
 	--如果在线人数大于最大可容纳在线人数时,断开链接
 	local onlineCnt = ObjHuman.getOnlineCnt()

+ 3 - 0
script/module/serverCommerce/ServerCommerceActBattleGroundCS.lua

@@ -497,6 +497,9 @@ function BG_N2C_Act_End(msg)
 
     local fd_2_PlayerList = {}
     local joinList = battleGroundData.joinList
+    if not joinList then
+        return
+    end
 
     local serverIdxMin = MiddleConnect.MiddleConnect_ConfServerID2TrueServerID(warZoneServerIdMin)
     local serverIdxMax = MiddleConnect.MiddleConnect_ConfServerID2TrueServerID(warZoneServerIdMax)

+ 2 - 67
script/module/topup/GiftLogic.lua

@@ -160,7 +160,7 @@ local handler = {
     [PRINCIPAL_LINE_EVNET] = function(human,param)
         for id,cfg in pairs(GiftExcel) do 
             -- 触发新礼包
-            if cfg.trigger == PRINCIPAL_LINE_EVNET and cfg.param[1] == param.id then 
+            if cfg.trigger == PRINCIPAL_LINE_EVNET and cfg.param[1] <= param.id then 
                 genGift(human,id)
             end
         end
@@ -168,7 +168,7 @@ local handler = {
     [EVAL_TOWER_EVENT] = function(human,param)
         for id,cfg in pairs(GiftExcel) do 
             -- 触发新礼包
-            if cfg.trigger == EVAL_TOWER_EVENT and cfg.param[1] == param.id then 
+            if cfg.trigger == EVAL_TOWER_EVENT and cfg.param[1] <= param.id then 
                 genGift(human,id)
             end
         end
@@ -191,71 +191,6 @@ local handler = {
             end
         end
     end,
-
-    -- [GIFT_UPGRADE_LV_EVENT] = function (human,param)
-    --     for id,cfg in pairs(GiftExcel) do
-    --         -- 触发新礼包
-    --         if cfg.trigger == GIFT_UPGRADE_LV_EVENT and cfg.param[1] == param.newLv then
-    --             genGift(human,id)
-    --         end
-    --     end
-    -- end,
-
-    -- [GIFT_TALISMAN_UPGRADE_STAR] = function (human,param)
-    --     for id,cfg in pairs(GiftExcel) do
-    --         -- 触发新礼包
-    --         if cfg.trigger == GIFT_TALISMAN_UPGRADE_STAR and cfg.param[1] == param.newLv then
-    --             genGift(human,id)
-    --         end
-    --     end
-    -- end,
-
-    -- [GIFT_WINNERRELIC_UPGRADE_STAR] = function (human,param)
-    --     for id,cfg in pairs(GiftExcel) do
-    --         -- 触发新礼包
-    --         if cfg.trigger == GIFT_WINNERRELIC_UPGRADE_STAR and cfg.param[1] == param.newLv then
-    --             genGift(human,id)
-    --         end
-    --     end
-    -- end,
-
-    -- [GIFT_ELF_UPGRADE_STAR] = function (human,param)
-    --     for id,cfg in pairs(GiftExcel) do
-    --         -- 触发新礼包
-    --         if cfg.trigger == GIFT_ELF_UPGRADE_STAR and cfg.param[1] == param.newLv then
-    --             genGift(human,id)
-    --         end
-    --     end
-    -- end,
-
-
-    -- [GIFT_TALISMAN_OPEN] = function (human)
-    --     for id,cfg in pairs(GiftExcel) do
-    --         -- 触发新礼包
-    --         if cfg.trigger == GIFT_TALISMAN_OPEN then
-    --             genGift(human,id)
-    --         end
-    --     end
-    -- end,
-
-    -- [GIFT_WINNERRELIC_OPEN] = function (human)
-    --     for id,cfg in pairs(GiftExcel) do
-    --         -- 触发新礼包
-    --         if cfg.trigger == GIFT_WINNERRELIC_OPEN then
-    --             genGift(human,id)
-    --         end
-    --     end
-    -- end,
-
-    -- [GIFT_ELF_OPEN] = function (human)
-    --     for id,cfg in pairs(GiftExcel) do
-    --         -- 触发新礼包
-    --         if cfg.trigger == GIFT_ELF_OPEN then
-    --             genGift(human,id)
-    --         end
-    --     end
-    -- end,
-
 }
 
 local handler2 = {

+ 1 - 0
webServer/src/channels/factory/ChannelFactory.ts

@@ -59,6 +59,7 @@ class ChannelFactory {
     this.registerHandler(18, new HongKongTaiwanChannelHandler()); // 港台渠道
     this.registerHandler(20, new ZeroOneChannelHandler()); // 0.1渠道
     this.registerHandler(21, new QingtianChannelHandler()); // 晴天SDK
+    this.registerHandler(22, new ZeroOneChannelHandler()); // 1折渠道
   }
 
   /**

+ 13 - 0
webServer/src/config/channelConfig.ts

@@ -362,4 +362,17 @@ export const channelConfigs: Record<number, ChannelConfig> = {
             productCode: QINGTIAN_PRODUCT_CODE,
         },
     },
+    22: {
+        // 0.1渠道 QuickSDK
+        channelId: 22,
+        name: "1zhe",
+        platform: "",
+        paymentConfig: {
+            signKey: ZERO_ONE_QUICK_MD5_KEY,
+            callbackKey: ZERO_ONE_QUICK_CALLBACK_KEY,
+        },
+        loginConfig: {
+            productCode: ZERO_ONE_QUICK_PRODUCT_CODE,
+        },
+    },
 };

+ 56 - 2
webServer/src/controller/ApiController.ts

@@ -18,7 +18,7 @@ import {
 import {PaymentHelper} from "../utils/PaymentHelper";
 import {SignatureVerifier} from "../utils/SignatureVerifier";
 import {ChannelConfigManager} from "../utils/ChannelConfigManager";
-import {getRoleInfoByUidAndServerId} from "../mongo/mongodb";
+import {getRoleInfoByUidAndServerId, getRoleListByUserId} from "../mongo/mongodb";
 import {min} from "moment-timezone";
 
 // platform内存缓存,key: ip:device_no,TTL 5分钟
@@ -852,7 +852,7 @@ class ApiController {
                 }
                 let minSid = 1
                 if (tag == 11) {
-                    minSid = Math.floor(((servers[0].sid || 1) - 1) / 10) * 10 + 1
+                    minSid = servers.length //新号没有角色,minsid = 最新的服
                 }
 
                 data.push({
@@ -1617,7 +1617,61 @@ class ApiController {
         }
     }
 
+    /**
+     * 通过 userId 查询该账号在各区服的角色列表
+     * 请求参数(GET/POST 均可):uid、channel_id
+     * 返回:[{ roleId, roleName, zhandouli, serverName, serverId, createTime }]
+     */
+    async getUserRoleList(ctx) {
+        const uid = ctx.query.uid || ctx.request.body?.uid;
+        const tag = ctx.query.channel_id || ctx.request.body?.channel_id || 1;
+
+        logger.info('getUserRoleList 请求参数:', {uid, tag});
+
+        if (!uid) {
+            ctx.body = ApiController.fail('uid 不能为空', -1);
+            return;
+        }
+
+        // 1. 查询该用户进入过的所有区服(join game_server 取 db_name 和区服名)
+        const enterServerList: any[] = await Server.getEnterServerListByUid(uid, tag);
+
+        logger.info('getUserRoleList enterServerList:', {
+            count: enterServerList?.length,
+            first: enterServerList?.[0] ? {
+                server_id: enterServerList[0].server_id,
+                db_name: enterServerList[0].db_name,
+                name: enterServerList[0].name,
+            } : null,
+        });
 
+        if (!enterServerList || enterServerList.length === 0) {
+            ctx.body = ApiController.success('请求成功', 1, false, []);
+            return;
+        }
+
+        // 去重(同一 server_id 可能有多条进区记录,取最新一条即可)
+        const seen = new Set<string>();
+        const uniqueServers = enterServerList.filter((s) => {
+            if (seen.has(String(s.server_id))) return false;
+            seen.add(String(s.server_id));
+            return true;
+        });
+
+        // 2. 并发查询每个区服的 MongoDB 角色信息
+        const roleList = await getRoleListByUserId(
+            uniqueServers.map((s) => ({
+                server_id: s.server_id,
+                db_name: s.db_name,
+                name: s.name,
+            })),
+            tag,
+            uid
+        );
+
+        logger.info('getUserRoleList 返回角色列表:', {uid, count: roleList.length});
+        ctx.body = ApiController.success('请求成功', 1, false, roleList);
+    }
 }
 
 module.exports = new ApiController();

+ 67 - 1
webServer/src/mongo/mongodb.ts

@@ -169,4 +169,70 @@ async function insertMailToPlayer(
     }
 }
 
-export { getDb, getCollection, closeConnection, getRoleInfoById, connectToMongo, getGuildInfoById, getRoleInfoByUidAndServerId, insertMailToPlayer };
+/**
+ * 批量查询某用户在多个区服的角色信息
+ * @param serverList  已加入区服列表,每项包含 { server_id, db_name, name (区服名) }
+ * @param tag         渠道标识(用于拼 newUniqueTag)
+ * @param uid         用户账号
+ */
+async function getRoleListByUserId(
+    serverList: Array<{ server_id: string; db_name: string; name: string }>,
+    tag: number | string,
+    uid: string
+): Promise<Array<{
+    roleId: string;
+    roleName: string;
+    roleLevel: number;
+    zhandouli: number;
+    serverName: string;
+    serverId: string;
+    createTime: number;
+}>> {
+    const results: Array<{
+        roleId: string;
+        roleName: string;
+        roleLevel: number;
+        zhandouli: number;
+        serverName: string;
+        serverId: string;
+        createTime: number;
+    }> = [];
+
+    if (!client) {
+        await connectToMongo();
+    }
+
+    for (const server of serverList) {
+        console.log(`[getRoleListByUserId] server:`, JSON.stringify(server));
+        if (!server.db_name) {
+            console.log(`[getRoleListByUserId] 跳过 server_id=${server.server_id},db_name 为空`);
+            continue;
+        }
+        try {
+            const database = client!.db(server.db_name);
+            const collection = database.collection('char');
+            const newUniqueTag = `${tag}|${server.server_id}|${uid}`;
+            console.log(`[getRoleListByUserId] 查询 db=${server.db_name} newUniqueTag=${newUniqueTag}`);
+            // MongoDB v2.x 使用 fields 而非 projection
+            const doc = await collection.findOne({ newUniqueTag });
+            console.log(`[getRoleListByUserId] 查询结果:`, doc ? `找到 name=${doc.name}` : 'null');
+            if (doc) {
+                results.push({
+                    roleId: doc._id.toString(),
+                    roleName: doc.name || '',
+                    roleLevel: doc.lv || 0,
+                    zhandouli: doc.zhandouli || 0,
+                    serverName: server.name || '',
+                    serverId: server.server_id,
+                    createTime: doc.createTime || 0,
+                });
+            }
+        } catch (error) {
+            console.error(`[getRoleListByUserId] 查询区服 ${server.server_id} 异常:`, error);
+        }
+    }
+
+    return results;
+}
+
+export { getDb, getCollection, closeConnection, getRoleInfoById, connectToMongo, getGuildInfoById, getRoleInfoByUidAndServerId, insertMailToPlayer, getRoleListByUserId };

+ 3 - 0
webServer/src/router/index.ts

@@ -92,4 +92,7 @@ router.post("/qqReport", TencentController.qqReport);
 // mianyou开服同步
 router.post("/mianyou/syncServer", ApiController.mianyouSyncServer);
 
+// 通过 userId 查询角色列表(战力、角色名、角色id、区服、创建时间)
+router.get("/getUserRoleList", ApiController.getUserRoleList);
+
 module.exports = router;