Commit 62ed4275958e0931f8f1e8743b023dfee6655654
1 parent
0d892cdf
添加新的延時類型郵件
Showing
3 changed files
with
19 additions
and
5 deletions
Show diff stats
src/actions/EmailAction.lua
| @@ -40,8 +40,15 @@ function _M.listRpc(agent, data) | @@ -40,8 +40,15 @@ function _M.listRpc(agent, data) | ||
| 40 | local count = 1 | 40 | local count = 1 |
| 41 | for _, data in ipairs(result) do | 41 | for _, data in ipairs(result) do |
| 42 | local email = tarr2tab(data) | 42 | local email = tarr2tab(data) |
| 43 | - if tonum(email.createtime) > role:getProperty("ctime") | ||
| 44 | - and ( not email.mid or tonum(email.mid) == mid ) | 43 | + -- 0 需要判斷創角時間小於郵件創建時間 1 只需要在時間段內登陸即可領取 |
| 44 | + local delayType = tonum(email.delayType) | ||
| 45 | + local flag = false | ||
| 46 | + if delayType == 1 then | ||
| 47 | + flag = skynet.timex() > tonum(email.createtime) | ||
| 48 | + else | ||
| 49 | + flag = tonum(email.createtime) > role:getProperty("ctime") | ||
| 50 | + end | ||
| 51 | + if flag and ( not email.mid or tonum(email.mid) == mid ) | ||
| 45 | and ( not email.endtime or tonum(email.endtime) > now )then | 52 | and ( not email.endtime or tonum(email.endtime) > now )then |
| 46 | local time = math.max(tonum(email.timestamp, 0) or email.createtime) | 53 | local time = math.max(tonum(email.timestamp, 0) or email.createtime) |
| 47 | redisproxy:insertEmail({ | 54 | redisproxy:insertEmail({ |
src/models/RolePlugin.lua
| @@ -1506,8 +1506,15 @@ function RolePlugin.bind(Role) | @@ -1506,8 +1506,15 @@ function RolePlugin.bind(Role) | ||
| 1506 | end) | 1506 | end) |
| 1507 | for _, data in ipairs(redret) do | 1507 | for _, data in ipairs(redret) do |
| 1508 | local email = tarr2tab(data) | 1508 | local email = tarr2tab(data) |
| 1509 | - if tonum(email.createtime) > self:getProperty("ctime") | ||
| 1510 | - and ( not email.mid or tonum(email.mid) == mid ) | 1509 | + -- 0 需要判斷創角時間小於郵件創建時間 1 只需要在時間段內登陸即可領取 |
| 1510 | + local delayType = tonum(email.delayType) | ||
| 1511 | + local flag = false | ||
| 1512 | + if delayType == 1 then | ||
| 1513 | + flag = skynet.timex() > tonum(email.createtime) | ||
| 1514 | + else | ||
| 1515 | + flag = tonum(email.createtime) > self:getProperty("ctime") | ||
| 1516 | + end | ||
| 1517 | + if flag and ( not email.mid or tonum(email.mid) == mid ) | ||
| 1511 | and ( not email.endtime or tonum(email.endtime) > now )then | 1518 | and ( not email.endtime or tonum(email.endtime) > now )then |
| 1512 | return true | 1519 | return true |
| 1513 | end | 1520 | end |