init.lua 533 B

1234567891011121314151617181920
  1. local skynet = require "skynet"
  2. local s = require "service"
  3. local tools = require "tools"
  4. local cjson = require "cjson"
  5. local httpc = require "http.httpc"
  6. local runconfig = require "run_config"
  7. s.resp.on_recv = function (source, fd, msg_id, msg_body)
  8. skynet.error("接收一条工具消息 ",msg_id)
  9. local func = string.gsub(msg_id, "/tools/", "")
  10. if s.resp[func] ~=nil then
  11. return s.resp[func](fd,msg_body)
  12. end
  13. return tools.response(fd,200,string.format("接口 %s 不存在",func))
  14. end
  15. s.start(...)