Commit 1863d5405d45f1b7744a7d6c4de535ce6d66db72

Authored by liuzujun
2 parents 93f6e69b a7b824ac

fix conflict

src/actions/AdvAction.lua
... ... @@ -489,6 +489,10 @@ function _M.useItemRpc(agent, data)
489 489 adv:backUse({[itemId] = count})
490 490 end
491 491  
  492 + if itemId == 5020 then
  493 + role:finishGuide(53)
  494 + end
  495 +
492 496 adv:checkAchievement(adv.AchievType.UseItem, count, itemId)
493 497 adv:log({desc = "useItem", int1 = itemId, int2 = count})
494 498  
... ... @@ -538,6 +542,8 @@ function _M.usePotionRpc(agent, data)
538 542 adv:saveDB()
539 543 role:checkTaskEnter("AdvUsePotion")
540 544  
  545 + role:finishGuide(61)
  546 +
541 547 SendPacket(actionCodes.Adv_usePotionRpc, MsgPack.pack({events = adv:popBackEvents()}))
542 548 return true
543 549 end
... ... @@ -555,6 +561,8 @@ function _M.chooseArtifactRpc(agent, data)
555 561 local status = adv:chooseArtifact(msg.idx)
556 562 if not status then return 4 end
557 563 adv:saveDB()
  564 +
  565 + role:finishGuide(54)
558 566  
559 567 SendPacket(actionCodes.Adv_chooseArtifactRpc, '')
560 568 return true
... ... @@ -578,6 +586,8 @@ function _M.wearArtifactRpc(agent, data)
578 586 if not status then return 3 end
579 587 adv:saveDB()
580 588  
  589 + role:finishGuide(55)
  590 +
581 591 SendPacket(actionCodes.Adv_wearArtifactRpc, '')
582 592 return true
583 593 end
... ... @@ -607,6 +617,7 @@ function _M.upArtifactRpc(agent, data)
607 617 else
608 618 adv:updateAchievement()
609 619 end
  620 +
610 621 SendPacket(actionCodes.Adv_upArtifactRpc, '')
611 622 return true
612 623 end
... ... @@ -616,7 +627,9 @@ function _M.exitAdvRpc(agent, data)
616 627 local role = agent.role
617 628 -- local msg = MsgPack.unpack(data)
618 629 if not isCanContinue(role) then return end
619   -
  630 + if not role:checkOverGuide(57) then
  631 + role:saveGuide(57,1,true)
  632 + end
620 633 local adv = role:getAdvData()
621 634 adv:log({desc = "exit"})
622 635 local status = adv:exit() -- target {roomId = 1, blockId = 1} 选择的目标
... ... @@ -677,6 +690,19 @@ function _M.endBattleRpc(agent, data)
677 690 if enemy.monsterId ~= monsterId or enemy.roomId ~= roomId or enemy.blockId ~= blockId then return end
678 691 adv.__battleCache = nil
679 692  
  693 + -- 打完野猪怪
  694 + role:finishGuide(52)
  695 + -- 调理剂使用引导(生命药剂)
  696 + if not role:checkOverGuide(61) then
  697 + local potionBag = role:getProperty("potionBag")
  698 + local own = potionBag[10] or 0
  699 + if own > 0 then
  700 + -- 造假
  701 + player.hp = player.hp * 0.8
  702 + role:saveGuide(61,1,true)
  703 + end
  704 + end
  705 +
680 706 adv:log({desc = "endBattle"})
681 707 local status = adv:clickBlock(roomId, blockId, {player = player, bySkill = bySkill})
682 708  
... ... @@ -759,7 +785,7 @@ function _M.wheelSurfRpc(agent, data)
759 785 table.insert(backReward, gift)
760 786 end
761 787 role:award(reward, {log = {desc = "advWheelSurf", int1 = ptype}})
762   -
  788 + role:finishGuide(58)
763 789 role:checkTaskEnter("AdvDraw", {count = count, ptype = ptype})
764 790 role:log("adv_action", {desc = "advWheelSurf", int1 = ptype, int2 = count})
765 791  
... ... @@ -814,7 +840,7 @@ function _M.finishAchievRpc(agent, data)
814 840 if not status then return end
815 841 adv:updateAchievement()
816 842 role:log("adv_action", {desc = "finishAchiev", short1 = ctype, int1 = chapterId, int2 = taskId})
817   -
  843 + role:finishGuide(57)
818 844 SendPacket(actionCodes.Adv_finishAchievRpc, MsgPack.pack(role:packReward(reward, change)))
819 845 return true
820 846 end
... ...
src/actions/DinerAction.lua
... ... @@ -104,7 +104,7 @@ function _M.addSellRpc( agent, data )
104 104 if change then
105 105 role.dinerData:updateProperty({field = "customer", value = customer})
106 106 end
107   -
  107 + role:finishGuide(28)
108 108 role:log("diner_action", {desc = "addSell", int1 = dish, int2 = count})
109 109  
110 110 role.dinerData:updateProperty({field = "sells", value = json.encode(sells)})
... ... @@ -407,7 +407,7 @@ function _M.talentUpRpc( agent, data )
407 407 -- end
408 408  
409 409 role:checkTaskEnter("DinerTalentUp", {type = talentData.effect:toArray(true,"=")[1], level = dishLevel + 1})
410   -
  410 + role:finishGuide(27)
411 411 role:log("diner_action", {desc = "talentUp", int1 = dish, int2 = dishLevel + 1})
412 412  
413 413 SendPacket(actionCodes.Diner_talentUpRpc, '')
... ... @@ -612,7 +612,7 @@ function _M.refreshTaskRpc( agent, data )
612 612 end
613 613  
614 614 role:log("diner_action", {desc = "reTask"})
615   -
  615 + role:finishGuide(41)
616 616 role.dinerData:updateProperty({field = "order", value = json.encode(orders)})
617 617  
618 618 SendPacket(actionCodes.Diner_refreshTaskRpc, '')
... ... @@ -653,7 +653,7 @@ function _M.addWantFoodRpc(agent , data)
653 653 end
654 654  
655 655 role:log("diner_action", {desc = "wantFood"})
656   -
  656 + role:finishGuide(36)
657 657 role.dinerData:updateProperty({field = "gfood", value = gfood})
658 658  
659 659 SendPacket(actionCodes.Diner_addWantFoodRpc, '')
... ... @@ -832,6 +832,8 @@ function _M.entrustRpc(agent , data)
832 832  
833 833 role:log("diner_action", {desc = "entrus", short1 = ctype, int1 = entrustId})
834 834  
  835 + role:finishGuide(26)
  836 +
835 837 SendPacket(actionCodes.Diner_entrustRpc, MsgPack.pack({reward = reward, change = change}))
836 838 return true
837 839 end
... ...
src/actions/EmailAction.lua
... ... @@ -53,7 +53,6 @@ function _M.listRpc(agent, data)
53 53 content = email.content,
54 54 attachments = email.attachments
55 55 })
56   - role:log("mail_action", {desc = "get_global", key1 = email.title, key2 = email.attachments})
57 56 end
58 57 end
59 58 end
... ... @@ -90,21 +89,17 @@ function _M.drawAllAttachRpc(agent, data)
90 89 local ids = {}
91 90  
92 91 local emails = loadEmails(roleId)
93   - redisproxy:pipelining(function (red)
94   - for _, email in ipairs(emails) do
95   - local attachments = getEmailAttachments(email)
96   - if attachments ~= "" then
97   - local emailId = email:getProperty("id")
98   - ids[emailId] = 1
99   - red:hset(string.format(R_EMAIL_ITEM, roleId, emailId), "status", 2)
100   - role:log("mail_action", {desc = "draw_attach", int1 = emailId, key1 = email:getProperty("title"), key2 = attachments})
101   -
102   - for key, v in pairs(attachments:toNumMap()) do
103   - reward[key] = (reward[key] or 0) + v
104   - end
  92 + for _, email in ipairs(emails) do
  93 + local attachments = getEmailAttachments(email)
  94 + if attachments ~= "" then
  95 + email:setProperty("status", 2)
  96 + email:log(role, 2)
  97 + ids[emailId] = 1
  98 + for key, v in pairs(attachments:toNumMap()) do
  99 + reward[key] = (reward[key] or 0) + v
105 100 end
106 101 end
107   - end)
  102 + end
108 103 reward, change = role:award(reward, {log = {desc = "draw_attach"}})
109 104 SendPacket(actionCodes.Email_drawAllAttachRpc, MsgPack.pack({ids = ids, reward = reward, change = change}))
110 105 return true
... ... @@ -125,10 +120,10 @@ function _M.drawAttachRpc(agent, data)
125 120 if attachments == "" then return end
126 121  
127 122 local reward, change = role:award(attachments, {log = {desc = "draw_attach", int1 = emailId, key1 = email:getProperty("title")}})
128   - redisproxy:hset(rds, "status", 2) -- 领取标记
  123 + email:setProperty("status", 2)
  124 + email:log(role, 2)
129 125 SendPacket(actionCodes.Email_drawAttachRpc, MsgPack.pack({reward = reward, change = change}))
130 126  
131   - role:log("mail_action", {desc = "draw_attach", int1 = id, key1 = email:getProperty("title"), key2 = attachments})
132 127 return true
133 128 end
134 129  
... ... @@ -139,11 +134,11 @@ function _M.checkRpc(agent, data)
139 134 local msg = MsgPack.unpack(data)
140 135 local id = msg.id
141 136  
142   - local rds = string.format(R_EMAIL_ITEM, roleId, id)
143   - if not redisproxy:exists(rds) then return end
  137 + local email = require("models.Email").new({key = rds})
  138 + if not email:load() then return end
144 139  
145   - redisproxy:hset(rds, "status", 1)
146   - role:log("mail_action", {desc = "check_mail", int1 = id})
  140 + email:setProperty(rds, "status", 1)
  141 + email:log(role, 1)
147 142  
148 143 SendPacket(actionCodes.Email_checkRpc, '')
149 144 return true
... ... @@ -171,6 +166,7 @@ function _M.delRpc(agent, data)
171 166 attachments = emailData.attachment
172 167 end
173 168 if status == 2 or (status == 1 and attachments:len() == 0) then
  169 + email:log(role, 3)
