$info) { $rows[] = [ 'name' => $name, 'files' => $info['files'], 'mounts' => $mounted[$name] ?? [], ]; } $this->assign('rows', $rows); $this->assign('hasListener', HookService::hasListener()); $this->assign('total', count($points)); $this->assign('devOn', HookService::devMode()); return $this->fetch(); } /** * 切换「钩点可视化标注」开关(Discuz 式开发者模式) * * 写 cookie hook_dev=1,仅在后台应用(backend)内生效,不落配置文件, * 也不会随前台页面暴露给访客;全局模式请用 .env 的 HOOK_DEVELOPER=true。 * 访问:POST /backend/hook/devMode {on: 1|0} */ public function devMode() { $on = (int) $this->request->param('on', 0) === 1; if ($on) { Cookie::set(HookService::DEV_COOKIE, '1', ['expire' => 86400 * 7, 'path' => '/']); } else { Cookie::delete(HookService::DEV_COOKIE); } return json([ 'code' => 0, 'msg' => $on ? '已开启:打开任意后台页面,hook() 埋点会显示蓝色虚线框与「⟡ 钩子名」标签' : '已关闭钩点标注', 'data' => ['on' => $on], ]); } }