Commit 320f5b54ac9df76be6e8d883d9babb61013b8db1
1 parent
0a093ba8
cb 返利
Showing
4 changed files
with
32 additions
and
0 deletions
Show diff stats
src/GlobalVar.lua
src/actions/RoleAction.lua
| ... | ... | @@ -300,6 +300,7 @@ function _M.loginRpc( agent, data ) |
| 300 | 300 | if msg.newdevice then |
| 301 | 301 | role:mylog("newdevice", {key1 = agent.ip:toArray(false, ":")[1]}) |
| 302 | 302 | end |
| 303 | + | |
| 303 | 304 | return true |
| 304 | 305 | end |
| 305 | 306 | |
| ... | ... | @@ -372,6 +373,34 @@ function _M.createRpc(agent, data) |
| 372 | 373 | end |
| 373 | 374 | |
| 374 | 375 | SendPacket(actionCodes.Role_createRpc, MsgPack.pack(response)) |
| 376 | + | |
| 377 | + -- cb付费返利 | |
| 378 | + skynet.timeout(0, function() | |
| 379 | + local cbbackd = cluster.query("center", "cbbackd") | |
| 380 | + local uid = newRole:getProperty("uid") | |
| 381 | + local start = uid:find("_") | |
| 382 | + if start then | |
| 383 | + uid = uid:sub(start + 1) | |
| 384 | + end | |
| 385 | + if cbbackd then | |
| 386 | + local status, back = pcall(cluster.call, "center", cbbackd, "getCbBack", {uid = uid, id = roleId}) | |
| 387 | + if status then | |
| 388 | + if back and next(back) then | |
| 389 | + local reward = "" | |
| 390 | + for itemId, count in pairs(back) do | |
| 391 | + reward = reward:setv(itemId, count) | |
| 392 | + end | |
| 393 | + redisproxy:insertEmail({roleId = roleId, emailId = MailId.CBBackAward, createtime = skynet.timex(), attachments = reward}) | |
| 394 | + newRole:mylog("cbback", {key1 = uid, int2 = roleId}) | |
| 395 | + end | |
| 396 | + else | |
| 397 | + skynet.error("[ERROR] cbbackd cant call center uid: " .. uid .. " roleId:" .. roleId) | |
| 398 | + end | |
| 399 | + else | |
| 400 | + skynet.error("[ERROR] cbbackd cant call center uid: " .. uid .. " roleId:" .. roleId) | |
| 401 | + end | |
| 402 | + end) | |
| 403 | + | |
| 375 | 404 | return true |
| 376 | 405 | end |
| 377 | 406 | ... | ... |
src/agent.lua
| ... | ... | @@ -15,6 +15,7 @@ redisproxy = require "shared.redisproxy" |
| 15 | 15 | datacenter = require "skynet.datacenter" |
| 16 | 16 | mcast_util = require "services/mcast_util" |
| 17 | 17 | csvdb = require "shared.csvdata" |
| 18 | +cluster = require "skynet.cluster" | |
| 18 | 19 | |
| 19 | 20 | local CMD = {} |
| 20 | 21 | local agentInfo = {} -- { client_fd, role, gate_serv, open_timer} | ... | ... |