174 170 red:lrem(rds, 0, id)
175 171 red:del(emailRds)
176 172 result[tonum(id)] = 1
... ... @@ -178,9 +174,6 @@ function _M.delRpc(agent, data)
178 174 end
179 175 end
180 176 end)
181   - for delId, _ in ipairs(result) do
182   - role:log("mail_action", {desc = "del_mail", int1 = delId})
183   - end
184 177 SendPacket(actionCodes.Email_delRpc, MsgPack.pack({result = result}))
185 178 return true
186 179 end
... ...
src/actions/HangAction.lua
... ... @@ -250,6 +250,23 @@ function _M.endBattleRpc(agent, data)
250 250 local team = role:getProperty("pvpTC")
251 251 role:log("hang_action", {desc = "hangBattle", short1 = msg.starNum > 0 and 1 or 0, int1 = carbonId, int2 = role:getProperty("hangTBV"), cint1 = role:getHerosCamp(team.heros)})
252 252  
  253 + -- 引导
  254 + if carbonId == 10101 then
  255 + role:finishGuide(5)
  256 + elseif carbonId == 10102 then
  257 + role:finishGuide(8)
  258 + elseif carbonId == 10103 then
  259 + role:finishGuide(9)
  260 + elseif carbonId == 10220 then
  261 + role:finishGuide(22)
  262 + end
  263 + for _, guideData in pairs(csvdb["guide_unlockCsv"]) do
  264 + if guideData.type == 3 and guideData.carbonId == carbonId then
  265 + role:saveGuide(guideData.guideId,1,true)
  266 + break
  267 + end
  268 + end
  269 +
