require("app.app") local fwutils_config = require("fwutils.config") local develop_template = require("fwutils.develop.function.template") local M = {} M.get_by_id = function() local conn = mysql.new(_G[fwutils_config.db.mysql_pool_name]):get() succ(develop_template.get_by_id(pint("id"),conn)) end M.add = function() local data = pjson() local conn = mysql.new(_G[fwutils_config.db.mysql_pool_name]):get() if develop_template.add(data,conn) then succ({}) else error("") end end M.update = function() local data = pjson() local conn = mysql.new(_G[fwutils_config.db.mysql_pool_name]):get() if develop_template.update(data,conn) then succ({}) else error("") end end M.delete = function() local data = pjson() local conn = mysql.new(_G[fwutils_config.db.mysql_pool_name]):get() if develop_template.delete(data.id,conn) then succ({}) else error("") end end M.list = function() local data = pjson() local conn = mysql.new(_G[fwutils_config.db.mysql_pool_name]):get() local d = develop_template.list(data.search,data.limit,conn) succ(d) end M.refresh = function() local module_template = require("fwutils.template_engine") local conn = mysql.new(_G[fwutils_config.db.mysql_pool_name]):get() module_template.update(conn) succ() end M.exec = function() exec({ get_by_id = M.get_by_id, list = M.list, add = M.add, update = M.update, delete = M.delete, refresh = M.refresh, }) end return M