作为这篇博文的补充CentOS9 安装Docker+Dpanel+onlyoffice(https、更改字体、字号、去除限制)的避坑笔记,现在继续…
本次主要内容有:php中callback的调用、自签证书调用callback遇到SSL certificate problem: unable to get local issuer certificate问题、修改onlyoffice的logo并去链接及隐藏左侧的关于按钮。开始干活…
一、书写onlyoffice调用的callback(thinkphp)
我用的是thinkphp的框架,控制器我命名为:Office.php,onlyoffice我关闭了jwt,所以直接调用,生产环境请自行修改。代码如下:
<?php
declare (strict_types = 1);
namespace app\common\controller;
use think\facade\Log;
class Office
{/*** OnlyOffice 回调接口** @return \think\Response\Json*/public function callback(){// 获取回调数据$data = input('post.');// 记录日志,方便调试Log::info('OnlyOffice 回调数据:' . json_encode($data));// 检查回调状态if (isset($data['status']) && $data['status'] == 2) {// 更新keyDb::name('oa_office_files')->where('id', $data['id'])->update(['key'=>uniqid()]);$file = Db::name('oa_office_files')->find($data['id']);// 下载并保存文档$savedPath = $this->saveDocument($data['url'], $file['save_path']);if ($savedPath) {return json(['error' => 0, 'message' => '文档保存成功']);} else {return