12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364 |
- local skynet = require "skynet"
- local codecache = require "skynet.codecache"
- require "skynet.manager"
- local logger = require "logger"
- local stringify = require "stringify"
- local cjson = require "cjson"
- local assetcenter
- local watchdog
- local authz = {
- yytx = "lee@YY-Games.520",
- lee = "yytx-Games-9527",
- }
- local span_team = skynet.localname(".span_team")
- local function team(args, ipaddr, header)
- logger.warn("处理来自主机team %s %s", ipaddr,args.func_local)
-
- local user = args.user or ""
- local pwd = args.pwd or ""
- if authz[user] ~= pwd then
- return cjson.encode({errno = 403, host = header.host, info = "账号或密码错误"})
- end
- local func = args.func_local or ""
- logger.trace(" args = %s", stringify(args))
- if func == "player" and args.uids then
- local uids = cjson.decode(args.uids)
- local ok, ret = pcall(skynet.call,span_team, "lua", "web_load_player", uids)
- if not ok then
- logger.trace(" == 异常报错 %s", ret)
- return cjson.encode({errno = 400, host = header.host, info = "功能执行异常"})
- end
- elseif func == "team" and args.teamids then
- local teamids = cjson.decode(args.teamids)
- local ok, ret = pcall(skynet.call,span_team, "lua", "web_load_team", teamids)
- if not ok then
- logger.trace(" == 异常报错 %s", ret)
- return cjson.encode({errno = 400, host = header.host, info = "功能执行异常"})
- end
- elseif func == "switch" and args.flag then
- local ok, ret = pcall(skynet.call,span_team, "lua", "web_switch", args.flag)
- if not ok then
- logger.trace(" == 异常报错 %s", ret)
- return cjson.encode({errno = 400, host = header.host, info = "功能执行异常"})
- end
- if ret ~= 0 then
- return cjson.encode({errno = 400, host = header.host, info = "flag 参数异常"})
- end
- else
- return cjson.encode({errno = 400, host = header.host, info = "选择的功能不存在 或参数异常"})
- end
- return cjson.encode({errno = 200, host = header.host, info = "热更新 成功"})
- end
- return team
|