diff --git a/src/GlobalVar.lua b/src/GlobalVar.lua index 281e9fd..f34c4d7 100644 --- a/src/GlobalVar.lua +++ b/src/GlobalVar.lua @@ -322,6 +322,7 @@ MailId = { PaySignAward = 241, PayBackAward = 242, + CBBackAward = 243, } TriggerEventType = { diff --git a/src/actions/RoleAction.lua b/src/actions/RoleAction.lua index af4f166..fba220d 100644 --- a/src/actions/RoleAction.lua +++ b/src/actions/RoleAction.lua @@ -300,6 +300,7 @@ function _M.loginRpc( agent, data ) if msg.newdevice then role:mylog("newdevice", {key1 = agent.ip:toArray(false, ":")[1]}) end + return true end @@ -372,6 +373,34 @@ function _M.createRpc(agent, data) end SendPacket(actionCodes.Role_createRpc, MsgPack.pack(response)) + + -- cb付费返利 + skynet.timeout(0, function() + local cbbackd = cluster.query("center", "cbbackd") + local uid = newRole:getProperty("uid") + local start = uid:find("_") + if start then + uid = uid:sub(start + 1) + end + if cbbackd then + local status, back = pcall(cluster.call, "center", cbbackd, "getCbBack", {uid = uid, id = roleId}) + if status then + if back and next(back) then + local reward = "" + for itemId, count in pairs(back) do + reward = reward:setv(itemId, count) + end + redisproxy:insertEmail({roleId = roleId, emailId = MailId.CBBackAward, createtime = skynet.timex(), attachments = reward}) + newRole:mylog("cbback", {key1 = uid, int2 = roleId}) + end + else + skynet.error("[ERROR] cbbackd cant call center uid: " .. uid .. " roleId:" .. roleId) + end + else + skynet.error("[ERROR] cbbackd cant call center uid: " .. uid .. " roleId:" .. roleId) + end + end) + return true end diff --git a/src/agent.lua b/src/agent.lua index b7b5fd7..2232513 100644 --- a/src/agent.lua +++ b/src/agent.lua @@ -15,6 +15,7 @@ redisproxy = require "shared.redisproxy" datacenter = require "skynet.datacenter" mcast_util = require "services/mcast_util" csvdb = require "shared.csvdata" +cluster = require "skynet.cluster" local CMD = {} local agentInfo = {} -- { client_fd, role, gate_serv, open_timer} diff --git a/src/models/RoleLog.lua b/src/models/RoleLog.lua index e292bf9..156c851 100644 --- a/src/models/RoleLog.lua +++ b/src/models/RoleLog.lua @@ -583,6 +583,7 @@ local LogType = { logout = "common", guide = "common", newdevice = "common", + cbback = "common", in_item = "common", out_item = "common", -- libgit2 0.21.2