# verification-certificate **Repository Path**: ydbso/verification-certificate ## Basic Information - **Project Name**: verification-certificate - **Description**: 检定证书v1 - **Primary Language**: Unknown - **License**: Not specified - **Default Branch**: master - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 0 - **Forks**: 0 - **Created**: 2026-10-28 - **Last Updated**: 2026-10-28 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README # 检定证书生成工具(前后端合并仓库) 原本是两个独立仓库,2026-10-28 合并为一个仓库,两边的提交历史都保留。 线上地址: ## 目录结构 ``` api/ PHP 后端(ThinkPHP 5.1 + PhpWord + PhpSpreadsheet) web/ Vue 3 + Element Plus 前端(Vite 构建) ``` ### api/ - `api/public/` 是站点根目录(前端构建产物也放在这里) - `api/public/template/template.docx` —— 证书 Word 模板 - `api/public/template/template.xlsx` —— 原始记录 Excel 模板(坐标写死在代码里) - `api/application/index/controller/Index.php` —— 唯一的业务控制器,负责计算检定数据、填充模板、打包 zip - `api/public/output/` —— 生成的证书文件(运行时产生,按需保留) - 接口: - `POST /index.php/index/index/index` —— 生成证书,返回 zip 下载地址 - `POST /index.php/index/index/get_data` —— 读取上一次填写的表单内容 ### web/ - 单页表单,构建产物需要覆盖到 `api/public/` - 模板里的固定选项(器具名称等)在 `web/src/App.vue` ## 本地构建与部署 ```bash # 前端 cd web npm install npm run build # 产出 web/dist # 把 dist 内容覆盖到后端站点根 cp -r web/dist/* api/public/ ``` 服务器(1Panel + OpenResty 容器): | 项 | 值 | |---|---| | 站点根(容器内) | `/www/sites/jdzs.zxhq.com.cn/public` | | 站点根(宿主机) | `/opt/1panel/apps/openresty/openresty/www/sites/jdzs.zxhq.com.cn/public` | | PHP 容器 | `1Panel-php7-LHZu`(PHP 7.2.34,监听 `127.0.0.1:9002`) | | nginx 配置 | `/opt/1panel/apps/openresty/openresty/conf/conf.d/jdzs.zxhq.com.cn.conf` | > 后端不需要 `composer install`:`vendor/` 与 `thinkphp/` 在服务器上已就绪(未纳入版本库)。 > ThinkPHP 5.1 不会加载 `vendor/autoload.php`,而是自己读 `vendor/composer/autoload_static.php`, > 因此 PhpSpreadsheet 1.28 声明的最低 PHP 7.4 检查被绕过,实际在 PHP 7.2 上运行正常。 ## 模板修改注意 - 两个模板的文件名不能改,代码里写死了 `template/template.docx` 和 `template/template.xlsx` - Word 模板使用 `${变量名}` 占位符,PhpWord 会在加载时自动修复被 Word 拆成多段的占位符 - Excel 模板没有占位符,靠代码按单元格坐标写入;**改动行列结构必须同步修改 `api/application/index/controller/Index.php` 的坐标** ## 合并来源 | 合并前仓库 | 合并后位置 | |---|---| | `gitee.com/lei_xuesong/verification-certificate-api` | `api/` | | `gitee.com/lei_xuesong/verification-certificate` | `web/` |