Commit c17acaec1f5f48ca5e143f391ef14ebd4f36a3a9
Merge branch 'cn/develop' into cn/publish/release
Showing
5 changed files
with
80 additions
and
11 deletions
Show diff stats
src/ProtocolCode.lua
@@ -65,6 +65,8 @@ actionCodes = { | @@ -65,6 +65,8 @@ actionCodes = { | ||
65 | Role_worldLineRouletteRpc = 146, --世界线抽轮盘 | 65 | Role_worldLineRouletteRpc = 146, --世界线抽轮盘 |
66 | Role_worldLineRewardRpc = 147, -- 世界线一键领取奖励 | 66 | Role_worldLineRewardRpc = 147, -- 世界线一键领取奖励 |
67 | Role_itemConvertDevilTicketRpc = 148, -- 兑换魔鬼训练营门票 | 67 | Role_itemConvertDevilTicketRpc = 148, -- 兑换魔鬼训练营门票 |
68 | + Role_unRegisterRpc = 149, --注销账号 | ||
69 | + Role_searchAllRoleRpc = 150, --查询所有服的角色信息 | ||
68 | 70 | ||
69 | Adv_startAdvRpc = 151, | 71 | Adv_startAdvRpc = 151, |
70 | Adv_startHangRpc = 152, | 72 | Adv_startHangRpc = 152, |
src/actions/HttpAction.lua
1 | +require "utils.MysqlUtil" | ||
1 | 2 | ||
2 | local _M = {} | 3 | local _M = {} |
3 | 4 | ||
@@ -264,4 +265,20 @@ function _M.hero_draw_pro(query) | @@ -264,4 +265,20 @@ function _M.hero_draw_pro(query) | ||
264 | return gmFuncs[query.cmd]() | 265 | return gmFuncs[query.cmd]() |
265 | end | 266 | end |
266 | 267 | ||
268 | +function _M.role_by_uid(query) | ||
269 | + local ret, res= roleByUid(query.uid) | ||
270 | + local rsp = {} | ||
271 | + rsp.code = 0 | ||
272 | + if not ret then | ||
273 | + rsp.code = -1 | ||
274 | + return json.encode(rsp) | ||
275 | + end | ||
276 | + | ||
277 | + rsp.id = res["id"] | ||
278 | + rsp.name = res["name"] | ||
279 | + rsp.level = res["level"] | ||
280 | + rsp.code = 0 | ||
281 | + return json.encode(rsp) | ||
282 | +end | ||
283 | + | ||
267 | return _M | 284 | return _M |
268 | \ No newline at end of file | 285 | \ No newline at end of file |
src/actions/RoleAction.lua
@@ -345,15 +345,6 @@ function _M.loginRpc( agent, data ) | @@ -345,15 +345,6 @@ function _M.loginRpc( agent, data ) | ||
345 | end | 345 | end |
346 | end | 346 | end |
347 | 347 | ||
348 | - -- 临时处理方式,清空电台活动队伍 | ||
349 | - local radioTask = role:getProperty("radioTask") | ||
350 | - for id, data in pairs(radioTask) do | ||
351 | - if (data["actid"] or 0) ~= 0 then | ||
352 | - radioTask[id] = nil | ||
353 | - end | ||
354 | - end | ||
355 | - --- | ||
356 | - | ||
357 | return true | 348 | return true |
358 | end | 349 | end |
359 | 350 | ||
@@ -506,6 +497,48 @@ function _M.createRpc(agent, data) | @@ -506,6 +497,48 @@ function _M.createRpc(agent, data) | ||
506 | return true | 497 | return true |
507 | end | 498 | end |
508 | 499 | ||
500 | +function _M.unRegisterRpc(agent, data) | ||
501 | + local role = agent.role | ||
502 | + local roleId = role:getProperty("id") | ||
503 | + local msg = MsgPack.unpack(data) | ||
504 | + local id = msg.roleId | ||
505 | + if id ~= roleId then | ||
506 | + return 0 | ||
507 | + end | ||
508 | + | ||
509 | + if not roleUnRegister(roleId) then return 1 end | ||
510 | + SendPacket(actionCodes.Role_unRegisterRpc, MsgPack.pack({})) | ||
511 | + return true | ||
512 | +end | ||
513 | + | ||
514 | +function _M.searchAllRoleRpc(agent, data) | ||
515 | + local role = agent.role | ||
516 | + local msg = MsgPack.unpack(data) | ||
517 | + local uid = msg.sdk_uid | ||
518 | + if not uid then return 0 end | ||
519 | + | ||
520 | + | ||
521 | + | ||
522 | + local serverId = skynet.getenv("servId") | ||
523 | + local codeurl = skynet.getenv("codeurl") | ||
524 | + local content = { | ||
525 | + ["serverid"]= serverId, | ||
526 | + ["uid"]= uid, | ||
527 | + } | ||
528 | + | ||
529 | + local status, body = httpc.get(codeurl, "/search_role?" .. httpGetFormatData(content), {}) | ||
530 | + if status ~= 200 then return 1 end | ||
531 | + | ||
532 | + local result = json.decode(body) | ||
533 | + local ret = tonum(result.errorCode) | ||
534 | + if ret ~= 0 then return 2 end | ||
535 | + | ||
536 | + | ||
537 | + SendPacket(actionCodes.Role_searchAllRoleRpc, MsgPack.pack(result.data or {})) | ||
538 | + return true | ||
539 | +end | ||
540 | + | ||
541 | + | ||
509 | function _M.changeNameRpc(agent, data) | 542 | function _M.changeNameRpc(agent, data) |
510 | local role = agent.role | 543 | local role = agent.role |
511 | local roleId = role:getProperty("id") | 544 | local roleId = role:getProperty("id") |
src/models/Role.lua
@@ -217,6 +217,7 @@ Role.schema = { | @@ -217,6 +217,7 @@ Role.schema = { | ||
217 | 217 | ||
218 | worldChangePoints = {"table", {}}, -- 世界变动积分 {[1]= 转盘抽取次数, [2]= 获得的积分, [3]=魔导石消耗, [4]= 虹光玉消耗} | 218 | worldChangePoints = {"table", {}}, -- 世界变动积分 {[1]= 转盘抽取次数, [2]= 获得的积分, [3]=魔导石消耗, [4]= 虹光玉消耗} |
219 | worldLineReward = {"table", {}}, -- 世界积分 领取记录 {[id] = 1} | 219 | worldLineReward = {"table", {}}, -- 世界积分 领取记录 {[id] = 1} |
220 | + del = {"number", 0}, -- 标记删除 0=未删除,1=已删除 | ||
220 | } | 221 | } |
221 | 222 | ||
222 | 223 |
src/utils/MysqlUtil.lua
@@ -51,7 +51,7 @@ function delFriend(roleId, friendId) | @@ -51,7 +51,7 @@ function delFriend(roleId, friendId) | ||
51 | end | 51 | end |
52 | 52 | ||
53 | function roleExists(roleId) | 53 | function roleExists(roleId) |
54 | - local res = mysqlproxy:query(string.format("SELECT `id` FROM `Role` WHERE `id` = %s", roleId)) | 54 | + local res = mysqlproxy:query(string.format("SELECT `id` FROM `Role` WHERE `del` = 0 and `id` = %s", roleId)) |
55 | if res["errno"] or not next(res) then | 55 | if res["errno"] or not next(res) then |
56 | return false | 56 | return false |
57 | end | 57 | end |
@@ -60,10 +60,26 @@ function roleExists(roleId) | @@ -60,10 +60,26 @@ function roleExists(roleId) | ||
60 | end | 60 | end |
61 | 61 | ||
62 | function roleUidExists(uid) | 62 | function roleUidExists(uid) |
63 | - local res = mysqlproxy:query(string.format("SELECT `name` FROM `Role` WHERE `uid` = '%s'", uid)) | 63 | + local res = mysqlproxy:query(string.format("SELECT `name` FROM `Role` WHERE `del` = 0 and `uid` = '%s'", uid)) |
64 | if res["errno"] or not next(res) then | 64 | if res["errno"] or not next(res) then |
65 | return false | 65 | return false |
66 | end | 66 | end |
67 | 67 | ||
68 | return true, res[1]["name"] | 68 | return true, res[1]["name"] |
69 | +end | ||
70 | + | ||
71 | +function roleUnRegister(roleId) | ||
72 | + local res = mysqlproxy:query(string.format("UPDATE`Role` SET `del` = 1 WHERE `id` = %s", roleId)) | ||
73 | + if res["errno"] or not next(res) then | ||
74 | + return false | ||
75 | + end | ||
76 | + return true | ||
77 | +end | ||
78 | + | ||
79 | +function roleByUid(uid) | ||
80 | + local res = mysqlproxy:query(string.format("SELECT id, name, level FROM `Role` WHERE `del` = 0 and `uid` = '%s'", uid)) | ||
81 | + if res["errno"] or not next(res) then | ||
82 | + return false | ||
83 | + end | ||
84 | + return true, res[1] | ||
69 | end | 85 | end |
70 | \ No newline at end of file | 86 | \ No newline at end of file |