Commit 1630cd4d0a0df03d59a469a8c415062fe7221116
Merge branch 'tr/develop' of 120.26.43.151:wasteland/server into tr/develop
Showing
6 changed files
with
99 additions
and
56 deletions
Show diff stats
src/actions/SeaportAction.lua
@@ -26,25 +26,41 @@ function _M.donateRpc(agent, data) | @@ -26,25 +26,41 @@ function _M.donateRpc(agent, data) | ||
26 | if itemId == 0 or itemCount == 0 then return 0 end | 26 | if itemId == 0 or itemCount == 0 then return 0 end |
27 | if role:getItemCount(itemId) < itemCount then return 1 end | 27 | if role:getItemCount(itemId) < itemCount then return 1 end |
28 | local DonateCsv = csvdb["seaport_purchaseCsv"] | 28 | local DonateCsv = csvdb["seaport_purchaseCsv"] |
29 | - if DonateCsv[phase] or not DonateCsv[phase][id] then return 2 end | 29 | + if not DonateCsv[phase] or not DonateCsv[phase][id] then return 2 end |
30 | 30 | ||
31 | - local data = DonateCsv[phase][id] | ||
32 | - local needs = data.need_item:toArray("=",true) | 31 | + local ddata = DonateCsv[phase][id] |
32 | + local needs = ddata.need_item:toArray(true,"=") | ||
33 | if itemId ~= needs[1] then return 3 end | 33 | if itemId ~= needs[1] then return 3 end |
34 | if itemCount % needs[2] ~= 0 then return 4 end | 34 | if itemCount % needs[2] ~= 0 then return 4 end |
35 | 35 | ||
36 | local group = itemCount / needs[2] | 36 | local group = itemCount / needs[2] |
37 | - local rewards = data.award:toNumMap() | 37 | + local rewards = ddata.award:toNumMap() |
38 | 38 | ||
39 | for id, value in pairs(rewards) do | 39 | for id, value in pairs(rewards) do |
40 | rewards[id] = value * group | 40 | rewards[id] = value * group |
41 | end | 41 | end |
42 | 42 | ||
43 | - local rediskey = {SEAPORT_TRADE_TASK_1,SEAPORT_TRADE_TASK_2} | ||
44 | - redisproxy:hincrby(rediskey[phase],id,itemCount) | 43 | + if phase == 1 then |
44 | + local old = tonumber(redisproxy:hget(SEAPORT_TRADE_TASK_1,id)) or 0 | ||
45 | + local need = ddata.need_num - old | ||
46 | + if need >= itemCount then | ||
47 | + redisproxy:hincrby(SEAPORT_TRADE_TASK_1,id,itemCount) | ||
48 | + else | ||
49 | + redisproxy:hincrby(SEAPORT_TRADE_TASK_1,id,need) | ||
50 | + for _, temp in pairs(DonateCsv[2]) do | ||
51 | + local items = temp.need_item:toArray(true,"=") | ||
52 | + if items[1] == itemId then | ||
53 | + redisproxy:hincrby(SEAPORT_TRADE_TASK_2,temp.id,itemCount - need) | ||
54 | + break | ||
55 | + end | ||
56 | + end | ||
57 | + end | ||
58 | + else | ||
59 | + redisproxy:hincrby(SEAPORT_TRADE_TASK_2,id,itemCount) | ||
60 | + end | ||
45 | 61 | ||
46 | role:costItems({[itemId] = itemCount}, {log = {desc = "seaportDonate", int1 = phase, int2 = id}}) | 62 | role:costItems({[itemId] = itemCount}, {log = {desc = "seaportDonate", int1 = phase, int2 = id}}) |
47 | - local reward, change = role:award(rewards, {log = {desc = "seaportDonate", int1 = data.phase, int2 = data.id}}) | 63 | + local reward, change = role:award(rewards, {log = {desc = "seaportDonate", int1 = ddata.phase, int2 = ddata.id}}) |
48 | 64 | ||
49 | role:mylog("role_action", {desc = "seaportDonate", int1 = itemId, int2 = itemCount}) | 65 | role:mylog("role_action", {desc = "seaportDonate", int1 = itemId, int2 = itemCount}) |
50 | 66 | ||
@@ -123,19 +139,27 @@ function _M.taskRpc(agent, data) | @@ -123,19 +139,27 @@ function _M.taskRpc(agent, data) | ||
123 | if not TaskCsv[taskId] or not TaskCsv[taskId][level] then return 1 end | 139 | if not TaskCsv[taskId] or not TaskCsv[taskId][level] then return 1 end |
124 | 140 | ||
125 | local reward, change = {}, {} | 141 | local reward, change = {}, {} |
142 | + local heroFaithMap = {} | ||
126 | local seaport = role:getProperty("seaport") | 143 | local seaport = role:getProperty("seaport") |
127 | 144 | ||
128 | local data = TaskCsv[taskId][level] | 145 | local data = TaskCsv[taskId][level] |
146 | + if data.phase == 2 then | ||
147 | + local openTime = tonumber(redisproxy:hget("autoincrement_set", "seaportTime0")) or 0 | ||
148 | + local nowTime = skynet.timex() | ||
149 | + if nowTime < (openTime + 86400) or nowTime > (openTime + 172800) then return 9 end | ||
150 | + end | ||
151 | + | ||
129 | if oper == 1 then -- 开始委托 | 152 | if oper == 1 then -- 开始委托 |
130 | if team == "" then return 3 end | 153 | if team == "" then return 3 end |
131 | local conditions = data.condition:toTableArray(true) | 154 | local conditions = data.condition:toTableArray(true) |
132 | - local heros = team:toNumMap() | 155 | + local heros = team:toArray(true,"=") |
156 | + if not next(heros) then return 8 end | ||
133 | local UnitCsv = csvdb["unitCsv"] | 157 | local UnitCsv = csvdb["unitCsv"] |
134 | for _, conds in pairs(conditions) do | 158 | for _, conds in pairs(conditions) do |
135 | local count = 0 | 159 | local count = 0 |
136 | for _, heroId in pairs(heros) do | 160 | for _, heroId in pairs(heros) do |
137 | local hero = role.heros[heroId] | 161 | local hero = role.heros[heroId] |
138 | - if not hero then return end | 162 | + if not hero then return 8 end |
139 | 163 | ||
140 | if conds[1] == 1 then | 164 | if conds[1] == 1 then |
141 | if hero:getProperty("level") >= conds[2] then | 165 | if hero:getProperty("level") >= conds[2] then |
@@ -169,7 +193,7 @@ function _M.taskRpc(agent, data) | @@ -169,7 +193,7 @@ function _M.taskRpc(agent, data) | ||
169 | end | 193 | end |
170 | local quick = msg.quick | 194 | local quick = msg.quick |
171 | local endTime = data.time + collect.time | 195 | local endTime = data.time + collect.time |
172 | - local remainT = skynet.timex() - endTime | 196 | + local remainT = endTime - skynet.timex() |
173 | if not quick and remainT > 0 then return 6 end | 197 | if not quick and remainT > 0 then return 6 end |
174 | 198 | ||
175 | if quick and remainT > 0 then | 199 | if quick and remainT > 0 then |
@@ -180,15 +204,15 @@ function _M.taskRpc(agent, data) | @@ -180,15 +204,15 @@ function _M.taskRpc(agent, data) | ||
180 | 204 | ||
181 | local carbonCsv = csvdb["idle_battleCsv"] | 205 | local carbonCsv = csvdb["idle_battleCsv"] |
182 | local expCarbonId = role:getProperty("hangInfo").expCarbonId | 206 | local expCarbonId = role:getProperty("hangInfo").expCarbonId |
183 | - local coidCarbonId = role:getProperty("hangInfo").carbonId | ||
184 | - if not carbonCsv[expCarbonId] or not expCarbonId[coidCarbonId] then return 7 end | 207 | + if not carbonCsv[expCarbonId] then return 7 end |
185 | 208 | ||
186 | local totalCoef = 0 | 209 | local totalCoef = 0 |
187 | - for _, heroId in ipairs(collect.team:toNumMap()) do | 210 | + for _, heroId in ipairs(collect.team:toArray(true,"=")) do |
188 | local hero = role.heros[heroId] | 211 | local hero = role.heros[heroId] |
189 | if hero then | 212 | if hero then |
190 | totalCoef = totalCoef + getHeroCoef(hero, data.success) | 213 | totalCoef = totalCoef + getHeroCoef(hero, data.success) |
191 | hero:addHeroFaith(data.trust) | 214 | hero:addHeroFaith(data.trust) |
215 | + heroFaithMap[heroId] = hero:getProperty("faith") | ||
192 | end | 216 | end |
193 | end | 217 | end |
194 | 218 | ||
@@ -198,8 +222,8 @@ function _M.taskRpc(agent, data) | @@ -198,8 +222,8 @@ function _M.taskRpc(agent, data) | ||
198 | bigSuccess = true | 222 | bigSuccess = true |
199 | end | 223 | end |
200 | 224 | ||
201 | - local money = math.ceil(carbonCsv[coidCarbonId].money / 5 * data.time * carbonCsv[coidCarbonId].money_clear) | ||
202 | - local exp = math.ceil(carbonCsv[expCarbonId].exp / 5 * data.time * carbonCsv[expCarbonId].exp_clear) | 225 | + local money = math.ceil(carbonCsv[expCarbonId].money / 5 * data.time * data.money_clear) |
226 | + local exp = math.ceil(carbonCsv[expCarbonId].exp / 5 * data.time * data.exp_clear) | ||
203 | local itemReward = data.item_clear_special:toNumMap() | 227 | local itemReward = data.item_clear_special:toNumMap() |
204 | itemReward[ItemId.Gold] = (itemReward[ItemId.Gold] or 0) + money | 228 | itemReward[ItemId.Gold] = (itemReward[ItemId.Gold] or 0) + money |
205 | itemReward[ItemId.Exp] = (itemReward[ItemId.Exp] or 0) + exp | 229 | itemReward[ItemId.Exp] = (itemReward[ItemId.Exp] or 0) + exp |
@@ -219,7 +243,10 @@ function _M.taskRpc(agent, data) | @@ -219,7 +243,10 @@ function _M.taskRpc(agent, data) | ||
219 | 243 | ||
220 | role:updateProperty({field = "seaport", value = seaport}) | 244 | role:updateProperty({field = "seaport", value = seaport}) |
221 | 245 | ||
222 | - SendPacket(actionCodes.Seaport_taskRpc, MsgPack.pack(role:packReward(reward, change))) | 246 | + local result = role:packReward(reward, change) |
247 | + result["heroFaith"] = heroFaithMap | ||
248 | + | ||
249 | + SendPacket(actionCodes.Seaport_taskRpc, MsgPack.pack(result)) | ||
223 | return true | 250 | return true |
224 | end | 251 | end |
225 | 252 | ||
@@ -229,33 +256,40 @@ function _M.shopRpc(agent, data) | @@ -229,33 +256,40 @@ function _M.shopRpc(agent, data) | ||
229 | local id = msg.id or 0 | 256 | local id = msg.id or 0 |
230 | local count = msg.count or 1 | 257 | local count = msg.count or 1 |
231 | 258 | ||
232 | - local seaport = role:getProperty{"seaport"} | ||
233 | - local shop = seaport.shop or {} | ||
234 | - | ||
235 | - if (shop[id] or 0) >= data.limit then return 1 end | ||
236 | - | ||
237 | local shopCsv = {} | 259 | local shopCsv = {} |
238 | local dataSet = csvdb["shop_normalCsv"] | 260 | local dataSet = csvdb["shop_normalCsv"] |
239 | - for _, data in pairs(dataSet) do | ||
240 | - if data.shop == 5 then | ||
241 | - shopCsv[data.id] = data | 261 | + for _, datat in pairs(dataSet) do |
262 | + if datat.shop == 5 then | ||
263 | + shopCsv[datat.id] = datat | ||
242 | end | 264 | end |
243 | end | 265 | end |
266 | + local sdata = shopCsv[id] | ||
267 | + | ||
268 | + if not sdata then return 2 end | ||
269 | + | ||
270 | + local seaport = role:getProperty("seaport") | ||
271 | + local shop = seaport.shop or {} | ||
244 | 272 | ||
245 | - local data = shopCsv[id] | ||
246 | - if not data then return 2 end | 273 | + if (shop[id] or 0) >= sdata.limit then return 1 end |
247 | 274 | ||
248 | - if role:getItemCount(data.icon) < data.cost * count then return 3 end | 275 | + |
276 | + | ||
277 | + | ||
249 | 278 | ||
250 | - role:costItems({[data.icon] = data.cost * count}, {log = {desc = "seaportShop", int1 = id, int2 = count}}) | 279 | + if role:getItemCount(sdata.icon) < sdata.cost * count then return 3 end |
251 | 280 | ||
252 | - local itemReward = data.gift:toNumMap() | 281 | + role:costItems({[sdata.icon] = sdata.cost * count}, {log = {desc = "seaportShop", int1 = id, int2 = count}}) |
282 | + | ||
283 | + local itemReward = sdata.gift:toNumMap() | ||
253 | for itemId, value in pairs(itemReward) do | 284 | for itemId, value in pairs(itemReward) do |
254 | itemReward[itemId] = value * count | 285 | itemReward[itemId] = value * count |
255 | end | 286 | end |
256 | 287 | ||
257 | local reward, change = role:award(itemReward, {log = {desc = "seaportShop", int1 = id, int2 = count}}) | 288 | local reward, change = role:award(itemReward, {log = {desc = "seaportShop", int1 = id, int2 = count}}) |
258 | 289 | ||
290 | + shop[id] = (shop[id] or 0) + count | ||
291 | + seaport.shop = shop | ||
292 | + | ||
259 | role:updateProperty({field = "seaport", value = seaport}) | 293 | role:updateProperty({field = "seaport", value = seaport}) |
260 | 294 | ||
261 | SendPacket(actionCodes.Seaport_shopRpc, MsgPack.pack(role:packReward(reward, change))) | 295 | SendPacket(actionCodes.Seaport_shopRpc, MsgPack.pack(role:packReward(reward, change))) |
src/actions/TowerAction.lua
@@ -109,7 +109,9 @@ function _M.endBattleRpc(agent, data) | @@ -109,7 +109,9 @@ function _M.endBattleRpc(agent, data) | ||
109 | 109 | ||
110 | curLevel = curLevel + 1 | 110 | curLevel = curLevel + 1 |
111 | reward, change = role:award(curTower.reward, {log = {desc = "towerBattle", int1 = id}}) | 111 | reward, change = role:award(curTower.reward, {log = {desc = "towerBattle", int1 = id}}) |
112 | - role:checkTaskEnter("TowerPass", {count = 1, type = towerType + 1}) | 112 | + if towerType == 0 then |
113 | + role:checkTaskEnter("TowerPass", {level = towerInfo.l}) | ||
114 | + end | ||
113 | end | 115 | end |
114 | 116 | ||
115 | if towerType == 0 then | 117 | if towerType == 0 then |
src/models/Diner.lua
@@ -193,10 +193,6 @@ function Diner:calSellReward(sell, delta, dishData, isExpedite) | @@ -193,10 +193,6 @@ function Diner:calSellReward(sell, delta, dishData, isExpedite) | ||
193 | local addReward = {} | 193 | local addReward = {} |
194 | for key, value in pairs(dishData.item_normal:toNumMap()) do | 194 | for key, value in pairs(dishData.item_normal:toNumMap()) do |
195 | addReward[key] = (addReward[key] or 0) + value * delta | 195 | addReward[key] = (addReward[key] or 0) + value * delta |
196 | - if key == ItemId.Gold then | ||
197 | - local goldPriceAdd = self.owner:getBnousDiner(4,value) | ||
198 | - addReward[key] = addReward[key] + goldPriceAdd * delta | ||
199 | - end | ||
200 | end | 196 | end |
201 | 197 | ||
202 | popular = dishData.famous_normal * delta | 198 | popular = dishData.famous_normal * delta |
@@ -234,10 +230,16 @@ function Diner:calSellReward(sell, delta, dishData, isExpedite) | @@ -234,10 +230,16 @@ function Diner:calSellReward(sell, delta, dishData, isExpedite) | ||
234 | end | 230 | end |
235 | upValue[-1] = (upValue[-1] or 0) + collectAdd | 231 | upValue[-1] = (upValue[-1] or 0) + collectAdd |
236 | 232 | ||
233 | + -- 电波塔加成 | ||
234 | + local goldCount = self.owner:getBnousDiner(4,addReward[ItemId.Gold]) | ||
235 | + | ||
237 | for id, count in pairs(addReward) do | 236 | for id, count in pairs(addReward) do |
238 | addReward[id] = math.floor(count * (1 + (upValue[id] or 0) / 100)) | 237 | addReward[id] = math.floor(count * (1 + (upValue[id] or 0) / 100)) |
239 | reward = reward:incrv(id, addReward[id]) | 238 | reward = reward:incrv(id, addReward[id]) |
240 | end | 239 | end |
240 | + | ||
241 | + reward = reward:incrv(ItemId.Gold, goldCount) | ||
242 | + | ||
241 | popular = math.floor(popular * (1 + (upValue[-1] or 0) / 100)) | 243 | popular = math.floor(popular * (1 + (upValue[-1] or 0) / 100)) |
242 | 244 | ||
243 | return reward, popular | 245 | return reward, popular |
src/models/RolePlugin.lua
@@ -1351,8 +1351,8 @@ function RolePlugin.bind(Role) | @@ -1351,8 +1351,8 @@ function RolePlugin.bind(Role) | ||
1351 | end | 1351 | end |
1352 | if done then | 1352 | if done then |
1353 | update = true | 1353 | update = true |
1354 | - self:award(data.phase_award, {log = {desc = "seaportReward", int1 = set[1].phase, int2 = set[1].id}}) | ||
1355 | - donate[id] = 1 | 1354 | + self:award(set[1].phase_award, {log = {desc = "seaportReward", int1 = set[1].phase, int2 = set[1].id}}) |
1355 | + donate[idx] = 1 | ||
1356 | end | 1356 | end |
1357 | end | 1357 | end |
1358 | seaport.donate = donate | 1358 | seaport.donate = donate |
@@ -1386,7 +1386,6 @@ function RolePlugin.bind(Role) | @@ -1386,7 +1386,6 @@ function RolePlugin.bind(Role) | ||
1386 | 1386 | ||
1387 | local carbonCsv = csvdb["idle_battleCsv"] | 1387 | local carbonCsv = csvdb["idle_battleCsv"] |
1388 | local expCarbonId = self:getProperty("hangInfo").expCarbonId | 1388 | local expCarbonId = self:getProperty("hangInfo").expCarbonId |
1389 | - local coidCarbonId = self:getProperty("hangInfo").carbonId | ||
1390 | local taskCsv = csvdb["seaport_taskCsv"] | 1389 | local taskCsv = csvdb["seaport_taskCsv"] |
1391 | local endTime = openTime0 + 86400 * 2 | 1390 | local endTime = openTime0 + 86400 * 2 |
1392 | for slot, set in pairs(taskCsv) do | 1391 | for slot, set in pairs(taskCsv) do |
@@ -1397,10 +1396,10 @@ function RolePlugin.bind(Role) | @@ -1397,10 +1396,10 @@ function RolePlugin.bind(Role) | ||
1397 | local teams = collect[slot].team | 1396 | local teams = collect[slot].team |
1398 | local time = collect[slot].time | 1397 | local time = collect[slot].time |
1399 | if time + data.time <= endTime then | 1398 | if time + data.time <= endTime then |
1400 | - if not carbonCsv[expCarbonId] or not expCarbonId[coidCarbonId] then return 7 end | 1399 | + if not carbonCsv[expCarbonId] then break end |
1401 | 1400 | ||
1402 | local totalCoef = 0 | 1401 | local totalCoef = 0 |
1403 | - for _, heroId in ipairs(teams:toNumMap()) do | 1402 | + for _, heroId in ipairs(teams:toArray(true,"=")) do |
1404 | local hero = self.heros[heroId] | 1403 | local hero = self.heros[heroId] |
1405 | if hero then | 1404 | if hero then |
1406 | totalCoef = totalCoef + getHeroCoef(hero, data.success) | 1405 | totalCoef = totalCoef + getHeroCoef(hero, data.success) |
@@ -1414,8 +1413,8 @@ function RolePlugin.bind(Role) | @@ -1414,8 +1413,8 @@ function RolePlugin.bind(Role) | ||
1414 | bigSuccess = true | 1413 | bigSuccess = true |
1415 | end | 1414 | end |
1416 | 1415 | ||
1417 | - local money = math.ceil(carbonCsv[coidCarbonId].money / 5 * data.time * carbonCsv[coidCarbonId].money_clear) | ||
1418 | - local exp = math.ceil(carbonCsv[expCarbonId].exp / 5 * data.time * carbonCsv[expCarbonId].exp_clear) | 1416 | + local money = math.ceil(carbonCsv[expCarbonId].money / 5 * data.time * data.money_clear) |
1417 | + local exp = math.ceil(carbonCsv[expCarbonId].exp / 5 * data.time * data.exp_clear) | ||
1419 | local itemReward = data.item_clear_special:toNumMap() | 1418 | local itemReward = data.item_clear_special:toNumMap() |
1420 | itemReward[ItemId.Gold] = (itemReward[ItemId.Gold] or 0) + money | 1419 | itemReward[ItemId.Gold] = (itemReward[ItemId.Gold] or 0) + money |
1421 | itemReward[ItemId.Exp] = (itemReward[ItemId.Exp] or 0) + exp | 1420 | itemReward[ItemId.Exp] = (itemReward[ItemId.Exp] or 0) + exp |
@@ -1441,7 +1440,7 @@ function RolePlugin.bind(Role) | @@ -1441,7 +1440,7 @@ function RolePlugin.bind(Role) | ||
1441 | donate = {} | 1440 | donate = {} |
1442 | } | 1441 | } |
1443 | end | 1442 | end |
1444 | - self:setProperty("seaport",seaport) | 1443 | + self:updateProperty({field = "seaport", value = seaport}) |
1445 | end | 1444 | end |
1446 | end | 1445 | end |
1447 | 1446 | ||
@@ -1468,9 +1467,9 @@ function RolePlugin.bind(Role) | @@ -1468,9 +1467,9 @@ function RolePlugin.bind(Role) | ||
1468 | end | 1467 | end |
1469 | end) | 1468 | end) |
1470 | result[idx] = {} | 1469 | result[idx] = {} |
1471 | - for i,v in ipairs(temp) do | 1470 | + for i,v in pairs(temp) do |
1472 | if v then | 1471 | if v then |
1473 | - result[idx][i] = v | 1472 | + result[idx][i] = tonumber(v) |
1474 | end | 1473 | end |
1475 | end | 1474 | end |
1476 | end | 1475 | end |
src/models/RoleTask.lua
@@ -191,7 +191,7 @@ local AchievListener = { | @@ -191,7 +191,7 @@ local AchievListener = { | ||
191 | [TaskType.OverOderTask] = {{14}}, | 191 | [TaskType.OverOderTask] = {{14}}, |
192 | [TaskType.FoodSellGold] = {{15, f("count")}}, | 192 | [TaskType.FoodSellGold] = {{15, f("count")}}, |
193 | [TaskType.DinerPopular] = {{16, f("count")}}, | 193 | [TaskType.DinerPopular] = {{16, f("count")}}, |
194 | - [TaskType.TowerPass] = {{17, f("count"), f("type")}}, | 194 | + [TaskType.TowerPass] = {{17, f("level")}}, |
195 | [TaskType.OpenBox] = {{18, f("count")}}, | 195 | [TaskType.OpenBox] = {{18, f("count")}}, |
196 | [TaskType.DinerLevelUp] = {{19, f("level"), f("type")}}, | 196 | [TaskType.DinerLevelUp] = {{19, f("level"), f("type")}}, |
197 | [TaskType.DinerTalentUp] = {{20, 1, f("type")}}, | 197 | [TaskType.DinerTalentUp] = {{20, 1, f("type")}}, |
@@ -493,6 +493,7 @@ function RoleTask.bind(Role) | @@ -493,6 +493,7 @@ function RoleTask.bind(Role) | ||
493 | [6] = true, | 493 | [6] = true, |
494 | [7] = true, | 494 | [7] = true, |
495 | [16] = true, | 495 | [16] = true, |
496 | + [17] = true, | ||
496 | [19] = true, | 497 | [19] = true, |
497 | [22] = true, | 498 | [22] = true, |
498 | [23] = true, | 499 | [23] = true, |
src/services/globald.lua
@@ -155,22 +155,27 @@ end | @@ -155,22 +155,27 @@ end | ||
155 | 155 | ||
156 | -- @desc: 检查海港贸易开启、关闭 | 156 | -- @desc: 检查海港贸易开启、关闭 |
157 | local function check_trade_seaport_status() | 157 | local function check_trade_seaport_status() |
158 | - local delta = 1615579200 + 1000 | ||
159 | - local nowTime = delta or skynet.timex() | 158 | + local nowTime = skynet.timex() |
160 | local nextTime = dayLater(nowTime) | 159 | local nextTime = dayLater(nowTime) |
161 | - local interval = nextTime - nowTime + 1 | 160 | + local interval = 100 * (nextTime - nowTime + 1) |
162 | 161 | ||
163 | local curTm = os.date("*t", nowTime) | 162 | local curTm = os.date("*t", nowTime) |
164 | - if curTm.wday == 7 and curTm.hour == 4 then | ||
165 | - redisproxy:hset("autoincrement_set", "seaportTime0", nowTime) | ||
166 | - redisproxy:hset("autoincrement_set", "seaportTime1", 1) | ||
167 | - redisproxy:del(SEAPORT_TRADE_TASK_1) | ||
168 | - redisproxy:del(SEAPORT_TRADE_TASK_2) | 163 | + if curTm.wday == 7 and curTm.hour >= 4 then -- 周六 |
164 | + local oldTime = tonumber(redisproxy:hget("autoincrement_set", "seaportTime0")) or 0 | ||
165 | + local cur4Time = specTime({hour = 4},nowTime) | ||
166 | + if cur4Time ~= oldTime then | ||
167 | + redisproxy:hset("autoincrement_set", "seaportTime0", cur4Time) | ||
168 | + redisproxy:hset("autoincrement_set", "seaportTime1", 1) | ||
169 | + redisproxy:del(SEAPORT_TRADE_TASK_1) | ||
170 | + redisproxy:del(SEAPORT_TRADE_TASK_2) | ||
171 | + end | ||
169 | end | 172 | end |
170 | - if curTm.wday == 1 and curTm.hour == 4 then | ||
171 | - redisproxy:hset("autoincrement_set", "seaportTime2", 1) | 173 | + if curTm.wday == 1 and curTm.hour >= 4 then -- 周日 |
174 | + if (tonumber(redisproxy:hget("autoincrement_set", "seaportTime1")) or 0) == 1 then | ||
175 | + redisproxy:hset("autoincrement_set", "seaportTime2", 1) | ||
176 | + end | ||
172 | end | 177 | end |
173 | - if curTm.wday == 2 and curTm.hour == 4 then | 178 | + if curTm.wday == 2 and curTm.hour >= 4 then -- 周一 |
174 | -- redisproxy:hset("autoincrement_set", "seaportTime0", 0) | 179 | -- redisproxy:hset("autoincrement_set", "seaportTime0", 0) |
175 | redisproxy:hset("autoincrement_set", "seaportTime1", 0) | 180 | redisproxy:hset("autoincrement_set", "seaportTime1", 0) |
176 | redisproxy:hset("autoincrement_set", "seaportTime2", 0) | 181 | redisproxy:hset("autoincrement_set", "seaportTime2", 0) |