Commit 3fbbd115dc90321b21f4430d0ad43ba00f70db15
Merge branch 'tr/develop' into cn/develop
Showing
5 changed files
with
143 additions
and
13 deletions
Show diff stats
src/actions/ActivityAction.lua
@@ -140,6 +140,13 @@ function _M.signRpc(agent, data) | @@ -140,6 +140,13 @@ function _M.signRpc(agent, data) | ||
140 | role:changeUpdates({{type = "sign", field = curDay, value = yearMonth}}) | 140 | role:changeUpdates({{type = "sign", field = curDay, value = yearMonth}}) |
141 | role:checkTaskEnter("SignIn") | 141 | role:checkTaskEnter("SignIn") |
142 | 142 | ||
143 | + if monthData[curDay].daily_sign_email ~= "" then | ||
144 | + local emails = monthData[curDay].daily_sign_email:toArray(true,"=") | ||
145 | + for _, emailId in pairs(emails) do | ||
146 | + redisproxy:insertEmail({roleId = role:getProperty("id"), emailId = emailId}) | ||
147 | + end | ||
148 | + end | ||
149 | + | ||
143 | SendPacket(actionCodes.Activity_signRpc, MsgPack.pack(role:packReward(reward, change))) | 150 | SendPacket(actionCodes.Activity_signRpc, MsgPack.pack(role:packReward(reward, change))) |
144 | return true | 151 | return true |
145 | end | 152 | end |
src/actions/StoreAction.lua
@@ -7,12 +7,13 @@ function _M.rechargeRpc(agent , data) | @@ -7,12 +7,13 @@ function _M.rechargeRpc(agent , data) | ||
7 | local role = agent.role | 7 | local role = agent.role |
8 | local msg = MsgPack.unpack(data) | 8 | local msg = MsgPack.unpack(data) |
9 | local id = msg.id | 9 | local id = msg.id |
10 | + local choose = msg.choose or "" | ||
10 | local dataSet = csvdb["shop_rechargeCsv"][id] | 11 | local dataSet = csvdb["shop_rechargeCsv"][id] |
11 | if not dataSet then return end | 12 | if not dataSet then return end |
12 | local roleId = role:getProperty("id") | 13 | local roleId = role:getProperty("id") |
13 | 14 | ||
14 | --创建订单号 | 15 | --创建订单号 |
15 | - local partnerOrderId = role:getPurchaseOrder(id) | 16 | + local partnerOrderId = role:getPurchaseOrder(id,nil,choose) |
16 | if partnerOrderId == "" then | 17 | if partnerOrderId == "" then |
17 | return 1 | 18 | return 1 |
18 | end | 19 | end |
@@ -161,13 +162,14 @@ function _M.googleRechargeRpc(agent, data) | @@ -161,13 +162,14 @@ function _M.googleRechargeRpc(agent, data) | ||
161 | local role = agent.role | 162 | local role = agent.role |
162 | local msg = MsgPack.unpack(data) | 163 | local msg = MsgPack.unpack(data) |
163 | local id = msg.id | 164 | local id = msg.id |
165 | + local choose = msg.choose or "" | ||
164 | local dataSet = csvdb["shop_rechargeCsv"][id] | 166 | local dataSet = csvdb["shop_rechargeCsv"][id] |
165 | if not dataSet then return end | 167 | if not dataSet then return end |
166 | local roleId = role:getProperty("id") | 168 | local roleId = role:getProperty("id") |
167 | 169 | ||
168 | role.ignoreHeartbeat = true | 170 | role.ignoreHeartbeat = true |
169 | --创建订单号 | 171 | --创建订单号 |
170 | - local partnerOrderId = role:getPurchaseOrder(id) | 172 | + local partnerOrderId = role:getPurchaseOrder(id,nil,choose) |
171 | -- 签名 | 173 | -- 签名 |
172 | -- local secret_key = "b7657fa7ccd44c16a35e3f454ac7a075" | 174 | -- local secret_key = "b7657fa7ccd44c16a35e3f454ac7a075" |
173 | local secret_key = "8920e9dcf0cb4ebca87393ce48021ead" | 175 | local secret_key = "8920e9dcf0cb4ebca87393ce48021ead" |
@@ -189,13 +191,14 @@ function _M.myCardRechargeRpc(agent, data) | @@ -189,13 +191,14 @@ function _M.myCardRechargeRpc(agent, data) | ||
189 | local role = agent.role | 191 | local role = agent.role |
190 | local msg = MsgPack.unpack(data) | 192 | local msg = MsgPack.unpack(data) |
191 | local id = msg.id | 193 | local id = msg.id |
194 | + local choose = msg.choose or "" | ||
192 | local dataSet = csvdb["shop_rechargeCsv"][id] | 195 | local dataSet = csvdb["shop_rechargeCsv"][id] |
193 | if not dataSet then return end | 196 | if not dataSet then return end |
194 | local roleId = role:getProperty("id") | 197 | local roleId = role:getProperty("id") |
195 | 198 | ||
196 | role.ignoreHeartbeat = true | 199 | role.ignoreHeartbeat = true |
197 | --创建订单号 | 200 | --创建订单号 |
198 | - local partnerOrderId = role:getPurchaseOrder(id) | 201 | + local partnerOrderId = role:getPurchaseOrder(id,nil,choose) |
199 | -- 签名 | 202 | -- 签名 |
200 | local secret_key = "48759e07540f46d9af17ec82669b4272" | 203 | local secret_key = "48759e07540f46d9af17ec82669b4272" |
201 | local need = { | 204 | local need = { |
@@ -215,13 +218,14 @@ function _M.iosRechargeRpc(agent, data) | @@ -215,13 +218,14 @@ function _M.iosRechargeRpc(agent, data) | ||
215 | local role = agent.role | 218 | local role = agent.role |
216 | local msg = MsgPack.unpack(data) | 219 | local msg = MsgPack.unpack(data) |
217 | local id = msg.id | 220 | local id = msg.id |
221 | + local choose = msg.choose or "" | ||
218 | local dataSet = csvdb["shop_rechargeCsv"][id] | 222 | local dataSet = csvdb["shop_rechargeCsv"][id] |
219 | if not dataSet then return end | 223 | if not dataSet then return end |
220 | local roleId = role:getProperty("id") | 224 | local roleId = role:getProperty("id") |
221 | 225 | ||
222 | role.ignoreHeartbeat = true | 226 | role.ignoreHeartbeat = true |
223 | --创建订单号 | 227 | --创建订单号 |
224 | - local partnerOrderId = role:getPurchaseOrder(id) | 228 | + local partnerOrderId = role:getPurchaseOrder(id,nil,choose) |
225 | -- 签名 | 229 | -- 签名 |
226 | local secret_key = "1916d62251dd4a8aa5e452121eefc9a1" | 230 | local secret_key = "1916d62251dd4a8aa5e452121eefc9a1" |
227 | local need = { | 231 | local need = { |
src/models/Order.lua
@@ -13,6 +13,7 @@ Order.schema = { | @@ -13,6 +13,7 @@ Order.schema = { | ||
13 | finishTime = {"number", 0}, -- 服务端验证完成时间 | 13 | finishTime = {"number", 0}, -- 服务端验证完成时间 |
14 | status = {"string", "create"}, | 14 | status = {"string", "create"}, |
15 | sid = {"number",0}, -- 创建单号的设备的sid | 15 | sid = {"number",0}, -- 创建单号的设备的sid |
16 | + choose = {"string", ""}, -- 自选奖励 | ||
16 | } | 17 | } |
17 | 18 | ||
18 | Order.fields = { | 19 | Order.fields = { |
@@ -23,6 +24,7 @@ Order.fields = { | @@ -23,6 +24,7 @@ Order.fields = { | ||
23 | finishTime = true, | 24 | finishTime = true, |
24 | status = true, | 25 | status = true, |
25 | sid = true, | 26 | sid = true, |
27 | + choose = true, | ||
26 | } | 28 | } |
27 | 29 | ||
28 | return Order | 30 | return Order |
29 | \ No newline at end of file | 31 | \ No newline at end of file |
src/models/RolePlugin.lua
@@ -1349,8 +1349,7 @@ function RolePlugin.bind(Role) | @@ -1349,8 +1349,7 @@ function RolePlugin.bind(Role) | ||
1349 | local donate = seaport.donate or {} | 1349 | local donate = seaport.donate or {} |
1350 | if not reset and (not donate[1] or not donate[2]) then | 1350 | if not reset and (not donate[1] or not donate[2]) then |
1351 | local result = self:getSeaportServerProgress() | 1351 | local result = self:getSeaportServerProgress() |
1352 | - local seaportCsv = csvdb["seaport_purchaseCsv"] | ||
1353 | - for idx, set in ipairs(seaportCsv) do | 1352 | + for idx, set in ipairs(csvdb["seaport_purchaseCsv"]) do |
1354 | local done = true | 1353 | local done = true |
1355 | for id, data in ipairs(set) do | 1354 | for id, data in ipairs(set) do |
1356 | if donate[id] or not result[idx] or not result[idx][id] or result[idx][id] < data.need_num then | 1355 | if donate[id] or not result[idx] or not result[idx][id] or result[idx][id] < data.need_num then |
@@ -1360,7 +1359,12 @@ function RolePlugin.bind(Role) | @@ -1360,7 +1359,12 @@ function RolePlugin.bind(Role) | ||
1360 | end | 1359 | end |
1361 | if done then | 1360 | if done then |
1362 | update = true | 1361 | update = true |
1363 | - self:award(set[1].phase_award, {log = {desc = "seaportReward", int1 = set[1].phase, int2 = set[1].id}}) | 1362 | + redisproxy:insertEmail({ |
1363 | + roleId = self:getProperty("id"), | ||
1364 | + emailId = idx == 1 and 361 or 362, | ||
1365 | + attachments = set[1].phase_award, | ||
1366 | + }) | ||
1367 | + -- self:award(set[1].phase_award, {log = {desc = "seaportReward", int1 = set[1].phase, int2 = set[1].id}}) | ||
1364 | donate[idx] = 1 | 1368 | donate[idx] = 1 |
1365 | end | 1369 | end |
1366 | end | 1370 | end |
@@ -1397,6 +1401,8 @@ function RolePlugin.bind(Role) | @@ -1397,6 +1401,8 @@ function RolePlugin.bind(Role) | ||
1397 | local expCarbonId = self:getProperty("hangInfo").expCarbonId | 1401 | local expCarbonId = self:getProperty("hangInfo").expCarbonId |
1398 | local taskCsv = csvdb["seaport_taskCsv"] | 1402 | local taskCsv = csvdb["seaport_taskCsv"] |
1399 | local endTime = openTime0 + 86400 * 2 | 1403 | local endTime = openTime0 + 86400 * 2 |
1404 | + local reward = {} | ||
1405 | + | ||
1400 | for slot, set in pairs(taskCsv) do | 1406 | for slot, set in pairs(taskCsv) do |
1401 | if collect[slot] then | 1407 | if collect[slot] then |
1402 | update = true | 1408 | update = true |
@@ -1433,9 +1439,28 @@ function RolePlugin.bind(Role) | @@ -1433,9 +1439,28 @@ function RolePlugin.bind(Role) | ||
1433 | itemReward[key] = math.ceil(1.5 * value) | 1439 | itemReward[key] = math.ceil(1.5 * value) |
1434 | end | 1440 | end |
1435 | end | 1441 | end |
1436 | - self:award(itemReward, {log = {desc = "seaportTask", int1 = slot, int2 = level}}) | 1442 | + |
1443 | + for itemId, value in pairs(itemReward) do | ||
1444 | + reward[itemId] = (reward[itemId] or 0) + value | ||
1445 | + end | ||
1446 | + -- self:award(itemReward, {log = {desc = "seaportTask", int1 = slot, int2 = level}}) | ||
1447 | + end | ||
1448 | + end | ||
1449 | + end | ||
1450 | + | ||
1451 | + if next(reward) then | ||
1452 | + local rewardStr = "" | ||
1453 | + for itemId, value in pairs(reward) do | ||
1454 | + if rewardStr ~= "" then | ||
1455 | + rewardStr = rewardStr .. " " | ||
1437 | end | 1456 | end |
1457 | + rewardStr = rewardStr .. string.format("%s=%s",itemId,value) | ||
1438 | end | 1458 | end |
1459 | + redisproxy:insertEmail({ | ||
1460 | + roleId = self:getProperty("id"), | ||
1461 | + emailId = 363, | ||
1462 | + attachments = rewardStr, | ||
1463 | + }) | ||
1439 | end | 1464 | end |
1440 | end | 1465 | end |
1441 | seaport.collect = {} | 1466 | seaport.collect = {} |
@@ -2022,7 +2047,7 @@ function RolePlugin.bind(Role) | @@ -2022,7 +2047,7 @@ function RolePlugin.bind(Role) | ||
2022 | return "error money" | 2047 | return "error money" |
2023 | end | 2048 | end |
2024 | -- 发现需要的id | 2049 | -- 发现需要的id |
2025 | - local partnerOrderId = self:getPurchaseOrder(k, params.transactionId) | 2050 | + local partnerOrderId = self:getPurchaseOrder(k, params.transactionId, params.choose) |
2026 | if partnerOrderId == "" then | 2051 | if partnerOrderId == "" then |
2027 | return "no product" | 2052 | return "no product" |
2028 | end | 2053 | end |
@@ -2032,7 +2057,7 @@ function RolePlugin.bind(Role) | @@ -2032,7 +2057,7 @@ function RolePlugin.bind(Role) | ||
2032 | end | 2057 | end |
2033 | 2058 | ||
2034 | -- 获取充值订单号 | 2059 | -- 获取充值订单号 |
2035 | - function Role:getPurchaseOrder(rechargeId, transactionId) | 2060 | + function Role:getPurchaseOrder(rechargeId, transactionId, choose) |
2036 | local roleId = self:getProperty("id") | 2061 | local roleId = self:getProperty("id") |
2037 | local rechargeData = csvdb["shop_rechargeCsv"][rechargeId] | 2062 | local rechargeData = csvdb["shop_rechargeCsv"][rechargeId] |
2038 | if not rechargeData then | 2063 | if not rechargeData then |
@@ -2044,7 +2069,24 @@ function RolePlugin.bind(Role) | @@ -2044,7 +2069,24 @@ function RolePlugin.bind(Role) | ||
2044 | if limit ~= 0 and limit <= (rechargeRecord[rechargeId] or 0) then | 2069 | if limit ~= 0 and limit <= (rechargeRecord[rechargeId] or 0) then |
2045 | return "" | 2070 | return "" |
2046 | end | 2071 | end |
2047 | - | 2072 | + -- 检查礼包自选奖励合法 |
2073 | + if choose and choose ~= "" then | ||
2074 | + if rechargeData.itemgift == "" then return "" end | ||
2075 | + local slot = rechargeData.itemdirect or 0 | ||
2076 | + local set = choose:toTableArray(true) | ||
2077 | + if slot ~= #set then return "" end | ||
2078 | + local pass = {} | ||
2079 | + local groups = rechargeData.itemgift:toTableArray(true) | ||
2080 | + for idx, item in ipairs(set) do | ||
2081 | + for _, group in ipairs(groups) do | ||
2082 | + if group[2] == item[1] and group[3] == item[2] and idx == group[1] then | ||
2083 | + pass[group[1]] = 1 | ||
2084 | + break | ||
2085 | + end | ||
2086 | + end | ||
2087 | + end | ||
2088 | + if #pass ~= slot then return "" end | ||
2089 | + end | ||
2048 | --判断是否是活动商品 | 2090 | --判断是否是活动商品 |
2049 | if rechargeData.activity_id ~= 0 then | 2091 | if rechargeData.activity_id ~= 0 then |
2050 | local actCfg = csvdb["activity_ctrlCsv"][rechargeData.activity_id] | 2092 | local actCfg = csvdb["activity_ctrlCsv"][rechargeData.activity_id] |
@@ -2071,6 +2113,7 @@ function RolePlugin.bind(Role) | @@ -2071,6 +2113,7 @@ function RolePlugin.bind(Role) | ||
2071 | createTime = skynet.timex(), | 2113 | createTime = skynet.timex(), |
2072 | transactionId = transactionId, | 2114 | transactionId = transactionId, |
2073 | sid = self:getProperty("sid"), | 2115 | sid = self:getProperty("sid"), |
2116 | + choose = choose or "", | ||
2074 | }) | 2117 | }) |
2075 | order:create() | 2118 | order:create() |
2076 | -- 正在进行中的订单 缓存 | 2119 | -- 正在进行中的订单 缓存 |
@@ -2139,7 +2182,7 @@ function RolePlugin.bind(Role) | @@ -2139,7 +2182,7 @@ function RolePlugin.bind(Role) | ||
2139 | }) | 2182 | }) |
2140 | end | 2183 | end |
2141 | 2184 | ||
2142 | - return true, rechargeId, sid | 2185 | + return true, rechargeId, sid, orderObject:getProperty("choose") |
2143 | end | 2186 | end |
2144 | 2187 | ||
2145 | -- 充值 -- | 2188 | -- 充值 -- |
@@ -2157,7 +2200,7 @@ function RolePlugin.bind(Role) | @@ -2157,7 +2200,7 @@ function RolePlugin.bind(Role) | ||
2157 | local roleId = self:getProperty("id") | 2200 | local roleId = self:getProperty("id") |
2158 | local partnerOrderStr = params.order | 2201 | local partnerOrderStr = params.order |
2159 | 2202 | ||
2160 | - local status, back, sid = self:updatePurchaseOrder(partnerOrderStr, params.transactionId, "finsh") | 2203 | + local status, back, sid, choose = self:updatePurchaseOrder(partnerOrderStr, params.transactionId, "finsh") |
2161 | if not status then | 2204 | if not status then |
2162 | if back == "finsh" then | 2205 | if back == "finsh" then |
2163 | -- 订单已经处理 | 2206 | -- 订单已经处理 |
@@ -2180,6 +2223,7 @@ function RolePlugin.bind(Role) | @@ -2180,6 +2223,7 @@ function RolePlugin.bind(Role) | ||
2180 | pay_time = params.pay_time, | 2223 | pay_time = params.pay_time, |
2181 | order = partnerOrderStr, | 2224 | order = partnerOrderStr, |
2182 | sid = sid, | 2225 | sid = sid, |
2226 | + choose = choose, | ||
2183 | }) | 2227 | }) |
2184 | 2228 | ||
2185 | if not status then | 2229 | if not status then |
@@ -2227,6 +2271,17 @@ function RolePlugin.bind(Role) | @@ -2227,6 +2271,17 @@ function RolePlugin.bind(Role) | ||
2227 | return 3 | 2271 | return 3 |
2228 | end | 2272 | end |
2229 | 2273 | ||
2274 | + -- 自选奖励部分 | ||
2275 | + if params.choose and params.choose ~= "" then | ||
2276 | + local tReward, tChange = self:award(params.choose, {log = {desc = "recharge", int1 = id}}) | ||
2277 | + for itemId, value in pairs(tReward) do | ||
2278 | + reward[itemId] = (reward[itemId] or 0) + value | ||
2279 | + end | ||
2280 | + for itemId, value in pairs(tChange or {}) do | ||
2281 | + reward[itemId] = (reward[itemId] or 0) + value | ||
2282 | + end | ||
2283 | + end | ||
2284 | + | ||
2230 | if diamondCount > 0 then | 2285 | if diamondCount > 0 then |
2231 | reward[ItemId.Diamond] = (reward[ItemId.Diamond] or 0) + diamondCount | 2286 | reward[ItemId.Diamond] = (reward[ItemId.Diamond] or 0) + diamondCount |
2232 | end | 2287 | end |
src/services/globald.lua
@@ -184,6 +184,67 @@ local function check_trade_seaport_status() | @@ -184,6 +184,67 @@ local function check_trade_seaport_status() | ||
184 | skynet.timeout(interval, check_trade_seaport_status) | 184 | skynet.timeout(interval, check_trade_seaport_status) |
185 | end | 185 | end |
186 | 186 | ||
187 | +-- @desc: 海港贸易捐赠作弊 | ||
188 | +local seaportTimes = {} | ||
189 | +local function check_trade_seaport_donate() | ||
190 | + local time1 = tonumber(redisproxy:hget("autoincrement_set", "seaportTime1")) or 0 | ||
191 | + local time2 = tonumber(redisproxy:hget("autoincrement_set", "seaportTime2")) or 0 | ||
192 | + if time1 == 0 and time2 == 0 then | ||
193 | + seaportTimes = {} | ||
194 | + skynet.timeout(360000, check_trade_seaport_donate) | ||
195 | + return | ||
196 | + end | ||
197 | + | ||
198 | + local csvdb = require "shared.csvdata" | ||
199 | + local donateCsv = csvdb["seaport_purchaseCsv"] | ||
200 | + | ||
201 | + local times = {time1, time2} | ||
202 | + for phase, open in ipairs(times) do | ||
203 | + if open == 1 and not seaportTimes[phase] then | ||
204 | + seaportTimes[phase] = {} | ||
205 | + for _, _ in ipairs(donateCsv[phase]) do | ||
206 | + table.insert(seaportTimes[phase],math.randomInt(1800, 3600)) | ||
207 | + end | ||
208 | + end | ||
209 | + end | ||
210 | + | ||
211 | + local interval = 3600 | ||
212 | + local phase, id = 0, 0 | ||
213 | + | ||
214 | + for key1, data in ipairs(seaportTimes) do | ||
215 | + for key2, temp in pairs(data) do | ||
216 | + if times[key1] == 1 and temp < interval then | ||
217 | + interval = temp | ||
218 | + phase = key1 | ||
219 | + id = key2 | ||
220 | + end | ||
221 | + end | ||
222 | + end | ||
223 | + | ||
224 | + for _, data in ipairs(seaportTimes) do | ||
225 | + for id, temp in pairs(data) do | ||
226 | + data[id] = temp - interval | ||
227 | + if data[id] == 0 then | ||
228 | + data[id] = math.randomInt(1800, 3600) | ||
229 | + end | ||
230 | + end | ||
231 | + end | ||
232 | + | ||
233 | + if phase ~= 0 and id ~= 0 then | ||
234 | + local redisKeys = {SEAPORT_TRADE_TASK_1,SEAPORT_TRADE_TASK_2} | ||
235 | + local all = donateCsv[phase][id].need_num | ||
236 | + local old = tonumber(redisproxy:hget(redisKeys[phase],id)) or 0 | ||
237 | + local add = math.min(math.randomInt(math.floor(all/20),math.floor(all/12)),all - old) | ||
238 | + if add > 0 then | ||
239 | + redisproxy:hincrby(redisKeys[phase],id,add) | ||
240 | + else | ||
241 | + seaportTimes[phase][id] = nil | ||
242 | + end | ||
243 | + end | ||
244 | + | ||
245 | + skynet.timeout(interval * 100, check_trade_seaport_donate) | ||
246 | +end | ||
247 | + | ||
187 | local CMD = {} | 248 | local CMD = {} |
188 | 249 | ||
189 | 250 | ||
@@ -208,6 +269,7 @@ function CMD.start() | @@ -208,6 +269,7 @@ function CMD.start() | ||
208 | check_mail_queue() | 269 | check_mail_queue() |
209 | --check_battle_act_close() | 270 | --check_battle_act_close() |
210 | check_trade_seaport_status() | 271 | check_trade_seaport_status() |
272 | + check_trade_seaport_donate() | ||
211 | end | 273 | end |
212 | 274 | ||
213 | local function __init__() | 275 | local function __init__() |