Commit 814d9753dfbf242548d0603d66d7fa13cf9f71cf
1 parent
ef74f2f2
fix: 创建角色 记录是否是新设备
Showing
1 changed file
with
9 additions
and
2 deletions
Show diff stats
src/actions/RoleAction.lua
| @@ -445,9 +445,16 @@ function _M.createRpc(agent, data) | @@ -445,9 +445,16 @@ function _M.createRpc(agent, data) | ||
| 445 | end | 445 | end |
| 446 | newRole:log("onCreateRole") | 446 | newRole:log("onCreateRole") |
| 447 | newRole:mylog("create", {key1 = agent.ip:toArray(false, ":")[1]}) | 447 | newRole:mylog("create", {key1 = agent.ip:toArray(false, ":")[1]}) |
| 448 | - if msg.newdevice then | ||
| 449 | - newRole:mylog("newdevice", {key1 = agent.ip:toArray(false, ":")[1]}) | 448 | + |
| 449 | + -- 是否是新设备 | ||
| 450 | + local deviced = cluster.query("center", "deviced") | ||
| 451 | + if deviced then | ||
| 452 | + local status, back = pcall(cluster.call, "center", deviced, "isNewDevice", {device = msg.device}) | ||
| 453 | + if status and back then | ||
| 454 | + newRole:mylog("newdevice", {key1 = agent.ip:toArray(false, ":")[1]}) | ||
| 455 | + end | ||
| 450 | end | 456 | end |
| 457 | + | ||
| 451 | -- 整体保存一次 | 458 | -- 整体保存一次 |
| 452 | newRole:update() | 459 | newRole:update() |
| 453 | 460 |