253 270 SendPacket(actionCodes.Hang_endBattleRpc, MsgPack.pack({
254 271 starNum = msg.starNum,
255 272 reward = reward,
... ...
src/actions/HeroAction.lua
... ... @@ -32,6 +32,10 @@ function _M.levelUpRpc( agent, data )
32 32  
33 33 hero:log({desc = "levelUp", int1 = hero:getProperty("level")})
34 34  
  35 + if hero:getProperty("type") == 103 then
  36 + role:finishGuide(7)
  37 + end
  38 +
35 39 role:checkTaskEnter("HeroLevelUp", {level = hero:getProperty("level")})
36 40 SendPacket(actionCodes.Hero_levelUpRpc, '')
37 41 return true
... ... @@ -523,6 +527,8 @@ function _M.referEquipsRpc(agent, data)
523 527 -- 更新角色
524 528 hero:updateProperty({field = "equip", value = curEquip})
525 529  
  530 + role:finishGuide(23)
  531 +
526 532 SendPacket(actionCodes.Hero_referEquipsRpc, "")
527 533 return true
528 534 end
... ... @@ -688,7 +694,6 @@ function _M.unuse_drawHeroRpc(agent, data)
688 694 if not role:isFuncUnlock(FuncUnlock.GetHero) then return end
689 695 local btype = msg.pool -- 1 2 3 4
690 696 local drawType = msg.type -- 1 单抽 2 十连
691   - local guide = msg.guide -- 是否是引导抽的
692 697  
693 698 local buildTypeData = csvdb["build_typeCsv"][btype]
694 699 if not buildTypeData then return 1 end
... ... @@ -829,6 +834,12 @@ function _M.unuse_drawHeroRpc(agent, data)
829 834 newerHadSSR = newerDraw[2] or 0
830 835 end
831 836  
  837 + local guideHero
  838 + local funcGuide = role:getProperty("funcGuide")
  839 + if funcGuide:getv(11001,0) == 1 and funcGuide:getv(12001,0) == 0 then
  840 + guideHero = 613
  841 + end
  842 +
832 843 local ssrCount = 0
833 844 local reward = {}
834 845 for i = 1, drawCount[drawType] do
... ... @@ -858,7 +869,11 @@ function _M.unuse_drawHeroRpc(agent, data)
858 869 end
859 870  
860 871 -- 引导必送 613 丝路德
861   - local itemId = guide and 613 or math.randWeight(resultPool, 1)
  872 + local itemId = math.randWeight(resultPool, 1)
  873 + if guideHero then
  874 + itemId = guideHero
  875 + guideHero = nil
  876 + end
862 877 local itemData = csvdb["itemCsv"][itemId]
863 878 if itemData.quality == 4 then
864 879 ssrCount = ssrCount + 1
... ... @@ -910,6 +925,8 @@ function _M.unuse_drawHeroRpc(agent, data)
910 925 -- role:updateProperty({field = "repayHero", value = repayHero})
911 926 -- end
912 927  
  928 + role:finishGuide(11)
  929 +
913 930 role:checkTaskEnter("DrawHero", {pool = btype, count = drawCount[drawType]})
914 931 if ssrCount > 0 then
915 932 role:checkTaskEnter("DrawSSR", {count = ssrCount})
... ...
src/actions/RoleAction.lua
... ... @@ -99,6 +99,29 @@ function _M.loginRpc( agent, data )
99 99 role:reloadWhenLogin()
100 100 end
101 101  
  102 +
  103 + role.sysVersion = msg.sysVersion
  104 + role.ip = agent.ip:toArray(false, ":")[1]
  105 + role.clientVersion = msg.clientVersion
  106 + role.network = msg.network
  107 +
  108 + if msg.subId then
  109 + role:setProperty("sid", msg.subId)
  110 + end
  111 +
  112 + if msg.deviceMode then
  113 + local deviceMode = tostring(msg.deviceMode)
  114 + if role:getProperty("dmode") ~= deviceMode then
  115 + role:setProperty("dmode", deviceMode)
  116 + end
  117 + end
  118 + if msg.device then
  119 + local device = tostring(msg.device)
  120 + if role:getProperty("device") ~= device then
  121 + role:setProperty("device", device)
  122 + end
  123 + end
  124 +
102 125 if not msg.isGMlogin then
103 126 local banTime = role:getProperty("banTime")
104 127 if banTime > now then
... ... @@ -114,6 +137,7 @@ function _M.loginRpc( agent, data )
114 137 role:setBan(0)
115 138 end
116 139 end
  140 +
117 141 if msg.deviceMode then
118 142 local deviceMode = tostring(msg.deviceMode)
119 143 if role:getProperty("dmode") ~= deviceMode then
... ... @@ -266,7 +290,7 @@ function _M.loginRpc( agent, data )
266 290 role:savePvpHTeam()
267 291  
268 292 local hangPass = role:getProperty("hangPass")
269   - role:log("login", {key1 = agent.ip:toArray(false, ":")[1], int1 = hangPass[1] or 0})
  293 + role:log("onLogin")
270 294  
271 295 return true
272 296 end
... ... @@ -314,11 +338,20 @@ function _M.createRpc(agent, data)
314 338 return true
315 339 end
316 340 newRole:startActionUcode()
  341 + newRole.sysVersion = msg.sysVersion
  342 + newRole.ip = agent.ip:toArray(false, ":")[1]
  343 + newRole.clientVersion = msg.clientVersion
  344 + newRole.network = msg.network
  345 +
317 346 newRole:award(globalCsv.birthItem, {log = {desc = "birth"}, notNotify = true})
318 347 -- 欢迎邮件
319 348 redisproxy:insertEmail({roleId = roleId, emailId = 1})
320 349  
321   - newRole:log("create", {key1 = agent.ip:toArray(false, ":")[1]})
  350 + if msg.newuser then
  351 + newRole:log("onCreateAccount")
  352 + end
  353 + newRole:log("onCreateRole")
  354 +
322 355  
323 356 SendPacket(actionCodes.Role_createRpc, MsgPack.pack(response))
324 357 return true
... ... @@ -1002,17 +1035,15 @@ function _M.guideRpc(agent, data)
1002 1035 local cmdType = msg.cmdType
1003 1036  
1004 1037 local funcGuide = role:getProperty("funcGuide")
1005   - local newerGuide = role:getProperty("newerGuide")
1006 1038 if cmdType == 1 then
1007 1039 -- 新手引导
1008 1040 local master = msg.master or -1
1009 1041 local slave = msg.slave or -1
1010 1042 if master < 0 or slave < 0 then return end
1011   - newerGuide = string.format("%d=%d",master,slave)
1012   - role:updateProperty({field = "newerGuide", value = newerGuide})
1013   - role:log("guide", {desc = "guide_new",int1 = master*1000+slave})
  1043 +
  1044 + role:saveGuide(master, slave)
1014 1045 elseif cmdType == 2 then
1015   - -- 系统引导
  1046 + -- 系统引导(玩家可选择是否进行)
1016 1047 if not msg.skip then return end
1017 1048 local new = math.min(funcGuide:getv(0, 0), msg.skip)
1018 1049 if new < 0 then
... ... @@ -1023,15 +1054,23 @@ function _M.guideRpc(agent, data)
1023 1054  
1024 1055 if msg.funcType then
1025 1056 funcGuide = funcGuide:setv(msg.funcType, 1)
1026   - role:log("guide", {desc = "guide_sys", int1 = msg.funcType})
  1057 + role:log("onGuidePoint", {guild_type = 2, guild_id = msg.funcType, guild_point = 0, guild_pass = 0})
1027 1058 end
1028 1059 role:updateProperty({field = "funcGuide", value = funcGuide})
1029 1060 elseif cmdType == 3 then
1030   - -- 弱引导
  1061 + -- 系统引导(强制进行)
  1062 + if msg.funcType and csvdb["guide_unlockCsv"][msg.funcType] then
  1063 + role:saveGuide(csvdb["guide_unlockCsv"][msg.funcType].guideId,1)
  1064 + funcGuide = funcGuide:setv(msg.funcType, 1)
  1065 + role:updateProperty({field = "funcGuide", value = funcGuide})
  1066 + role:log("onGuidePoint", {guild_type = 1, guild_id = msg.funcType, guild_point = 0, guild_pass = 0})
  1067 + end
  1068 + elseif cmdType == 4 then
  1069 + -- 弹出一个tips(进入功能界面也许要自动弹说明,value要区分1、2)
1031 1070 if msg.funcType then
1032 1071 local value = msg.value or 1
1033 1072 for _, funcIdx in pairs(msg.funcType:toArray(true,"=")) do
1034   - role:log("guide", {desc = "guide_weak", int1 = funcIdx})
  1073 + role:log("onGuidePoint", {guild_type = 3, guild_id = funcIdx, guild_point = 0, guild_pass = 0})
1035 1074 funcGuide = funcGuide:setv(funcIdx, value)
1036 1075 end
1037 1076 role:updateProperty({field = "funcGuide", value = funcGuide})
... ...
src/actions/StoreAction.lua
... ... @@ -31,6 +31,7 @@ function _M.rechargeRpc(agent , data)
31 31 local partnerOrderId = makeOrder(roleId, id)
32 32 SendPacket(actionCodes.Store_rechargeRpc, MsgPack.pack({ order = partnerOrderId }))
33 33  
  34 +
34 35 -- 测试的 直接发奖励了
35 36 skynet.timeout(10, function ()
36 37 role:handlePurchase({
... ... @@ -164,6 +165,22 @@ function _M.purchaseOrderResult(agent, data)
164 165  
165 166 if msg.status == "success" then
166 167 orderObject:setProperty("transactionId", msg.platformOrder or "")
  168 + local rechargeId = orderObject:getProperty("rechargeId")
  169 + local dataSet = csvdb["shop_rechargeCsv"][rechargeId]
  170 +
  171 + role:log("setOrder", {
  172 + order_status = 100, -- "订单状态:100 - 开始下单(玩家还未开始付费行为记录)200 - 支付完成并发货(SDK通知可以发货时记录),300 - 订单被取消,1000 - 其他"
  173 + item_id = rechargeId, -- 道具id
  174 + item_type = dataSet.type, -- 购买的道具类型,具体见"onItems"方法中道具类型枚举表
  175 + item_name = dataSet.title, -- 购买的道具名
  176 + item_number = 1, -- 购买的道具数量
  177 + item_level = 1, -- 购买的道具等级
  178 + order_cost = dataSet.rmb * 100, -- 此次消费的现金金额(单位:分),如 51800即未518元,对应客户端SDK传入的'total_fee'
  179 + order_currency = "CNY", -- 货币类型,默认为"CNY"(人民币),遵循ISO 4217规范
  180 + order_type = self.getProperty("rmbC") > 0 and 0 or 1, -- 订单类型,首充记录为1,否则为0
  181 + order_id = msg.platformOrder, -- 本条记录的订单号,对应客户端SDK返回的'bs_trade_no'
  182 + })
  183 +
167 184 return true
168 185 end
169 186  
... ...
src/adv/Adv.lua
... ... @@ -1357,6 +1357,10 @@ local function clickDrop(self, room, block, params)
1357 1357  
1358 1358 local reward = self:award({[block.event.item[1]] = block.event.item[2]}, {log = {desc = "clickDrop"}})
1359 1359 -- local reward = self:award({[5801] = 1})
  1360 + -- 获取绷带的引导
  1361 + if block.event.item[1] == 5020 and not self.owner:checkOverGuide(53,2) then
  1362 + self.owner:saveGuide(53,2)
  1363 + end
1360 1364 block:clear()
1361 1365 self:backReward(reward, {roomId = room.roomId, blockId = block.blockId})
1362 1366 return true
... ...
src/agent.lua
... ... @@ -282,7 +282,7 @@ function CMD.close()
282 282 mcast_util.usub_union()
283 283 local role = agentInfo.role
284 284 if not role then return end
285   - role:log("logout", {int1 = skynet.timex()-role:getProperty("ltime")})
  285 + role:log("onLogout", {logtime = skynet.timex()-role:getProperty("ltime")})
286 286 role:onOfflineEvent()
287 287 end
288 288  
... ...
src/models/Diner.lua
... ... @@ -70,12 +70,10 @@ function Diner:refreshDailyData(notify)
70 70 end
71 71 end
72 72  
73   - local guide = self.owner:getProperty("newerGuide")
74   - local master, slave = string.match(guide,"(%d+)=(%d+)")
75   - if self.owner:getProperty("funcGuide"):getv(51,0) == 0 or tonumber(master) <= 26 then
  73 + if self.owner:checkOverGuide(26) and not self.owner:checkOverGuide(27) then
76 74 entrust[1] = 1001
77 75 entrust[2] = 1
78   - elseif tonumber(master) <= 29 then
  76 + elseif self.owner:checkOverGuide(29) then
79 77 local temp = entrust[1]
80 78 entrust[1] = 1
81 79 entrust[2] = temp
... ...
src/models/Email.lua
... ... @@ -18,6 +18,23 @@ Email.schema = {
18 18 rewardPms = {"table", {}},
19 19 }
20 20  
  21 +function Email:log(role, action)
  22 + role:log("onMail", {
  23 + mail_action_type = action, -- 操作(1=收,2=领,3=删)
  24 + mail_receivetime = self:getProperty("createtime"), -- 收件时间
  25 + mail_textid = self:getProperty("emailId"), -- 邮件文本ID
  26 + mial_title = self:getProperty("title"), -- 邮件标题参数
  27 + mail_content = json.encode(self:getProperty("contentPms")), -- 邮件内容参数
  28 + mail_attach = self:getProperty("attachments"), -- 邮件附件
  29 + mail_reason = self:getProperty("stitle"), -- 原因
  30 + mail_readstatus = self:getProperty("status") >= 1 and 1 or 0, -- 邮件读取状态
  31 + mail_attachstatus = self:getProperty("status") >= 2 and 1 or 0, -- 邮件附件状态
  32 + mail_timeout = 0, -- 邮件超时时间
  33 + mail_friend_id = 0, -- 收件方账号id
  34 + mail_friend_roleid = 0, -- 收件方角色id
  35 + })
  36 +end
  37 +
21 38 function Email:data()
22 39 local emailId = self:getProperty("emailId")
23 40 local title = self:getProperty("title")
... ...
src/models/RoleLog.lua
  1 +local server_id = (skynet.getenv("serverType") or "localtest") .. "_" .. skynet.getenv("servId")
1 2  
2   --- logType
3   -local LogType = {
4   - create = "common",
5   - login = "common",
6   - logout = "common",
7   - guide = "common",
  3 +--[[
  4 + 100 购买/兑换行为
  5 + 200 交易行为(与其他玩家)
  6 + 300 通过关卡产出或消耗
  7 + 400 通过任务产出或消耗
  8 + 500 通过公会产出或消耗
  9 + 600 通过成就产出或消耗
  10 + 700 通过邮件产出或消耗
  11 + 1000 其他行为
  12 +--]]
  13 +local ItemReason = {
  14 + recharge = 100,
  15 + advWheelSurf = 101, -- 资助
  16 + advRepayWheelSurf = 102, -- 资助回馈
  17 + saleEquip = 103, -- 卖装备
  18 + saleRune = 104, -- 卖铭文
  19 + drawHero = 105, -- 抽卡
  20 + pvpShop = 106, -- pvp商店
  21 + saleItem = 107, -- 售卖道具
  22 + openItem = 108, -- 打开箱子
  23 + openTimeBox = 109, -- 打开时间箱
  24 + speedUpBox = 110, -- 速度箱
  25 + dailyShop = 111, -- 每日商城
  26 + dinershop = 112, -- 餐厅商店
  27 + goldBuy = 113, -- 购买金币
  28 + buyAdvCount = 114, -- 购买冒险次数
  29 + advReSupport = 115, -- 刷新拾荒支援技
  30 + advQuickHang = 116, -- 冒险快速挂机
  31 + makePotion = 117, -- 制造药剂
  32 + equipUp = 118, -- 装备升级
  33 + runeUp = 119, -- 符文升级
  34 + talentUp = 120, -- 天赋升级
  35 + buyBonusCount = 121, -- 购买奖励副本次数
  36 + bagField = 122, -- 背包栏位
  37 + buyPvpKey = 123, -- 购买pvp钥匙
  38 + startPvp = 124, -- 开始pvp
  39 + unlockStory = 125, -- 解锁剧情
  40 + towerCount = 126, -- 电波塔次数
  41 +
  42 +
  43 + advHang = 301, -- 拾荒挂机
  44 + hangBattle = 302, -- 挂机战斗
  45 + hangReward = 303, -- 挂机奖励
  46 + quickHang = 304, -- 快速挂机
  47 + bonusBattle = 305, -- 奖励副本
  48 + hangGift = 306, -- 奖励关卡奖励
  49 + pvpBattleC = 307, -- pvp战斗普通
  50 + pvpBattleH = 308, -- pvp战斗高级
  51 + pvpDivisionH = 309, -- pvp高级段位奖励
  52 + towerBattle = 310, -- 电波塔战斗
  53 + advOver = 311, -- 冒险结算
  54 + advUnlock = 312, -- 拾荒解锁
8 55  
9   - in_item = "common",
10   - out_item = "common",
11   - in_diamond = "common",
12   - out_diamond = "common",
13   - in_hero = "common",
14   - out_hero = "common",
15   - in_equip = "common",
16   - out_equip = "common",
17   - in_rune = "common",
18   - out_rune = "common",
19   - player_exp = "common",
20   - func_open = "common",
21   - in_adv = "common",
22   - out_adv = "common",
23   - in_artifact = "common",
24   -
25   - mail_action = "common",
26   - role_action = "common",
27   - hang_action = "common",
28   - hero_action = "common",
29   - adv_action = "common",
30   - rune_action = "common",
31   - pvp_action = "common",
32   - diner_action = "common",
33   - tower_action = "common",
34   - gm_action = "common",
35   - act_action = "common",
  56 + dinerFinishTask = 401, -- 餐厅完成任务
  57 + storybookReward = 402, -- 剧情奖励
  58 + finishTask = 403, -- 任务
  59 + taskActive = 404, -- 完成活跃任务
  60 + advMainTask = 405, -- 拾荒主线
  61 +
  62 + finishAchive = 601, -- 完成成就
  63 + advAchiev = 602, -- 拾荒成就
  64 + advAchievReward = 603, -- 拾慌成就奖励
  65 +
  66 + draw_attach = 701, -- 邮件奖励
  67 +
  68 + gm = 1000, -- 获取途径:GM
  69 +
  70 + -- 活动
  71 + sudoku = 1001, -- 九宫格
  72 + sudokuR = 1002, -- 九宫格连线奖励
  73 + sudokuRP = 1003, -- 九宫格阶段奖励
  74 + sign = 1004, -- 签到
  75 + friendPoint = 1005, -- 友情
  76 + birth = 1006, -- 出生奖励
  77 +
  78 + -- 餐厅
  79 + greenHourse = 1101, -- 食材获得
  80 + dinerEntrus = 1102, -- 餐厅委托
  81 + dinerCollect = 1103, -- 餐厅小人收集
  82 + dinerCombo = 1104, -- 小人组合
  83 + dinerSkillUp = 1105, -- 餐厅技能升级
  84 + dinerReTask = 1106, -- 餐厅刷新任务
  85 + addSell = 1107, -- 餐厅贩卖
  86 + dinerBuildUp = 1108, -- 建筑升级
  87 + removeSell = 1109, -- 移除售卖
  88 + dinerSell = 1110, -- 餐饮售卖
  89 +
  90 + -- 英雄
  91 + heroLevelUp = 1201, -- 英雄升级
  92 + heroBreak = 1202, -- 英雄突破
  93 + heroWake = 1203, -- 英雄觉醒
  94 + heroTalent = 1204, -- 英雄天赋
  95 + createHero = 1205, -- 碎片合成
  96 + createHeroRandom = 1206, -- 随机合成
  97 + resetHero = 1207, -- 重置养成
36 98 }
37 99  
38   --- 如要修改 要提前修改 _template mapping -- 对应 mapping 为 gamelog-*
39   -local Mapping = {
40   - -- 预留一些数据格式 担心integer 范围不够用 将 通用的int* 全部换为long
41   - common = {
42   - desc = "keyword",--索引的短字符串
43   - ucode = "keyword",--关联日志对应ucode
44   - key1 = "keyword", --可索引的短字符串
45   - key2 = "keyword", --可索引的短字符串
46   - -- 几乎不用的长文本
47   - text1 = "text", --长字符串不索引的类型
48   - -- 五个不同类型的数字 基本上满足数量要求 尽量从低到高用
49   - short1 = "short",
50   - int1 = "long",
51   - int2 = "long",
52   - long1 = "long",
53   - float1 = "float",
54   -
55   - -- 底层使用的 一些参数
56   - cint1 = "long",
57   - cint2 = "long",
58   - cint3 = "long",
59   - }
  100 +
  101 +--[[
  102 +100 教学
  103 +200 主线
  104 +300 日常
  105 +400 周常
  106 +500 联盟
  107 +1000 限时任务
  108 +2000 其他
  109 +--]]
  110 +local TaskType = {
  111 +
60 112 }
61 113  
62   --- 所有的日志都包括的部分 role 里面的信息 -- mapping 信息在 gamelog-role
63   -local commonRoleField = {
64   - name = "keyword",
65   - id = "integer",
66   - uid = "keyword",
67   - sid = "short",
68   - device = "keyword",
69   - ctime = "integer",
70   - ltime = "integer",
71   - level = "short",
72   - rmbC = "integer",
  114 +
  115 +local MethodType = {
  116 + onCreateAccount = {}, -- 创建游戏账号
  117 + onCreateRole = {}, -- 创建游戏角色
  118 + onLogin = {}, -- 玩家登录
  119 + onLogout = { -- 登出
  120 + logtime = true, --登录时长
  121 + },
  122 + setLevel = { -- 设置等级 --TODO
  123 + level_before = true, -- 变动前的等级,可以跳级
  124 + level_changemain = true, -- 等级变动原因,副本通关:mission,领取奖励:reward
  125 + level_changedetail = true, -- 等级变动原因明细,副本通关则记录关卡ID,领取奖励则记录奖励ID
  126 + level_reward = true, -- 等级变动奖励,json格式记录,{道具ID1:道具数量,道具ID2:道具数量}
  127 + },
  128 + onGuidePoint = { --游戏引导
  129 + guild_type = true, --引导类型,新手引导:0,系统引导:1,弱引导:2
  130 + guild_id = true, --节点ID
  131 + guild_point = true, --步骤ID
  132 + guild_pass = true, --正常操作:0,自动播放:1,跳过:2
  133 + },
  134 + setOrder = { --玩家订单记录
  135 + order_status = true, -- "订单状态:100 - 开始下单(玩家还未开始付费行为记录)200 - 支付完成并发货(SDK通知可以发货时记录),300 - 订单被取消,1000 - 其他"
  136 + item_id = true, -- 道具id
  137 + item_type = true, -- 购买的道具类型,具体见"onItems"方法中道具类型枚举表
  138 + item_name = true, -- 购买的道具名
  139 + item_number = true, -- 购买的道具数量
  140 + item_level = true, -- 购买的道具等级
  141 + order_cost = true, -- 此次消费的现金金额(单位:分),如 51800即未518元,对应客户端SDK传入的'total_fee'
  142 + order_currency = true, -- 货币类型,默认为"CNY"(人民币),遵循ISO 4217规范
  143 + order_type = true, -- 订单类型,首充记录为1,否则为0
  144 + order_id = true, -- 本条记录的订单号,对应客户端SDK返回的'bs_trade_no'
  145 + },
  146 + onMail = { --玩家邮件操作
  147 + mail_action_type = true, -- 操作(1=收,2=领,3=删)
  148 + mail_receivetime = true, -- 收件时间
  149 + mail_textid = true, -- 邮件文本ID
  150 + mial_title = true, -- 邮件标题参数
  151 + mail_content = true, -- 邮件内容参数
  152 + mail_attach = true, -- 邮件附件
  153 + mail_reason = true, -- 原因
  154 + mail_readstatus = true, -- 邮件读取状态
  155 + mail_attachstatus = true, -- 邮件附件状态
  156 + mail_timeout = true, -- 邮件超时时间
  157 + mail_friend_id = true, -- 收件方账号id
  158 + mail_friend_roleid = true, -- 收件方角色id
  159 + },
  160 + onItems = { --道具流通 --TODO
  161 + item_id = true, -- 道具id
  162 + item_sequenceid = "ucode", -- 道具变动关联ID,用于关联一次动作产生多条不同类型的日志,如一个礼包多个物品等情形
  163 + item_type = true, -- 道具类型,具体见枚举表中道具类型枚举表
  164 + item_level = true, -- 道具等级
  165 + item_number = true, -- 道具变化数量的绝对值
  166 + action_type = true, -- 变化类型(玩家获取:1,玩家消耗:0)
  167 + item_before = true, -- 道具变化前的数量
  168 + item_after = true, -- 道具变化后的数量
  169 + item_reason = true, -- 道具流动一级原因,如抽卡、装备强化、副本掉落,可参考道具动作类型枚举表
  170 + item_subreason = true, -- 道具流动二级原因,抽卡:卡池ID,装备强化:装备ID,副本掉落:副本ID
  171 + item_other = true, -- 其他(可包含阶数,强化等级,随机属性)
  172 + },
  173 + mission = { --玩家副本完成情况 --TODO
  174 + mission_threadid = true, -- 大关卡ID
  175 + mission_id = true, -- 关卡ID
  176 + mission_type = true, -- 关卡类型,见关卡类型枚举表
  177 + mission_sequenceid = "ucode", -- 本次对战ID,用于关联一次动作产生多条不同类型的日志
  178 + mission_herolist = true, -- 英雄ID,排序以玩家出战设置为准,PVP多个队伍则记录多个列表。示例:[[1,2,3],[456]]
  179 + mission_heroscore = true, -- 编队总评分
  180 + mission_enemylist = true, -- 地方英雄ID,排序以玩家出战设置为准,PVP多个队伍则记录多个列表。示例:[[1,2,3],[456]]
  181 + mission_damage = true, -- 英雄输出值。示例:{'heroid1':1000,'heroid2':2000,………..}
  182 + mission_ultskill = true, -- 大招使用情况。示例:{'heroid1':1000,'heroid2':2000,………..}
  183 + mission_reward = true, -- 获得奖励,建议使用json格式记录。示例:{ "XX": "1", "XXX": "3"}
  184 + mission_starttime = true, -- 战斗开始时间,格式 unixtime 秒级
  185 + mission_roundtime = true, -- 对局时长(秒)
  186 + mission_result = true, -- 战斗结果(0-无效,1-胜利,2-失败)
  187 + mission_star = true, -- 战斗完成星数,无星级的话填写0
  188 + mission_restriction = true, -- 周期内参与限制(0表示没有上限)
  189 + mission_difficulty = true, -- 关卡困难度,无难度区分的话填写0
  190 + mission_strength = true, -- 消耗的体力或次数
  191 + mission_score = true, -- 本局分数,PVP玩法记录为对战后积分,无得分的填0
  192 + mission_cleartype = true, -- 1正常通关;2代理拾荒
  193 + mission_rank = true, -- 对战后排名,适用于PVP玩法和电波塔,其他玩法留空
  194 + misson_monsterkill = true, -- 击杀怪物ID和数量,建议使用json格式记录。示例:{ "XX": "1", "XXX": "3"}
  195 + misson_teamskill = true, -- 编队支援技能和技能等级情况,json格式记录,{"teamskill1":1,"teamskill2":2,………..}
  196 + misson_teambond = true, -- 编队羁绊和羁绊等级,json格式记录,{"bondid1":1,"bondid2":2,………..}
  197 + },
  198 + residence_reward = { --玩家挂机或排名奖励 --TODO
  199 + mission_threadid = true, --大关卡ID
  200 + mission_id = true, --关卡ID
  201 + mission_type = true, --关卡类型,见关卡类型枚举表
  202 + residence_reward_type = true, --领取奖励方式,快速(超前领取)记录为1,正常领取记录为0
  203 + residence_time = true, --挂机或排名时长
  204 + residence_reward = true, --获得奖励,建议使用json格式记录。示例:{ "XX": "1", "XXX": "3"}
  205 + },
  206 + hero_rise = { --英雄觉醒 --TODO
  207 + hero_id = true, --英雄ID
  208 + hero_rise_cost = true, --英雄觉醒消耗,json格式记录,{道具ID1:消耗数量1,道具ID2:消耗数量2,………...}
  209 + hero_rise_score = true, --英雄觉醒后评分提升
  210 + hero_rise_result = true, --英雄觉醒效果,可记录效果ID,或json格式记录提升效果,{攻击:20,闪避:20,……..}
  211 + },
  212 + hero_upgrade = { --英雄升级 --TODO
  213 + hero_id = true, -- 英雄ID
  214 + hero_upgrade_cost = true, -- 英雄升级消耗,json格式记录,{道具ID1:消耗数量1,道具ID2:消耗数量2,………...}
  215 + hero_upgrade_result = true, -- 英雄升级效果,可记录效果ID,或json格式记录提升效果,{攻击:20,闪避:20,……..}
  216 + hero_upgrade_type = true, -- 英雄升级方式,连续升级:1,单击升级:0
  217 + hero_upgrade_score = true, -- 英雄升级后评分
  218 + hero_upgrade_scoreget = true, -- 通过英雄升级提升的评分
  219 + },
  220 + hero_break = { --英雄突破 --TODO
  221 + hero_id = true, -- 英雄ID
  222 + hero_break_cost = true, -- 英雄突破消耗,json格式记录,{道具ID1:消耗数量1,道具ID2:消耗数量2,………...}
  223 + hero_break_result = true, -- 英雄突破效果,可记录效果ID,或json格式记录提升效果,{攻击:20,闪避:20,……..}
  224 + hero_break_level = true, -- 英雄突破后等级上限
  225 + },
  226 + hero_talent = { --英雄天赋升级 --TODO
  227 + hero_id = true, -- 英雄ID
  228 + hero_talent_cost = true, -- 英雄天赋升级消耗,json格式记录,{道具ID1:消耗数量1,道具ID2:消耗数量2,………...}
  229 + hero_talent_levelbef = true, -- 英雄技能升级前等级
  230 + hero_talent_level = true, -- 英雄技能升级后等级
  231 + },
  232 + hero_jewel = { --英雄铭文 --TODO
  233 + hero_id = true, -- 英雄ID
  234 + hero_jewel_sequence = true, -- 铭文装备编号,用以关联一次装备时产生的多条日志
  235 + hero_jewel_id = true, -- 铭文ID
  236 + hero_jewel_part = true, -- 铭文装备部位
  237 + hero_jewel_score = true, -- 铭文装备后的英雄分值
  238 + hero_jewel_scorebefore = true, -- 铭文装备前的英雄分值
  239 + hero_jewel_result = true, -- 铭文装备后效果,可记录效果ID,或json格式记录提升效果,{攻击:20,闪避:20,……..}
  240 + },
  241 + hero_note = { --英雄评价 --TODO
  242 + hero_id = true, -- 英雄ID
  243 + hero_note_action = true, -- 英雄评价界面操作,发布评论:0,点赞:1,反对:2
  244 + hero_note_id = true, -- 操作的评价ID
  245 + hero_note_text = true, -- 操作的评价内容
  246 + },
  247 + hero_show = { --展示英雄 --TODO
  248 + hero_id = true, -- 英雄ID
  249 + },
  250 + hero_recycle = { --英雄回收
  251 + hero_recycle_list = true, -- 回收的英雄id列表,建议使用json格式记录。示例:{ "XX": "1", "XXX": "3"}
  252 + hero_recycle_reward = true, -- 回收后获得的奖励,建议使用json格式记录。示例:{ "XX": "1", "XXX": "3"}
  253 + hero_recycle_cnt = true, -- 总回收英雄量
  254 + },
  255 + gacha = { --英雄招募 --TODO
  256 + gacha_id = true, -- 卡池ID
  257 + gacha_type = true, -- 卡池类型
  258 + gacha_up = true, -- 卡池UP角色
  259 + gacha_times = true, -- 抽卡次数
  260 + gacha_reward = true, -- 抽卡结果,建议使用json格式记录。示例:{ "XX": "1", "XXX": "3"}
  261 + currency_type = true, -- 购买道具消耗的货币类型,记录货币ID
  262 + gacha_current = true, -- 购买道具消耗的货币数量
  263 + gacha_cnt = true, -- 此卡池内的计数器
  264 + },
  265 + equip_wear = { --装备穿戴与卸载 --TODO
  266 + hero_id = true, --英雄ID
  267 + equip_id = true, --装备ID
  268 + equip_wear_action = true, --装备操作类型:装备:0,卸载:1
  269 + equip_wear_part = true, --装备部位,记录部位ID
  270 + equip_wear_result = true, --装备操作后结果,记录属性变化,json格式记录,{“aa”:1234,"bb":4567}
  271 + equip_wear_change = true, --装备操作变化值,记录属性变化,记录正负值,json格式记录,{“aa”:1234,"bb":-45}
  272 + equip_wear_mode = true, --用以区分自动装备还是手动装备,自动记录为0,手动记录为1
  273 + equip_wear_seqid = true, --自动穿戴时记录的系列ID,用以关联一次性装备时候产生的多条记录
  274 + },
  275 + equip_upgrade = { --装备升级 --TODO
  276 + hero_id = true, -- 英雄ID
  277 + equip_upgrade_part = true, -- 升级部位,记录部位ID
  278 + equip_id = true, -- 升级后的装备ID
  279 + equip_upgrade_amount = true, -- 升级获取的装备数量
  280 + equip_upgrade_usedid = true, -- 升级消耗的装备ID
  281 + equip_upgrade_cost = true, -- 升级操作消耗装备数量
  282 + equip_upgrade_currentid = true, -- 升级消耗的货币类型
  283 + equip_upgrade_current = true, -- 升级操作消耗货币数量
  284 + },
  285 + carriage_dismantle = { --物资拆解 --TODO
  286 + item_id = true, -- 道具id
  287 + item_sequenceid = "ucode", -- 道具变动关联ID,用于关联一次动作产生多条不同类型的日志,如一个礼包多个物品等情形
  288 + item_type = true, -- 道具类型,具体见枚举表中道具类型枚举表
  289 + item_level = true, -- 道具等级
  290 + item_number = true, -- 道具变化数量的绝对值
  291 + carriage_dismantle_type = true, -- 拆解方式,时间到期:0,钥匙开启:1
  292 + carriage_dismantle_time = true, -- 拆解耗时,填写实际耗时
  293 + carriage_dismantle_cost = true, -- 拆解花费钥匙数量,未使用填写0
  294 + carriage_dismantle_rwd = true, -- 拆解获得物资,json格式记录,{'itemid1':2,'itemid2':3,…………..}
  295 + },
  296 + carriage_logistics = { --后勤室 --TODO
  297 + carriage_logistics_type = true, -- 后勤室制作类型ID,变异:0,通常:1,魔法:2
  298 + carriage_logistics_itemid = true, -- 后勤室升级物品或技能ID
  299 + carriage_logistics_itemlv = true, -- 升级后物品或技能等级
  300 + carriage_logistics_gear = true, -- 后勤室升级花费齿轮数量
  301 + carriage_logistics_coin = true, -- 后勤室升级花费美食币数量
  302 + },
  303 + carriage_decals = { --贴纸拆解 --TODO
  304 + item_id = true, --道具id
  305 + item_sequenceid = "ucode", --道具变动关联ID,用于关联一次动作产生多条不同类型的日志,如一个礼包多个物品等情形
  306 + item_type = true, --道具类型,具体见枚举表中道具类型枚举表
  307 + item_level = true, --道具等级
  308 + item_number = true, --道具变化数量的绝对值
  309 + carriage_decals_rwdid = true, --拆解获得物资ID
  310 + carriage_decals_rwdnum = true, --拆解获得物资数量
  311 + },
  312 + carriage_video = { --放映室 --TODO
  313 + carriage_video_type = true, --放映室类型,剧情CG:0, 角色CG:1, 主线剧情:2, 角色剧情:3, 活动剧情:4, 图鉴:5
  314 + carriage_video_id = true, --放映室片段ID
  315 + carriage_video_coinid = true, --放映奖励货币类型,无奖励则填写0
  316 + carriage_video_coinnum = true, --放映奖励货币数量,无奖励则填写0
  317 + carriage_video_item = true, --放映奖励其他物品数量,json格式记录,{'itemid1':10,'itemid2':5,…………..},无奖励则填写0
  318 + },
  319 + carriage_cook = { --调理室 --TODO
  320 + item_id = true, -- 道具id
  321 + item_level = true, -- 道具等级
  322 + item_type = true, -- 道具类型,具体见枚举表中道具类型枚举表
  323 + carriage_cook_amount = true, -- 制作总量
  324 + carriage_cook_cost = true, -- 制作消耗道具,json格式记录,{'itemid1':10,'itemid2':5,…………..}
  325 + },
  326 + activity = { --活动或指南奖励 --TODO
  327 + activity_id = true, -- 活动ID(或活动指定任务的ID)
  328 + activity_type = true, -- 活动类型,见活动类型枚举表
  329 + activity_reward = true, -- 活动奖励,json格式记录,{'itemid1':123,'itemid2':456,………...}
  330 + },
  331 + task_reward = { --任务奖励 --TODO
  332 + task_reward_id = true, --任务奖励ID
  333 + task_reward_type = true, --任务奖励类型,见 任务奖励类型枚举表
  334 + task_reward_detail = true, --任务奖励,json格式记录,{'itemid1':123,'itemid2':456,………...}
  335 + },
  336 + shop_purchase = { --商店购买行为 --TODO
  337 + item_id = true, -- 道具id
  338 + item_sequenceid = "ucode", -- 道具变动关联ID,用于关联一次动作产生多条不同类型的日志,如一个购买礼包多个物品等情形
  339 + item_type = true, -- 道具类型,具体见枚举表中道具类型枚举表
  340 + item_level = true, -- 道具等级
  341 + item_cnt = true, -- 购买数量技术
  342 + currency_type = true, -- 购买道具消耗的货币类型,记录货币ID
  343 + shop_purchase_current = true, -- 购买道具消耗的货币数量
  344 + shop_id = true, -- 商店ID
  345 + },
  346 + friend_opt = { --好友操作 --TODO
  347 + friend_opt_type = true, -- 好友操作类型,见枚举表中 好友操作类型枚举表
  348 + friend_accountid = true, -- 好友账户id
  349 + friend_roleid = true, -- 好友账户下的角色id
  350 + friend_cnt = true, -- 操作后好友数量
  351 + },
  352 + friend_list = { --好友列表 --TODO
  353 + friend_accountid = true, --好友账户id
  354 + friend_roleid = true, --好友账户下的角色id
  355 + },
  356 + friend_black = { --黑名单列表 --TODO
  357 + friend_accountid = true, -- 好友账户id
  358 + friend_roleid = true, -- 好友账户下的角色id
  359 + },
  360 + communication = { --玩家发言 --TODO
  361 + publish_type = true, --发言类型,全部:0,公告:1,世界:2,联盟:3,私聊:4
  362 + publish_status = true, --发送状态,发送成功:0,发送失败:1,被屏蔽:2,其他:3
  363 + publish_receive_accid = true, --接收者账户ID
  364 + publish_receive_roleid = true, --接收者角色ID
  365 + publish_text = true, --发言内容
  366 + },
  367 + restaurant_up = { --摊位升级 --TODO
  368 + restaurant_up_type = true, --升级部件类型,店面:0, 接客:1, 满意度:2, 宣传:3, 广告:4, 周边:5
  369 + restaurant_up_gear = true, --消耗齿轮数量
  370 + restaurant_up_coin = true, --花费美食币数量
  371 + restaurant_up_effectbef = true, --升级前加成
  372 + restaurant_up_effect = true, --升级后加成
  373 + },
  374 + restaurant_sale = { --摊位售卖 --TODO
  375 + item_id = true, -- 售卖物品ID
  376 + restaurant_sale_seat = true, -- 售卖物品所在位置
  377 + restaurant_sale_time = true, -- 售卖时长
  378 + restaurant_sale_type = true, -- 售卖方式,正常售卖:0, 加速:1,移除售卖:2
  379 + restaurant_sale_coin = true, -- 售卖获得美食币
  380 + restaurant_sale_gear = true, -- 售卖获得齿轮
  381 + },
  382 + restaurant_material = { --食材获取 --TODO
  383 + item_id = true, -- 获取物品ID
  384 + restaurant_material_seqid = true, -- 道具变动关联ID,用于关联一次动作产生多条不同类型的日志,如一次获取两件道具情况
  385 + restaurant_material_start = true, -- 申请获取时间
  386 + restaurant_material_time = true, -- 申请到领取耗时
  387 + restaurant_material_num = true, -- 获取物品数量
  388 + },
  389 + restaurant_order = { --订单任务 --TODO
  390 + restaurant_order_id = true, -- 订单任务ID
  391 + restaurant_order_status = true, -- 订单任务状态,接受:0, 拒绝:1, 完成:2
  392 + restaurant_order_start = true, -- 订单接收时间,timestamp格式记录
  393 + restaurant_order_rwd = true, -- 订单完成奖励,json格式记录,{"itemid1":123,"itemid2":12,……….}
  394 + restaurant_order_lv = true, -- 订单品质等级,普通:0, 稀有:1, 顶级:2, 豪华:3
  395 + },
  396 + restaurant_collect = { --餐厅顾客图谱 --TODO
  397 + restaurant_collect_id = true, -- 图谱收集ID
  398 + restaurant_collect_rwd = true, -- 订单完成奖励,json格式记录,{"itemid1":123,"itemid2":12,……….}
  399 + restaurant_collect_plan = true, -- 收集进度,即解锁顾客,数字表示
  400 + },
  401 + achievement = { --成就达成 --TODO
  402 + achievement_id = true, -- 成就id
  403 + achievement_type = true, -- 成就类型,具体枚举表中成就类型枚举表
  404 + achievement_name = true, -- 成就名称
  405 + achievement_score = true, -- 领取成就后成就点数
  406 + achievement_subscore = true, -- 领取成就后小类成就点数
  407 + achievement_reward = true, -- 达成成就奖励,json格式记录,{"itemid1":123,"itemid2":12,……….}
  408 + },
  409 + get_gift = { --礼包兑换 --TODO
  410 + gift_id = true, -- 礼包ID
  411 + gift_key = true, -- 礼包key
  412 + gift_reward = true, -- 礼包奖励,json格式记录,{"itemid1":123,"itemid2":12,……….}
  413 + gift_name = true, -- 礼包名称
  414 + gift_reason = true, -- 礼包发放原因,见发放原因枚举表
  415 + },
73 416 }
74 417  
75   -local function printError(info)
76   - print(info)
77   - print(debug.traceback())
  418 +local function isIos(self)
  419 + local sid = self:getProperty("sid")
  420 + return sid == 2
78 421 end
79 422  
80   -local function checkType(logType, field, value, ctype)
81   - local typecheckfunc = {
82   - keyword = function()
83   - --长度不超过256
84   - if type(value) ~= "string" then
85   - value = tostring(value)
86   - printError(string.format("LOG ERROR: logType [%s] field [%s] isn't [keyword], value : %s", logType, field, value))
87   - else
88   - if #value > 256 then
89   - printError(string.format("LOG ERROR: logType [%s] field [%s] [keyword] type to long. value : %s", logType, field, value))
90   - end
91   - end
92   - return value
93   - end,
94   - text = function()
95   - if type(value) ~= "string" then
96   - value = tostring(value)
97   - printError(string.format("LOG ERROR: logType [%s] field [%s] isn't [text], value : %s", logType, field, value))
98   - end
99   - return value
100   - end,
101   - integer = function()
102   - if type(value) ~= "number" then
103   - value = tonumber(value)
104   - printError(string.format("LOG ERROR: logType [%s] field [%s] isn't [integer], value : %s", logType, field, value))
105   - end
106   - if value then
107   - if math.type(value) ~= "integer" then
108   - local oldValue = value
109   - value = math.floor(value)
110   - if value ~= oldValue then
111   - printError(string.format("LOG ERROR: logType [%s] field [%s] isn't [integer], is float, value : %s", logType, field, value))
112   - end
113   - end
114   - if -2147483648 > value or value > 2147483647 then
115   - printError(string.format("LOG ERROR: logType [%s] field [%s] isn't [integer], too big, value : %s", logType, field, value))
116   - value = nil
117   - end
118   - end
119   - return value
120   - end,
121   - short = function()
122   - if type(value) ~= "number" then
123   - value = tonumber(value)
124   - printError(string.format("LOG ERROR: logType [%s] field [%s] isn't [short], value : %s", logType, field, value))
125   - end
126   - if value then
127   - if math.type(value) ~= "integer" then
128   - local oldValue = value
129   - value = math.floor(value)
130   - if value ~= oldValue then
131   - printError(string.format("LOG ERROR: logType [%s] field [%s] isn't [short], is float, value : %s", logType, field, value))
132   - end
133   - end
134   -
135   - if -32768 > value or value > 32768 then
136   - printError(string.format("LOG ERROR: logType [%s] field [%s] isn't [short], too big, value : %s", logType, field, value))
137   - value = nil
138   - end
139   - end
140   - return value
141   - end,
142   - long = function()
143   - if type(value) ~= "number" then
144   - value = tonumber(value)
145   - printError(string.format("LOG ERROR: logType [%s] field [%s] isn't [long], value : %s", logType, field, value))
146   - end
147   - if value then
148   - if math.type(value) ~= "integer" then
149   - local oldValue = value
150   - value = math.floor(value)
151   - if type(value) ~= "integer" then
152   - printError(string.format("LOG ERROR: logType [%s] field [%s] isn't [long], too big, value : %s", logType, field, value))
153   - value = nil
154   - elseif value ~= oldValue then
155   - printError(string.format("LOG ERROR: logType [%s] field [%s] isn't [long], is float, value : %s", logType, field, value))
156   - end
157   - end
158   - end
159   - return value
160   - end,
161   - float = function()
162   - if type(value) ~= "number" then
163   - value = tonumber(value)
164   - printError(string.format("LOG ERROR: logType [%s] field [%s] isn't [float], value : %s", logType, field, value))
165   - end
166   - return value
167   - end,
  423 +local appid, sdkId
  424 +local function getBaseLog(self)
  425 + local uid = self:getProperty("uid")
  426 + if not appid then
  427 + appid, sdkId = string.match(uid, "(.*)_(.*)")
  428 + if not appid then
  429 + sdkId = uid
  430 + appid = 0
  431 + end
  432 + end
  433 + local log = {
  434 + server_id = server_id,
  435 + timestamp = skynet.timex(),
  436 + app_id = appid,
  437 + plat_id = isIos(self) and 0 or 1,
  438 + sdk_uid = sdkId,
  439 + account_id = uid,
  440 + role_id = self:getProperty("id"),
  441 + role_name = self:getProperty("name"),
  442 + level = self:getProperty("level"),
  443 + vip = 0,
  444 + device_id = self:getProperty("device"),
  445 + device_model = self:getProperty("dmode"),
  446 + version = "v2.0.1",
  447 + client_version = self.clientVersion or "1.0.0",
  448 + sys_version = self.sysVersion or "unknow",
  449 + ip = self.ip or "0.0.0.0",
  450 + network = self.network or "unknow",
  451 + record_date = os.date("%Y%m%d"),
168 452 }
  453 + return log
  454 +end
169 455  
170   - if typecheckfunc[ctype] then
171   - return typecheckfunc[ctype]()
172   - else
173   - printError(string.format("LOG ERROR: logType [%s] field [%s] have a new type [%s] need add check.", logType, field, ctype))
174   - return nil
175   - end
  456 +local function printError(info)
  457 + print(info)
  458 + print(debug.traceback())
176 459 end
177 460  
178 461 local RoleLog = {}
179 462 function RoleLog.bind(Role)
180   - function Role:log(logType, contents)
  463 +
  464 + function Role:log()
  465 + end
  466 +
  467 + function Role:log_new(logType, contents)
181 468 contents = contents or {}
182   - local _logType = LogType[logType]
183   - if not _logType then
184   - printError(string.format("LOG ERROR: new logType [%s] need Add Maping.", logType))
  469 + local schema = MethodType[logType]
  470 + if not schema then
  471 + printError(string.format("LOG ERROR: new logType [%s].", logType))
185 472 return
186 473 end
187   - local doc = {}
188   - for field, ctype in pairs(commonRoleField) do
189   - if contents[field] then
190   - printError(string.format("LOG ERROR: logType [%s] had field [%s] overwrite default.", logType, field))
191   - end
192   - doc[field] = checkType("commonRoleField", field, self:getProperty(field), ctype)
193   - end
  474 + local doc = getBaseLog(self)
194 475  
195   - local mapping = Mapping[_logType]
196   - if mapping["ucode"] and not contents["ucode"] then
197   - contents["ucode"] = self:getActionUcode()
  476 + doc["method"] = logType
  477 + for field, value in pairs(contents) do
  478 + if not schema[ftype] then
  479 + printError(string.format("LOG ERROR: logType [%s] have new field [%s], call yunying.", logType, field))
  480 + end
198 481 end
199 482  
200   - for field, value in pairs(contents) do
201   - local ftype = mapping[field]
202   - if ftype then
203   - doc[field] = checkType(logType, field, value, ftype)
204   - else
205   - printError(string.format("LOG ERROR: logType [%s] have new field [%s] no type in mapping.", logType, field))
  483 + for field, tag in pairs(schema) do
  484 + if not contents[field] then
  485 + if tag == "ucode" then
  486 + contents[field] = self:getActionUcode()
  487 + else
  488 + printError(string.format("LOG ERROR: logType [%s] lose field [%s].", logType, field))
  489 + end
206 490 end
207 491 end
208 492 if not logd then return end
209   - pcall(skynet.send, logd, "lua", "log", logType, doc, _logType)
  493 + pcall(skynet.send, logd, "lua", "log", doc)
  494 + end
  495 +
  496 + function Role:logItems(itemId, before, after, reason, subreason, other)
  497 + local reasonType = ItemReason[reason]
  498 + if not reasonType then
  499 + printError(string.format("LOG ERROR: onItems no reasonType [%s].", reason))
  500 + end
  501 + local itemData = csvdb["itemCsv"][itemId]
  502 + if not itemData then return end
  503 + self:log("onItems", {
  504 + item_id = itemId, -- 道具id
  505 + item_type = itemData.type, -- 道具类型,具体见枚举表中道具类型枚举表
  506 + item_level = 0, -- 道具等级
  507 + item_number = math.abs(after - before), -- 道具变化数量的绝对值
  508 + action_type = after - before > 0 and 1 or 0, -- 变化类型(玩家获取:1,玩家消耗:0)
  509 + item_before = before, -- 道具变化前的数量
  510 + item_after = after, -- 道具变化后的数量
  511 + item_reason = reasonType, -- 道具流动一级原因,如抽卡、装备强化、副本掉落,可参考道具动作类型枚举表
  512 + item_subreason = subreason, -- 道具流动二级原因,抽卡:卡池ID,装备强化:装备ID,副本掉落:副本ID
  513 + item_other = other, -- 其他(可包含阶数,强化等级,随机属性)
  514 + })
210 515 end
211 516  
212 517 function Role:startActionUcode()
... ... @@ -225,7 +530,8 @@ function RoleLog.bind(Role)
225 530  
226 531 function Role:getActionUcode()
227 532 return self._actionUcode
228   - end
  533 + end
  534 +
229 535  
230 536 end
231 537 return RoleLog
232 538 \ No newline at end of file
... ...
src/models/RolePlugin.lua
... ... @@ -207,6 +207,7 @@ function RolePlugin.bind(Role)
207 207  
208 208 function Role:addPlayExp(addExp, params)
209 209 local level = self:getProperty("level")
  210 + local oldLevel = level
210 211 if not csvdb["player_expCsv"][level + 1] then
211 212 return
212 213 end
... ... @@ -222,20 +223,19 @@ function RolePlugin.bind(Role)
222 223 newExp = csvdb["player_expCsv"][level].exp - 1 -- 没有下一级了 经验溢出太多 扣除
223 224 end
224 225 end
225   -
226   - if params.log then
227   - local log = clone(params.log)
228   - if log["cint1"] or log["cint2"] then
229   - print("addPlayExp error log have cint1 or cint2 or cint3", debug.traceback())
  226 + if level > oldLevel then
  227 + if params.log then
  228 + local log = params.log
  229 + self:log("setLevel", {
  230 + level_before = oldLevel,
  231 + level_changemain = log.desc,
  232 + level_changedetail = log.sub,
  233 + level_reward = "{}",
  234 + })
  235 + else
  236 + print("addPlayExp no log ", debug.traceback())
230 237 end
231   -
232   - log["cint1"] = addExp
233   - log["cint2"] = newExp
234   - log["cint3"] = level
235   -
236   - self:log("player_exp", log)
237   - else
238   - print("addPlayExp no log ", debug.traceback())
  238 +
239 239 end
240 240  
241 241 self:updateProperties({level = level, exp = newExp})
... ... @@ -259,17 +259,8 @@ function RolePlugin.bind(Role)
259 259 end
260 260  
261 261 if params.log then
262   - local log = clone(params.log)
263   - if log["cint1"] or log["cint2"] then
264   - print("addItem error log have cint1 or cint2 ", debug.traceback())
265   - end
266   - log["cint1"] = params.itemId
267   - log["cint2"] = math.abs(params.count)
268   - if params.count <= 0 then
269   - self:log("out_item", log)
270   - else
271   - self:log("in_item", log)
272   - end
  262 + local log = params.log
  263 + self:logItems(params.itemId, origin, nums, log.desc, log.sub, log.other)
273 264 else
274 265 print("addItem no log ", debug.traceback())
275 266 end
... ... @@ -344,12 +335,7 @@ function RolePlugin.bind(Role)
344 335  
345 336 if params.log then
346 337 local log = clone(params.log)
347   - if log["cint1"] or log["cint2"] or log["cint3"] then
348   - print("costDiamond error log have cint1 or cint2 or cint3 ", debug.traceback())
349   - end
350   - log["cint1"] = origin
351   - log["cint2"] = count
352   - self:log("in_diamond", log)
  338 + self:logItems(ItemId.Diamond, origin, count, log.desc, log.sub, log.other)
353 339 else
354 340 print("gainDiamond no log ", debug.traceback())
355 341 end
... ... @@ -358,6 +344,7 @@ function RolePlugin.bind(Role)
358 344 return true
359 345 end
360 346  
  347 +
361 348 function Role:costDiamond(params)
362 349 if not params or type(params) ~= "table" then return false end
363 350 local count = tonum(params.count)
... ... @@ -392,12 +379,7 @@ function RolePlugin.bind(Role)
392 379  
393 380 if params.log then
394 381 local log = clone(params.log)
395   - if log["cint1"] or log["cint2"] or log["cint3"] then
396   - print("costDiamond error log have cint1 or cint2 or cint3 ", debug.traceback())
397   - end
398   - log["cint1"] = origin
399   - log["cint2"] = count
400   - self:log("out_diamond", log)
  382 + self:logItems(ItemId.Diamond, origin, count, log.desc, log.sub, log.other)
401 383 else
402 384 print("costDiamond no log ", debug.traceback())
403 385 end
... ... @@ -438,12 +420,7 @@ function RolePlugin.bind(Role)
438 420 end
439 421 if params.log then
440 422 local log = clone(params.log)
441   - if log["cint1"] or log["cint2"] or log["cint3"] then
442   - print("addHero error log have cint1 or cint2 or cint3 ", debug.traceback())
443   - end
444   - log["cint1"] = heroId
445   - log["cint2"] = heroType
446   - self:log("in_hero", log)
  423 + self:logItems(heroType + ItemStartId.Hero, 0, 1, log.desc, log.sub, log.other)
447 424 else
448 425 print("addHero no log ", debug.traceback())
449 426 end
... ... @@ -459,33 +436,6 @@ function RolePlugin.bind(Role)
459 436 end
460 437 end
461 438  
462   - function Role:delHero(heroId, params)
463   - params = params or {}
464   - local roleId = self:getProperty('id')
465   - local hero = self.heros[heroId]
466   - local heroType = hero:getProperty("type")
467   - if not hero then return end
468   -
469   - self.heros[heroId] = nil
470   - redisproxy:pipelining(function (red)
471   - red:del(string.format(R_HERO, roleId, heroId))
472   - red:srem(string.format(R_HEROS, roleId), heroId)
473   - end)
474   -
475   - if params.log then
476   - local log = clone(params.log)
477   - if log["cint1"] or log["cint2"] or log["cint3"] then
478   - print("delHero error log have cint1 or cint2 or cint3 ", debug.traceback())
479   - end
480   - log["cint1"] = heroId
481   - log["cint2"] = heroType
482   - self:log("out_hero", log)
483   - else
484   - print("delHero no log ", debug.traceback())
485   - end
486   -
487   - SendPacket(actionCodes.Hero_loadInfos, MsgPack.pack({{id = heroId, bDel = true}}))
488   - end
489 439  
490 440 function Role:loadHeros()
491 441 local roleId = self:getProperty("id")
... ... @@ -1468,15 +1418,6 @@ function RolePlugin.bind(Role)
1468 1418 return RANK_ADV[idx]
1469 1419 end
1470 1420  
1471   - -- 是否需要进行引导
1472   - function Role:checkOverGuide(guideId)
1473   - local funcGuide = self:getProperty("funcGuide")
1474   - if funcGuide:getv(guideId, 0) > 0 then
1475   - return true
1476   - end
1477   - return false
1478   - end
1479   -
1480 1421 -- 消除指定tag 红点
1481 1422 function Role:clearRedPTag(tag)
1482 1423 local redp = self:getProperty("redp")
... ... @@ -1511,8 +1452,8 @@ function RolePlugin.bind(Role)
1511 1452 SendPacket(actionCodes.Store_ayncPurchaseRpc, MsgPack.pack({ result = "handled" }))
1512 1453 return
1513 1454 end
1514   -
1515   - local rechargeData = csvdb["shop_rechargeCsv"][orderObject:getProperty("rechargeId")]
  1455 + local rechargeId = orderObject:getProperty("rechargeId")
  1456 + local rechargeData = csvdb["shop_rechargeCsv"][rechargeId]
1516 1457 if rechargeData.rmb ~= tonumber(params.amount) then
1517 1458 skynet.error(string.format("fake order: %s, roleId: %d, order: %s, rmb %s, get %s",
1518 1459 params.transactionId, roleId, partnerOrderStr, rechargeData.rmb, params.amount
... ... @@ -1520,16 +1461,34 @@ function RolePlugin.bind(Role)
1520 1461 return
1521 1462 end
1522 1463  
1523   - local reward = self:recharge({
1524   - id = orderObject:getProperty("rechargeId"),
1525   - transactionId = params.transactionId,
1526   - pay_time = params.pay_time,
1527   - order = partnerOrderStr
  1464 + local order_type = self:getProperty("rmbC") > 0 and 0 or 1
  1465 + local status, reward = self:recharge({
  1466 + id = rechargeId
1528 1467 })
1529 1468 orderObject:setProperty("finishTime", skynet.time())
1530 1469 orderObject:setProperty("status", "finish")
1531 1470  
1532 1471 redisproxy:srem(string.format("role:%d:orders", roleId), partnerOrderStr)
  1472 +
  1473 + if not status then
  1474 + status = 200
  1475 + else
  1476 + status = 1000 + status
  1477 + end
  1478 + self:log("setOrder", {
  1479 + order_status = status, -- "订单状态:100 - 开始下单(玩家还未开始付费行为记录)200 - 支付完成并发货(SDK通知可以发货时记录),300 - 订单被取消,1000 - 其他"
  1480 + item_id = rechargeId, -- 道具id
  1481 + item_type = rechargeData.type, -- 购买的道具类型,具体见"onItems"方法中道具类型枚举表
  1482 + item_name = rechargeData.title, -- 购买的道具名
  1483 + item_number = 1, -- 购买的道具数量
  1484 + item_level = 1, -- 购买的道具等级
  1485 + order_cost = rechargeData.rmb * 100, -- 此次消费的现金金额(单位:分),如 51800即未518元,对应客户端SDK传入的'total_fee'
  1486 + order_currency = "CNY", -- 货币类型,默认为"CNY"(人民币),遵循ISO 4217规范
  1487 + order_type = order_type, -- 订单类型,首充记录为1,否则为0
  1488 + order_id = params.transactionId, -- 本条记录的订单号,对应客户端SDK返回的'bs_trade_no'
  1489 + })
  1490 + if status ~= 200 then return end
  1491 +
1533 1492 SendPacket(actionCodes.Store_ayncPurchaseRpc, MsgPack.pack({ order = partnerOrderStr,
1534 1493 result = "success", reward = reward}))
1535 1494  
... ... @@ -1542,11 +1501,11 @@ function RolePlugin.bind(Role)
1542 1501 local rechargeData = csvdb["shop_rechargeCsv"][id]
1543 1502 if not rechargeData then
1544 1503 skynet.error("recharge id not exist", id)
1545   - return
  1504 + return 1
1546 1505 end
1547 1506  
1548 1507 if not self.storeData:checkRechargeRecord(rechargeData.limit, id) then
1549   - return 1
  1508 + return 2
1550 1509 end
1551 1510  
1552 1511 local diamondCount = 0
... ... @@ -1561,13 +1520,13 @@ function RolePlugin.bind(Role)
1561 1520 end
1562 1521 self:gainDiamond({count = diamondCount, isRecharge = true, log = {desc = "recharge", int1 = id}})
1563 1522 elseif rechargeData.shop == 2 then --通行证商店
1564   - reward, _ = self:award(rechargeData.itemFirst, {log = {desc = "recharge", int1 = id}})
  1523 + reward, _ = self:award(rechargeData.itemFirst, {isRecharge = true, log = {desc = "recharge", int1 = id}})
1565 1524 self.storeData:onBuyCard(rechargeData.type, rechargeData.time)
1566 1525 elseif rechargeData.shop == 3 then -- 礼包商店
1567   - reward, _ = self:award(rechargeData.itemFirst, {log = {desc = "recharge", int1 = id}})
  1526 + reward, _ = self:award(rechargeData.itemFirst, {isRecharge = true, log = {desc = "recharge", int1 = id}})
1568 1527 else
1569 1528 skynet.error("invalid recharge shop type " .. id)
1570   - return
  1529 + return 3
1571 1530 end
1572 1531  
1573 1532 if diamondCount > 0 then
... ... @@ -1577,10 +1536,8 @@ function RolePlugin.bind(Role)
1577 1536 -- 累充
1578 1537 local rmb = rechargeData.rmb
1579 1538 self:updateProperty({field = "rmbC", delta = rmb})
1580   -
1581   - self:log("role_action", {desc = "recharge", int1 = id, int2 = rmb, key1 = params.transactionId, key2 = params.order, long1 = params.pay_time})
1582 1539  
1583   - return reward
  1540 + return nil, reward
1584 1541 end
1585 1542  
1586 1543 --直接给玩家发送邮件,立即推送小红点
... ... @@ -1601,6 +1558,50 @@ function RolePlugin.bind(Role)
1601 1558 self.sendMailFlag = true
1602 1559 end
1603 1560  
  1561 + -- 是否需要进行引导
  1562 + function Role:checkOverGuide(guideId,slave)
  1563 + local funcGuide = self:getProperty("funcGuide")
  1564 + if funcGuide:getv(guideId * 1000 + (slave or 0), 0) > 0 then
  1565 + return true
  1566 + end
  1567 + return false
  1568 + end
  1569 +
  1570 + -- 保存引导步骤
  1571 + function Role:saveGuide(master,slave,force)
  1572 + local newerGuide = self:getProperty("newerGuide")
  1573 + local guide = newerGuide:toArray(true,"=")
  1574 + local sMaster, sSlave = guide[1], guide[2]
  1575 +
  1576 + if not force and master < sMaster then return end
  1577 + if not force and master <= sMaster and slave < sSlave then return end
  1578 +
  1579 + local funcGuide = self:getProperty("funcGuide")
  1580 + funcGuide = funcGuide:setv(master * 1000 + slave, 1)
  1581 + if funcGuide:getv(master * 1000,0) == 0 then
  1582 + funcGuide = funcGuide:setv(master * 1000, 1)
  1583 + end
  1584 + self:updateProperty({field = "funcGuide", value = funcGuide})
  1585 + self:log("onGuidePoint", {guild_type = 0, guild_id = master, guild_point = slave, guild_pass = 0})
  1586 +
  1587 + newerGuide = string.format("%d=%d",master,slave)
  1588 + self:updateProperty({field = "newerGuide", value = newerGuide})
  1589 + end
  1590 +
  1591 + -- 引导大步骤结束
  1592 + function Role:finishGuide(master)
  1593 + local newerGuide = self:getProperty("newerGuide")
  1594 + local guide = newerGuide:toArray(true,"=")
  1595 + if guide[1] > master then return end
  1596 +
  1597 + local guideCsv = csvdb["guide_mainCsv"]
  1598 + local lastStep = guideCsv[master][#guideCsv[master]]
  1599 + if guideCsv[master + 1] then
  1600 + self:updateProperty({field = "newerGuide", value = string.format("%d=%d",master + 1,1)})
  1601 + else
  1602 + self:updateProperty({field = "newerGuide", value = "9999=1"})
  1603 + end
  1604 + end
1604 1605 end
1605 1606  
1606 1607 return RolePlugin
1607 1608 \ No newline at end of file
... ...
src/services/agent_ctrl.lua
... ... @@ -128,7 +128,7 @@ function _M:check_agent_status()
128 128 next_log_time = now + 60
129 129 local count = table_nums(self.u2f)
130 130 datacenter.set("onlineCount", count)
131   - pcall(skynet.send, logd, "lua", "log", "online", {count = count}, "online")
  131 + -- pcall(skynet.send, logd, "lua", "log", "online", {count = count}, "online")
132 132 end
133 133 end
134 134  
... ...
src/services/logd.lua
... ... @@ -55,38 +55,11 @@ skynet.register_protocol {
55 55 end
56 56 }
57 57  
58   -
59   -
60   --- 日志 index 不包含 日期的 index_suffix
61   -local IndexNoDate = {
62   - online = true,
63   -}
64   --- 不走 role log 的日志都要自行注意 mapping 设置【重要】
65   --- index_suffix index 后缀 默认为 common
66   -function CMD.log(logType, doc, index_suffix)
67   - index_suffix = index_suffix or "common"
68   - if index_suffix == "common" then
69   - doc["@type"] = logType
70   - else
71   - if logType ~= index_suffix then -- 定制后缀 不一定有type 不相等时才有type
72   - doc["@type"] = logType
73   - end
74   - end
75   -
76   - local now = skynet.timex()
77   - doc["timestamp"] = now
78   - doc["timestamp_f"] = os.date("%Y-%m-%d %H:%M:%S", now)
79   - doc["server"] = serverId
80   -
81   - -- 自己加好 index
82   - if IndexNoDate[index_suffix] then
83   - doc["@index"] = string.format("gamelog-%s", index_suffix)
84   - else
85   - doc["@index"] = string.format("gamelog-%s-%s", os.date("%Y%m%d", now), index_suffix)
86   - end
  58 +function CMD.log(doc)
87 59 if not socketdriver.send(log_fd, json.encode(doc) .. "\n") then
88 60 if not connecting then
89 61 CMD.open() -- 连一下试试
  62 + socketdriver.send(log_fd, json.encode(doc) .. "\n")
90 63 end
91 64 end
92 65 end
... ...