local M = {} M.file_get_contents = function(filepath) local file, errmsg = io.open(fw.website_dir()..filepath, "r") if not file then fw.throw_string(errmsg) end local content = file:read("*a") if content == nil or content == "" then print("file_get_contents error: ",filepath) return "" end local replaced,c2 = engine.replace(content) if replaced then return c2 end return content end M.menu_top = function() -- 当前请求路径 local request_path = request.filepath() or "" -- 取配置 local menuData = require("fwutils.develop.function.menu").bytecode(string.format("%d",engine.cfg.role_id())) if not menuData then return "" end -- 提取并排序主菜单 local menuItems = {} for name, item in pairs(menuData) do table.insert(menuItems, { name = name, item = item, sort = item.sort or 0 }) end table.sort(menuItems, function(a, b) return a.sort > b.sort end) local html = [[
]] return [=[ ]] end M.regist = function(env) for key, value in pairs(M) do if type(value) == "function" and key ~= "functions" and key ~= "get_all_functions" then env[key] = value end end return env end return M