From dac9fbcc7db365e3b53199f0c4fd0af343ff7223 Mon Sep 17 00:00:00 2001 From: liuzujun <307836273@qq.com> Date: Fri, 18 Jun 2021 11:51:05 +0800 Subject: [PATCH] cb1活跃回馈 --- src/actions/RoleAction.lua | 33 +++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+), 0 deletions(-) diff --git a/src/actions/RoleAction.lua b/src/actions/RoleAction.lua index 87e5daa..f0cb266 100644 --- a/src/actions/RoleAction.lua +++ b/src/actions/RoleAction.lua @@ -340,6 +340,36 @@ function _M.loginRpc( agent, data ) return true end +local function onCb1Back(newRole) + -- cb1活跃返利 + skynet.timeout(0, function() + local cbbackd = cluster.query("center", "cb1backd") + local uid = newRole:getProperty("uid") + local roleId = newRole:getProperty("id") + local start = uid:find("_") + if start then + uid = uid:sub(start + 1) + end + if cbbackd then + local status, back = pcall(cluster.call, "center", cbbackd, "getCb1Reward", {uid = uid, id = roleId}) + if status then + if back then + if back == 0 then + mysqlproxy:insertEmail({roleId = roleId, emailId = MailId.CB1BackAward1, createtime = skynet.timex()}) + elseif back == 1 then + mysqlproxy:insertEmail({roleId = roleId, emailId = MailId.CB1BackAward2, createtime = skynet.timex()}) + end + newRole:mylog("cb1back", {key1 = uid, int2 = roleId, int1=back}) + end + else + skynet.error("[ERROR] cb1backd cant call center uid: " .. uid .. " roleId:" .. roleId) + end + else + skynet.error("[ERROR] cb1backd cant call center uid: " .. uid .. " roleId:" .. roleId) + end + end) +end + function _M.createRpc(agent, data) local msg = MsgPack.unpack(data) local response = {} @@ -446,6 +476,9 @@ function _M.createRpc(agent, data) end end) + -- cb1活跃回馈 + onCb1Back(newRole) + return true end -- libgit2 0.21.2