From e84a1bebb1b40e1bef2b531f1bac77224af355bc Mon Sep 17 00:00:00 2001 From: liuzujun <307836273@qq.com> Date: Thu, 15 Jul 2021 11:51:54 +0800 Subject: [PATCH] gm后台查询日志,公告相关协议 --- src/ProtocolCode.lua | 1 + src/actions/ActivityAction.lua | 2 +- src/actions/DinerAction.lua | 10 +++++++++- src/actions/EmailAction.lua | 6 +++--- src/actions/GmAction.lua | 9 ++++++--- src/actions/HangAction.lua | 6 ++++-- src/actions/HeroAction.lua | 8 +++++++- src/actions/HttpAction.lua | 10 +++++++++- src/actions/PvpAction.lua | 14 +++++++++++--- src/actions/RoleAction.lua | 11 ++++++++--- src/actions/StoreAction.lua | 4 +++- src/actions/TowerAction.lua | 6 +++++- src/adv/Adv.lua | 5 +++-- src/csvdata | 2 +- src/models/Email.lua | 2 ++ src/models/Role.lua | 7 ++++++- src/models/RoleLog.lua | 1 + src/models/RolePlugin.lua | 43 ++++++++++++++++++++++++++++++++++++++++++- src/models/RoleTask.lua | 4 ++++ src/shared/ModelBaseMysql.lua | 2 ++ 20 files changed, 128 insertions(+), 25 deletions(-) diff --git a/src/ProtocolCode.lua b/src/ProtocolCode.lua index 048b1a3..7d6fabd 100644 --- a/src/ProtocolCode.lua +++ b/src/ProtocolCode.lua @@ -8,6 +8,7 @@ actionCodes = { Sys_maintainNotice = 6, Sys_customNotice = 7, Sys_checkQueue = 8, + Sys_gameNotice = 9, Gm_clientRequest = 20, Gm_receiveResponse = 21, diff --git a/src/actions/ActivityAction.lua b/src/actions/ActivityAction.lua index f98c0c5..6b1b4b9 100644 --- a/src/actions/ActivityAction.lua +++ b/src/actions/ActivityAction.lua @@ -1434,7 +1434,7 @@ function _M.returnerTaskRpc(agent, data) local TaskCsv = csvdb["activity_taskCsv"][76] or {} local taskData = TaskCsv[taskId] if not taskData then return 2 end - if curAllDay < taskData.day then return 2 end + if curAllDay < taskData.day then return 5 end local status = returner.status or {} if status[taskId] then return 3 end diff --git a/src/actions/DinerAction.lua b/src/actions/DinerAction.lua index 18124cd..470f2aa 100644 --- a/src/actions/DinerAction.lua +++ b/src/actions/DinerAction.lua @@ -112,6 +112,8 @@ function _M.addSellRpc( agent, data ) role:mylog("diner_action", {desc = "addSell", int1 = dish, int2 = count}) + role:mylog("diner_action", {desc = "onSell", short1 = 1, int1 = dish, int2 = count, cint1 = msg.slot, cint2 = count, cint3 = dishLevel}) + role.dinerData:updateProperty({field = "sells", value = json.encode(sells)}) SendPacket(actionCodes.Diner_addSellRpc, "") return true @@ -192,7 +194,10 @@ function _M.getSellRewardRpc( agent, data ) } deltaTimes[slot] = temp.deltaTime local sellCount = oldCount - temp.lastCount - role:mylog("diner_action", {desc = "sell", int1 = sellDish, int2 = sellCount}) + if sellCount > 0 then + role:mylog("diner_action", {desc = "sell", int1 = sellDish, int2 = sellCount}) + role:mylog("diner_action", {desc = "onSell", short1 = 2, int1 = sellDish, int2 = sellCount, cint1 = tonumber(slot), cint2 = temp.lastCount, cint3 = sell.level}) + end end sells = json.decode(role.dinerData:getProperty("sells")) for slot, sell in pairs(sells) do @@ -310,6 +315,9 @@ function _M.expediteSellRpc( agent, data ) restaurant_sale_coin = rewards[ItemId.DinerCoin] or 0, -- 售卖获得美食币 restaurant_sale_gear = rewards[ItemId.Gold] or 0, -- 售卖获得齿轮 }) + if result.expediteCount > 0 then + role:mylog("diner_action", {desc = "onSell", short1 = 3, int1 = sell.dish, int2 = result.expediteCount, cint1 = tonumber(slot), cint2 = result.lastCount, cint3 = sell.level}) + end end end diff --git a/src/actions/EmailAction.lua b/src/actions/EmailAction.lua index 38af457..9897dfc 100644 --- a/src/actions/EmailAction.lua +++ b/src/actions/EmailAction.lua @@ -129,7 +129,7 @@ function _M.drawAllAttachRpc(agent, data) for key, v in pairs(attachments:toNumMap()) do reward[key] = (reward[key] or 0) + v end - role:mylog("mail_action", {desc = "draw_attach", int1 = email:getProperty("emailId"), key1 = email:getProperty("title"), key2 = attachments}) + --role:mylog("mail_action", {desc = "draw_attach", int1 = email:getProperty("emailId"), key1 = email:getProperty("title"), key2 = attachments}) end end if role:checkRuneFullyByReward(reward) then return 1 end @@ -168,7 +168,7 @@ function _M.drawAttachRpc(agent, data) email:setProperty("status", 2, true) email:log(role, 2) SendPacket(actionCodes.Email_drawAttachRpc, MsgPack.pack({reward = reward, change = change})) - role:mylog("mail_action", {desc = "draw_attach", int1 = email:getProperty("emailId"), key1 = email:getProperty("title"), key2 = attachments}) + --role:mylog("mail_action", {desc = "draw_attach", int1 = email:getProperty("emailId"), key1 = email:getProperty("title"), key2 = attachments}) return true end @@ -184,7 +184,7 @@ function _M.checkRpc(agent, data) email:setProperty("status", 1, true) email:log(role, 1) - role:mylog("mail_action", {desc = "check_mail", int1 = id}) + --role:mylog("mail_action", {desc = "check_mail", int1 = id}) SendPacket(actionCodes.Email_checkRpc, '') return true diff --git a/src/actions/GmAction.lua b/src/actions/GmAction.lua index c17294d..794a303 100644 --- a/src/actions/GmAction.lua +++ b/src/actions/GmAction.lua @@ -38,6 +38,7 @@ function _M.ban(role, pms) role:setBan(time, ctype) role:mylog("gm_action", {desc = "ban", int1 = time, int2 = ctype, key1 = pms.sender}) + return "封杀成功" end @@ -64,14 +65,16 @@ function _M.reset_rank(role, pms) end function _M.silent(role, pms) - local pm1 = tonum(pms.pm1) + local pm1 = tonum(pms.pm1, 0) + dump(pms, pm1) if pm1 < 1 then role:updateProperty({field = "silent", value = 0}) + role:setProperty("silentType", 0) return "解禁言成功" end role:updateProperty({field = "silent", value = specTime({hour = 0}, skynet.timex()) + pm1 * 86400}) - - role:mylog("gm_action", {desc = "silent", int1 = pms.pm1, key1 = pms.sender}) + role:setProperty("silentType", pms.pm2 or 0) + role:mylog("gm_action", {desc = "silent", int1 = pm1, key1 = pms.sender}) return "禁言成功" end diff --git a/src/actions/HangAction.lua b/src/actions/HangAction.lua index 3671973..dfe6c9c 100644 --- a/src/actions/HangAction.lua +++ b/src/actions/HangAction.lua @@ -353,10 +353,12 @@ function _M.endBattleRpc(agent, data) reward = reward, }) - local team = role:getProperty("pvpTC") + --local team = role:getProperty("pvpTC") + local team = role:getTeamFormatByType(TeamSystemType.Hang) local battleTime = skynet.timex() - role._StartBattleTs - role:mylog("hang_action", {desc = "hangBattle", short1 = msg.starNum > 0 and 1 or 0, int1 = carbonId, int2 = role:getProperty("hangTBV"), cint1 = role:getHerosCamp(team.heros), cint2 = battleTime}) + role:mylog("hang_action", {desc = "hangBattle", short1 = msg.starNum > 0 and 1 or 0, int1 = carbonId, int2 = role:getProperty("hangTBV"), + cint1 = role:getHerosCamp(team.heros), cint2 = battleTime, key1 = role:getHerosLogStr(team.heros), key2 = role:getRewardLogStr(reward)}) SendPacket(actionCodes.Hang_endBattleRpc, MsgPack.pack({ starNum = msg.starNum, diff --git a/src/actions/HeroAction.lua b/src/actions/HeroAction.lua index 5ebf76e..bd4b47f 100644 --- a/src/actions/HeroAction.lua +++ b/src/actions/HeroAction.lua @@ -1040,6 +1040,7 @@ function _M.drawHeroRpc(agent, data) end end + local itemCount = 1 if role:isHaveHero(itemData.id - ItemStartId.Hero) then local fragId = itemData.id - ItemStartId.Hero local heroData = csvdb["unitCsv"][fragId] @@ -1047,6 +1048,7 @@ function _M.drawHeroRpc(agent, data) role:award({[fragId] = count}, {log = {desc = "drawHero", int1 = btype, int2 = poolId, short1=isFloorBack and 1 or 0}}) logReward[fragId] = (logReward[fragId] or 0) + count table.insert(reward, {id = fragId, count = count, from = itemId, fcount = 1}) + itemCount = count else role:award({[itemId] = 1}, {log = {desc = "drawHero", int1 = btype, int2 = poolId, short1=isFloorBack and 1 or 0}}) logReward[itemId] = (logReward[itemId] or 0) + 1 @@ -1064,6 +1066,10 @@ function _M.drawHeroRpc(agent, data) dailyDrawCnt = dailyDrawCnt + 1 role:checkTaskEnter("DrawHeroLimitPack", {count = dailyDrawCnt}) + + local ssrUpMap = role:getProperty("ssrUp") or {} + local ssrFloorCnt = ssrUpMap[poolId] or 0 + role:mylog("hero_action", {desc = "drawHero", int1=poolId, int2=btype, short1 = drawCount[drawType], cint1 = ssrFloorCnt, cint2 = itemId, cint3 = itemCount}) end role:award(drawAddReward, {log = {desc = "drawHero", int1 = btype}}) @@ -1099,7 +1105,7 @@ function _M.drawHeroRpc(agent, data) gacha_cnt = floorHeroCount, }) - role:mylog("hero_action", {desc = "drawHero", int1=poolId, int2=btype, short1 = drawCount[drawType]}) + --role:mylog("hero_action", {desc = "drawHero", int1=poolId, int2=btype, short1 = drawCount[drawType]}) SendPacket(actionCodes.Hero_drawHeroRpc, MsgPack.pack({reward = reward, subReward = drawAddReward})) -- 这个 reward 是数组 local feedbackId = buildTypeData["can_feedback"] or 0 diff --git a/src/actions/HttpAction.lua b/src/actions/HttpAction.lua index 09de159..43cabb0 100644 --- a/src/actions/HttpAction.lua +++ b/src/actions/HttpAction.lua @@ -143,6 +143,7 @@ function _M.gm_action(query) role:startActionUcode() local status = gmFuncs[query.cmd](role, query) role:endActionUcode() + role:update() return status end @@ -208,7 +209,14 @@ function _M.broadcast(query) msg["body"] = query.content msg["logout"] = query.logout end - } + }, + ["game"] = { + code = actionCodes.Sys_gameNotice, + exec = function() + msg["new"] = query.status + msg["channels"] = query.channels + end + }, } if not handle[query.cmd] then return "错误" end handle[query.cmd].exec() diff --git a/src/actions/PvpAction.lua b/src/actions/PvpAction.lua index 53e802d..6477a75 100644 --- a/src/actions/PvpAction.lua +++ b/src/actions/PvpAction.lua @@ -472,7 +472,8 @@ function _M.endBattleRpc(agent, data) reward = reward, rank = myRank, }) - role:mylog("pvp_action", {desc = "battleEnd", short1 = 1, int1 = isWin and 1 or 0, int2 = revenge and 1 or 0}) + role:mylog("pvp_action", {desc = "battleEnd", short1 = 1, int1 = isWin and 1 or 0, int2 = revenge and 1 or 0, cint1 = oldMyRank, cint2 = myRank, + cint3 = match.id, long1 = 1, key1 = msg.key, key2 = role:getHerosLogStr(role:getProperty("pvpTC").heros)}) _pvpBattleInfoCacheC = {} --重新发阵容了 没毛病 _pvpRecordInfoCacheC = {} -- 记录刷新了 @@ -578,7 +579,6 @@ function _M.startBattleHRpc(agent, data) if not revenge then -- 次数扣一波 - print("xxxxx") local pvpFreeH = role.dailyData:getProperty("pvpFreeH") if pvpFreeH >= globalCsv.pvp_battle_free_count_high then local cost = {[ItemId.PvpKey] = globalCsv.pvp_battle_high_cost} @@ -676,11 +676,13 @@ function _M.endBattleHRpc(agent, data) video = video, }) + local curStatus -- 检查是否结束战斗 local winCount, loseCount = 0, 0 for _, status in pairs(_pvpStartBattleCacheH.result) do if status.isWin then winCount = winCount + 1 + curStatus = true else loseCount = loseCount + 1 end @@ -696,6 +698,8 @@ function _M.endBattleHRpc(agent, data) return true end + local curHTeam = _pvpStartBattleCacheH.pvpTH[#_pvpStartBattleCacheH.result] or {} + if winCount >= 2 then isWin = true elseif loseCount >= 2 then @@ -720,6 +724,8 @@ function _M.endBattleHRpc(agent, data) video = video, -- 返回让客户端上传录像 headers = headers, })) + role:mylog("pvp_action", {desc = "battleEnd", short1 = 2, int1 = curStatus and 1 or 0, int2 = revenge and 1 or 0, cint1 = 0, cint2 = 0, + cint3 = match.id, long1 = #_pvpStartBattleCacheH.result, key1 = msg.key, key2 = role:getHerosLogStr(curHTeam.heros)}) return true end if revenge and isWin then @@ -814,6 +820,8 @@ function _M.endBattleHRpc(agent, data) rank = myRank, }) + role:mylog("pvp_action", {desc = "battleEnd", short1 = 2, int1 = curStatus and 1 or 0, int2 = revenge and 1 or 0, cint1 = oldMyRank, cint2 = myRank, + cint3 = match.id, long1 = #_pvpStartBattleCacheH.result, key1 = msg.key, key2 = role:getHerosLogStr(curHTeam.heros)}) _pvpBattleInfoCacheH = {} --重新发阵容了 没毛病 _pvpRecordInfoCacheH = {} -- 记录刷新了 @@ -825,7 +833,7 @@ function _M.endBattleHRpc(agent, data) if isWin then role:checkTaskEnter("PvpWin", {score = myScore}) end - role:mylog("pvp_action", {desc = "battleEnd", short1 = 2, int1 = isWin and 1 or 0, int2 = revenge and 1 or 0}) + SendPacket(actionCodes.Pvp_endBattleHRpc, MsgPack.pack({ reward = reward, diff --git a/src/actions/RoleAction.lua b/src/actions/RoleAction.lua index f0cb266..667b795 100644 --- a/src/actions/RoleAction.lua +++ b/src/actions/RoleAction.lua @@ -1216,7 +1216,7 @@ function _M.chatRpc(agent, data) [1] = function () if role:getProperty("silent") > now then --禁言 result = 1 - return + --return end if role:getProperty("level") < (globalCsv.chat_level or 15) then result = 3 @@ -1245,7 +1245,12 @@ function _M.chatRpc(agent, data) return end end - mcast_util.pub_world(actionCodes.Role_chat, MsgPack.pack(response)) + if result == 1 then + SendPacket(actionCodes.Role_chat, MsgPack.pack(response)) + result = 0 + else + mcast_util.pub_world(actionCodes.Role_chat, MsgPack.pack(response)) + end -- pcall(skynet.send, '.globald', "lua", "sendWorldMsg", role._channelIdx, response) role:mylog("role_action", {desc = "chatWorld", text1 = content}) end, @@ -1361,7 +1366,7 @@ function _M.drawCodeRpc(agent, data) gift_name = "", -- 礼包名称 gift_reason = 0, -- 礼包发放原因,见发放原因枚举表 }) - role:mylog("role_action", {desc = "drawCode", int1 = giftId, key1 = code}) + role:mylog("role_action", {desc = "drawCode", int1 = giftId, key1 = code, key2 = role:getRewardLogStr(result.gift)}) SendPacket(actionCodes.Role_drawCodeRpc, MsgPack.pack({ result = ret, reward = reward, diff --git a/src/actions/StoreAction.lua b/src/actions/StoreAction.lua index fc0eed2..da8dfcf 100644 --- a/src/actions/StoreAction.lua +++ b/src/actions/StoreAction.lua @@ -307,9 +307,11 @@ function _M.shopBuyRpc(agent , data) if not role:checkItemEnough(cost) then return 4 end + local limitStr = "" if dataSet.limit ~= 0 then buyRecord[id] = (buyRecord[id] or 0) + count role.storeData:updateProperty({field = "buyR", value = buyRecord}) + limitStr = string.format("%s/%s", buyRecord[id], dataSet.limit) end role:costItems(cost, {log = {desc = desc, int1 = id, int2 = count, short1 = dataSet.shop}}) @@ -333,7 +335,7 @@ function _M.shopBuyRpc(agent , data) shop_purchase_current = costCount or 0, -- 购买道具消耗的货币数量 shop_id = dataSet.shop, -- 商店ID }) - role:mylog("role_action", {desc = desc, int1 = id, int2 = count}) + role:mylog("role_action", {desc = "shopBuy", int1 = id, int2 = count, short1=dataSet.shop, key1 = limitStr}) SendPacket(actionCodes.Store_shopBuyRpc, MsgPack.pack({reward = reward})) return true end diff --git a/src/actions/TowerAction.lua b/src/actions/TowerAction.lua index 898b137..e32a95a 100644 --- a/src/actions/TowerAction.lua +++ b/src/actions/TowerAction.lua @@ -150,7 +150,11 @@ function _M.endBattleRpc(agent, data) rank = rank, tower = towerType + 1 }) - role:mylog("tower_action", {desc = "endBattle", short1 = msg.starNum > 0 and 1 or 0, int1 = id}) + local team = role:getTowerTeamFormat(towerType + 1) + + + role:mylog("tower_action", {desc = "endBattle", short1 = msg.starNum > 0 and 1 or 0, int1 = id, int2 = towerType, + cint1 = curLevel, key1 = role:getHerosLogStr(team.heros), key2 = role:getRewardLogStr(reward)}) SendPacket(actionCodes.Tower_endBattleRpc, MsgPack.pack({reward = reward, change = change})) return true diff --git a/src/adv/Adv.lua b/src/adv/Adv.lua index 7abca0a..35859a4 100644 --- a/src/adv/Adv.lua +++ b/src/adv/Adv.lua @@ -924,10 +924,11 @@ function Adv:over(success, rewardRatio, overType) end self:clearAdvUnlockCache() - self:mylog({desc = "over", short1 = success and 1 or 0, int1 = overType, int2 = self.chapterId, long1 = self.level}) + local team = self.owner:getProperty("advTeam") + self:mylog({desc = "over", short1 = success and 1 or 0, int1 = overType, int2 = self.chapterId, long1 = self.level, + key1 = self.owner:getRewardLogStr(reward), key2 = self.owner:getHerosLogStr(team.heros)}) - local team = self.owner:getProperty("advTeam") local player = {} local attrs = self.owner:getTeamBattleInfo(team).heros for _, hero in pairs(attrs) do diff --git a/src/csvdata b/src/csvdata index 8e6c36f..4d89427 160000 --- a/src/csvdata +++ b/src/csvdata @@ -1 +1 @@ -Subproject commit 8e6c36f6d7a90dbec06c5a28d8538b80a65ca910 +Subproject commit 4d894270d4aeb6352a29dfd3a8686cbaea5b427c diff --git a/src/models/Email.lua b/src/models/Email.lua index bb7d710..121981c 100644 --- a/src/models/Email.lua +++ b/src/models/Email.lua @@ -33,6 +33,8 @@ function Email:log(role, action) mail_friend_id = 0, -- 收件方账号id mail_friend_roleid = 0, -- 收件方角色id }) + role:mylog("mail_action", {desc = "onMail", int1 = self:getProperty("id"), int2 = self:getProperty("status"), cint1 = self:getProperty("emailId"), + short1 = action, key1=self:getProperty("title"), key2=self:getProperty("attachments")}) end function Email:data() diff --git a/src/models/Role.lua b/src/models/Role.lua index 7561a96..242fb79 100644 --- a/src/models/Role.lua +++ b/src/models/Role.lua @@ -8,6 +8,7 @@ local RoleChangeStruct = import(".RoleChangeStruct") --角色数据额结构更 local RolePvp = import(".RolePvp") -- pvp local RoleCross = import(".RoleCross") -- 跨服务请求相关 local RoleBattle = import(".RoleBattle") -- 跨服务请求相关 +local mysqlproxy = require "shared.mysqlproxy" RoleLog.bind(Role) RolePlugin.bind(Role) @@ -56,6 +57,7 @@ Role.schema = { lday = {"number", 0}, banTime = {"number", 0}, banType = {"number", 0}, + banReason = {"string", "", "", 512}, heartWarning = {"number", 0}, cheatCount = {"number", 0}, ltime = {"number", 0}, -- 最后登录时间 @@ -79,6 +81,7 @@ Role.schema = { -- loveStatus = {"string", ""}, --统计角色的最高 好感度等级 类型相关 -- type=loveL type=loveL crown = {"number", 0}, -- 看伴娘 silent = {"number", 0}, --禁言解禁时间 + silentType = {"number", 0}, -- 禁言类型 timeGift = {"number", 0}, -- 创建角色时间礼包 bagLimit = {"table", globalCsv.store_limit_max}, @@ -345,6 +348,7 @@ end function Role:data() return { id = self:getProperty("id"), + uid = self:getProperty("uid"), name = self:getProperty("name"), intro = self:getProperty("intro"), headId = self:getProperty("headId"), @@ -358,7 +362,8 @@ function Role:data() timeReset = self:getProperty("timeReset"), diamond = self:getAllDiamond(), bagLimit = self:getProperty("bagLimit"), - silent = self:getProperty("silent"), + --silent = self:getProperty("silent"), + silent = 0, timeGift = self:getProperty("timeGift"), advPass = self:getProperty("advPass"), diff --git a/src/models/RoleLog.lua b/src/models/RoleLog.lua index 9d0f051..92ed3d8 100644 --- a/src/models/RoleLog.lua +++ b/src/models/RoleLog.lua @@ -63,6 +63,7 @@ local ItemReason = { giftTime = 147, -- 创角后的时间礼包 activityCrisis = 148, -- 物资危机奖励 glodConvertRune = 149, -- 金币兑换铭文 + shopBuy = 150, -- 商店购买 advHang = 301, -- 拾荒挂机 hangBattle = 302, -- 挂机战斗 diff --git a/src/models/RolePlugin.lua b/src/models/RolePlugin.lua index dfb853e..025e26b 100644 --- a/src/models/RolePlugin.lua +++ b/src/models/RolePlugin.lua @@ -1,6 +1,7 @@ local httpc = require("http.httpc") local md5 = require "md5" local cjson = require "shared.json" +local mysqlproxy = require "shared.mysqlproxy" local serverId = tonumber(skynet.getenv("servId")) local RolePlugin = {} @@ -337,6 +338,8 @@ function RolePlugin.bind(Role) end log["cint1"] = params.id log["cint2"] = math.abs(params.count) + log["cint3"] = nums + log["long1"] = origin if params.count <= 0 then self:mylog("out_item", log) else @@ -377,6 +380,8 @@ function RolePlugin.bind(Role) end log["cint1"] = params.itemId log["cint2"] = math.abs(params.count) + log["cint3"] = nums + log["long1"] = origin if params.count <= 0 then self:mylog("out_item", log) else @@ -494,6 +499,7 @@ function RolePlugin.bind(Role) end log["cint1"] = origin log["cint2"] = count + log["cint3"] = origin + count self:mylog("in_diamond", log) else print("gainDiamond no log ", debug.traceback()) @@ -547,6 +553,7 @@ function RolePlugin.bind(Role) end log["cint1"] = origin log["cint2"] = count + log["cint3"] = origin - count self:mylog("out_diamond", log) else print("costDiamond no log ", debug.traceback()) @@ -905,7 +912,8 @@ function RolePlugin.bind(Role) end log["cint1"] = sparkUid - log["cint2"] = params.cfg_id + log["cint2"] = params.id + log["cint3"] = 0 self:mylog("in_spark", log) else @@ -935,6 +943,7 @@ function RolePlugin.bind(Role) log["cint1"] = sparkId log["cint2"] = spark:getProperty("cfg_id") + log["cint3"] = spark:getProperty("level") self:mylog("out_spark", log) else @@ -1144,6 +1153,38 @@ function RolePlugin.bind(Role) -- return result -- end + function Role:getRewardLogStr(gift) + if not gift then return '' end + local tgift = {} + if type(gift) == "string" then + for _, one in pairs(gift:toTableArray(true)) do + tgift[one[1]] = (tgift[one[1]] or 0) + one[2] + end + else + tgift = gift + end + local t = {} + for k, v in pairs(tgift) do + local name = csvdb['itemCsv'][k].name + table.insert(t, string.format("%s*%s", name, v)) + end + return table.concat(t, ',') + end + + function Role:getHerosLogStr(heros) + local t = {} + for _, id in pairs(heros or {}) do + local hero = self.heros[id] + if hero then + local name = csvdb["unitCsv"][hero:getProperty("type")].name + local level = hero:getProperty("level") + local wakeL = hero:getProperty("wakeL") + table.insert(t, string.format("%s(%s %s)", name,level,wakeL)) + end + end + return table.concat(t, ',') + end + function Role:getHerosCamp(heros) local had = {} for _, id in pairs(heros or {}) do diff --git a/src/models/RoleTask.lua b/src/models/RoleTask.lua index a7a6595..689c08b 100644 --- a/src/models/RoleTask.lua +++ b/src/models/RoleTask.lua @@ -487,6 +487,7 @@ function RoleTask.bind(Role) if status[taskId] ~= -1 and data.type == stype and (data.condition2 == 0 or data.condition2 == cond1) then status[taskId] = (status[taskId] or 0) + count isChange[key] = 1 + self:mylog("role_action", {desc = "onTask", int1 = taskId, int2 = status[taskId], short1 = key, cint1 = data.condition1}) end end end @@ -612,6 +613,9 @@ function RoleTask.bind(Role) end end if next(change) then + for _, info in ipairs(change) do + self:mylog("role_action", {desc = "onTask", int1 = info.field, int2 = info.value, short1 = 3, cint1 = 0}) + end self:changeUpdates(change, notNotify) end end diff --git a/src/shared/ModelBaseMysql.lua b/src/shared/ModelBaseMysql.lua index 3ecbf68..581dc2e 100644 --- a/src/shared/ModelBaseMysql.lua +++ b/src/shared/ModelBaseMysql.lua @@ -2,6 +2,8 @@ local ModelBaseMysql = class("ModelBaseMysql") ModelBaseMysql.key = "key" ModelBaseMysql.schema = {} +local mysqlproxy = require "shared.mysqlproxy" + local string_format = string.format local table_insert = table.insert local table_unpack = table.unpack -- libgit2 0.21.2