123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103 |
- local skynet = require "skynet"
- require "skynet.manager"
- local logger = require "logger"
- local cjson = require "cjson"
- local queue = require "skynet.queue"
- local synchronized = queue()
- local redisdriver = require "skynet.db.redis"
- local mysql = require "skynet.db.mysql"
- local util = require "util"
- local stringify = require "stringify"
- local s_guild = skynet.localname(".guild")
- local md5 = require "md5"
- local db
- local authz = {acc = "yytx", pwd = "lee@YY-Games.520"}
- local content = {acc = authz.acc, pwd = authz.pwd, sign = false}
- content.sign = string.sub(md5.sumhexa(content.acc .. content.pwd), 9, 24)
- local whitelist = {
- ["14.29.136.211"] = true,
- ["192.168.1.41"] = true,
- ["222.212.88.4"] = true,
- }
- local guild = function(args, ipaddr,header)
- return synchronized(function()
- logger.trace("处理来自主机 %s 的guild请求", ipaddr)
-
- if not whitelist[ipaddr] then
-
- end
-
- local code = string.sub(args.code, 1, 16)
- if code ~= content.sign then
- return cjson.encode({state = 403, msg = "账号或密码错误"})
- end
- local ftype = tonumber(args.type)
- local fcont = args.content
- local sid = args.sid
- logger.trace(" %s:%s:%s",ftype,fcont,sid)
-
- if ftype == 1 then
- local ret1,ret2 = skynet.call(s_guild, "lua", "set_seal", _,sid,1)
- if ret1 >= 0 then
- return cjson.encode({errno = 200, msg = "封禁公会 成功"})
- else
- return cjson.encode({errno = 400, msg = ret2})
- end
- elseif ftype == 2 then
- local ret1,ret2 = skynet.call(s_guild, "lua", "set_seal", _,sid,2)
- if ret1 >= 0 then
- return cjson.encode({errno = 200, msg = "解封公会 成功"})
- else
- return cjson.encode({errno = 400, msg = ret2})
- end
- elseif ftype == 3 then
- local ret1,ret2 = skynet.call(s_guild, "lua", "web_set_notice", _,sid,fcont)
- if ret1 >= 0 then
- return cjson.encode({errno = 200, msg = "设置新的公告 成功"})
- else
- return cjson.encode({errno = 400, msg = ret2})
- end
- elseif ftype == 4 then
- local ret1,ret2 = skynet.call(s_guild, "lua", "web_rename", _,sid,fcont)
- if ret1 >= 0 then
- return cjson.encode({errno = 200, msg = "重新命名字 成功"})
- else
- return cjson.encode({errno = 400, msg = ret2})
- end
- else
-
- return cjson.encode({errno = 400, msg = "type 没有找到"})
- end
- end)
- end
- return guild
|