Commit dac9fbcc7db365e3b53199f0c4fd0af343ff7223

Authored by liuzujun
1 parent 2d07aef9

cb1活跃回馈

Showing 1 changed file with 33 additions and 0 deletions   Show diff stats
src/actions/RoleAction.lua
... ... @@ -340,6 +340,36 @@ function _M.loginRpc( agent, data )
340 340 return true
341 341 end
342 342  
  343 +local function onCb1Back(newRole)
  344 + -- cb1活跃返利
  345 + skynet.timeout(0, function()
  346 + local cbbackd = cluster.query("center", "cb1backd")
  347 + local uid = newRole:getProperty("uid")
  348 + local roleId = newRole:getProperty("id")
  349 + local start = uid:find("_")
  350 + if start then
  351 + uid = uid:sub(start + 1)
  352 + end
  353 + if cbbackd then
  354 + local status, back = pcall(cluster.call, "center", cbbackd, "getCb1Reward", {uid = uid, id = roleId})
  355 + if status then
  356 + if back then
  357 + if back == 0 then
  358 + mysqlproxy:insertEmail({roleId = roleId, emailId = MailId.CB1BackAward1, createtime = skynet.timex()})
  359 + elseif back == 1 then
  360 + mysqlproxy:insertEmail({roleId = roleId, emailId = MailId.CB1BackAward2, createtime = skynet.timex()})
  361 + end
  362 + newRole:mylog("cb1back", {key1 = uid, int2 = roleId, int1=back})
  363 + end
  364 + else
  365 + skynet.error("[ERROR] cb1backd cant call center uid: " .. uid .. " roleId:" .. roleId)
  366 + end
  367 + else
  368 + skynet.error("[ERROR] cb1backd cant call center uid: " .. uid .. " roleId:" .. roleId)
  369 + end
  370 + end)
  371 +end
  372 +
343 373 function _M.createRpc(agent, data)
344 374 local msg = MsgPack.unpack(data)
345 375 local response = {}
... ... @@ -446,6 +476,9 @@ function _M.createRpc(agent, data)
446 476 end
447 477 end)
448 478  
  479 + -- cb1活跃回馈
  480 + onCb1Back(newRole)
  481 +
449 482 return true
450 483 end
451 484  
... ...