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.teacher_photos = function() require("app.app") local conn = db_conn() local edu_id = edu_id() local edu_teacher = require("app.function.edu_teacher") local edu_setting = require("app.function.edu_setting") local teacher_info = edu_teacher.get_by_id(pint("id"),edu_id,conn) if teacher_info == nil then conn:close() return "" end local domain_assets_cn = edu_setting.get_assets_domain_cn(edu_id,conn) local photos = {} if teacher_info.photo and type(teacher_info.photo) == "string" and teacher_info.photo ~= "" then local ok, decoded = pcall(function() return cjson.decode(teacher_info.photo) end) if ok and type(decoded) == "table" then photos = decoded end end local content = "