local skynet = require "skynet" local s = require "service" local tools = require "tools" local cjson = require "cjson" local mysql = require "skynet.db.mysql" local back_response = require "back_response" local urllib = require "http.url" local crypt = require "skynet.crypt" local tg_temp_app = require "tg_temp_app" local tg_platform = require "tg_platform" local tg_zhanghu = require "tg_zhanghu" local tg_max_zhuanhua = require "tg_max_zhuanhua" local user = require "user" local tg_app = require "tg_app" local tg_main = require "tg_main" local db_filter_config = require "db_filter_config" local push_msg = require "push_msg" local filter_task = require "filter_task" local fq_book = require "fq_book" local book_black_list = require "book_black_list" local whitelist_books = require "whitelist_books" local video_titles = require "video_titles" local pull_data_config = require "pull_data_config" local pull_data_config2 = require "pull_data_config2" local pull_data_status = require "pull_data_status" local pull_data_status2 = require "pull_data_status2" local video_applet_product = require "video_applet_product" local filter_data = require "filter_data" local video_material = require "video_material" local no_filter_origin = require "no_filter_origin" local no_filter_origin2 = require "no_filter_origin2" local origin_video_titles = require "origin_video_titles" local promotion_audit_suggestions = require "promotion_audit_suggestions" local tg_butler = require "tg_butler" local tg_mini_program_platform = require "tg_mini_program_platform" local task_material_queue_queue = require "task_material_queue_queue" local video_product = require "video_product" local origin_data = require "origin_data" local origin_data2 = require "origin_data2" local video_product_material = require "video_product_material" local aweme_auth_list = require "aweme_auth_list" local checks = require "checks" local fq_mf_book = require "fq_mf_book" local tg_main_price_template = require "tg_main_price_template" local ad_convert_type = require "ad_convert_type" local other_book = require "other_book" local platform_shared = require "platform_shared" local material_review = require "material_review" local yw_book = require "yw_book" local wechat_miniapp_product = require "wechat_miniapp_product" local material_platform = require "material_platform" local xs_origin_data = require "xs_origin_data" local statistics_platform = require "statistics_platform" local data_manager = require "data_manager" local review_user = require "review_user" local log = require "log" local status_200 = 200 local CMD = { } CMD["tg_temp_app"] = tg_temp_app; CMD["tg_platform"] = tg_platform; CMD["tg_zhanghu"] = tg_zhanghu; CMD["tg_max_zhuanhua"] = tg_max_zhuanhua; CMD["tg_app"] = tg_app; CMD["user"] = user; CMD["tg_main"] = tg_main; CMD["db_filter_config"] = db_filter_config; CMD["push_msg"] = push_msg; CMD["filter_task"] = filter_task; CMD["fq_book"] = fq_book; CMD["book_black_list"] = book_black_list; CMD["video_titles"] = video_titles; CMD["pull_data_config"] = pull_data_config; CMD["pull_data_config2"] = pull_data_config2; CMD["pull_data_status"] = pull_data_status; CMD["pull_data_status2"] = pull_data_status2; CMD["video_applet_product"] = video_applet_product; CMD["filter_data"] = filter_data; CMD["video_material"] = video_material; CMD["no_filter_origin"] = no_filter_origin; CMD["no_filter_origin2"] = no_filter_origin2; CMD["origin_video_titles"] = origin_video_titles; CMD["promotion_audit_suggestions"] = promotion_audit_suggestions; CMD["tg_butler"] = tg_butler; CMD["tg_mini_program_platform"] = tg_mini_program_platform; CMD["task_material_queue_queue"] = task_material_queue_queue; CMD["video_product"] = video_product; CMD["origin_data"] = origin_data; CMD["origin_data2"] = origin_data2; CMD["video_product_material"] = video_product_material; CMD["aweme_auth_list"] = aweme_auth_list; CMD["checks"] = checks; CMD["fq_mf_book"] = fq_mf_book; CMD["tg_main_price_template"] = tg_main_price_template; CMD["ad_convert_type"] = ad_convert_type; CMD["other_book"] = other_book; CMD["platform_shared"] = platform_shared; CMD["material_review"] = material_review; CMD["yw_book"] = yw_book; CMD["wechat_miniapp_product"] = wechat_miniapp_product; CMD["material_platform"] = material_platform; CMD["xs_origin_data"] = xs_origin_data; CMD["statistics_platform"] = statistics_platform; CMD["data_manager"] = data_manager; CMD["review_user"] = review_user; CMD["whitelist_books"] = whitelist_books; CMD["log"] = log; function run(target,fun,msg_body,fd) if target~=nil and fun~=nil and target[fun]~=nil then local isok,data,total = target[fun](msg_body) if isok then if data~=nil then if total~=nil then tools.response(fd,status_200,cjson.encode({code=10000,data=data,total=total})) else tools.response(fd,status_200,cjson.encode({code=10000,data=data})) end else tools.response(fd,status_200,cjson.encode({code=10000,msg="OK!"})) end else tools.response(fd,status_200,cjson.encode({code=10001,msg=data})) end else return tools.response(fd,status_200,{code=10002,msg="没找到方法!"}) end end CMD.api = function(msg_body,fd) if msg_body~=nil and msg_body~="" then if CMD[msg_body['cmd']] then run(CMD[msg_body['cmd']],msg_body['fun'],msg_body['data'],fd) end end end CMD.ws_push_msg = function(msg_body) CMD['push_msg'].push(msg_body.cmd,msg_body.data) end --接口end s.resp.on_recv = function (source, fd, msg_id, msg_body) if CMD[msg_id]~=nil then tools.dump(msg_body) CMD[msg_id](cjson.decode(msg_body),fd) end end s.init = function() end s.start(...)