您现在的位置是:首页 >技术教程 >tp6.1 bingher/ueditor(百度编辑器)(七牛、阿里OSS第三方云)详情图文教程(第二版)网站首页技术教程
tp6.1 bingher/ueditor(百度编辑器)(七牛、阿里OSS第三方云)详情图文教程(第二版)
简介tp6.1 bingher/ueditor(百度编辑器)(七牛、阿里OSS第三方云)详情图文教程(第二版)
之前做过一版:tp6 bingher/ueditor(百度编辑器)(七牛、阿里OSS第三方云)详情图文教程_我是高手高手高高手的博客-CSDN博客
登录权限是Session,现在系统是Cookie加jwt的Token方式验证
一、修改验证登录权限
修改文件: vendoringherueditorsrccontrollerBase.php
1.1 引用自己的验证登录方法
use thinkfacadeCookie;
use appservicesjwtJwtAdmin as Jwt;
1.2 获取登录用户信息,这里需要企业ID,在这里public function __construct()加入
//验证登录
$CookieToken=Cookie::get(Jwt::getName())?Cookie::get(Jwt::getName()):"";//获取Cookie中的Token
if(!$CookieToken){
throw new HttpResponseException($this->error("请登录!"));
}
$manager = Jwt::setToken($CookieToken);
$tokeInfo=$manager->auth(true);
// var_dump($adminuserinfoArr['data']['enterprise']['id']);
if(!$tokeInfo){
throw new HttpResponseException($this->error("非法数据!"));
}
$adminuserinfoArr=$manager->getPayload();//获取用户信息
$this->enterprise_id = $adminuserinfoArr['data']['enterprise']['id'] ;

二、上传接入第三方OSS
vendoringherueditorsrccontrollerUeditor.php
把企业ID传入$this->config对象中
$fsConfig['enterprise_id'] = $this->enterprise_id;
Config::set($fsConfig, 'filesystem');

2.1 修改private function _upFile($config)
$pathData = appservicesuploadmodelGetFileInfoModel::fileOssTypePath(!empty(Config::get('filesystem'))?Config::get('filesystem')['enterprise_id']:0);
$path = !empty($pathData['data']['path'])?$pathData['data']['path']:'';
'url' => appservicesuploadmodelGetFileInfoModel::GetFileUrl($saveName),

像其它文件大小、格式之类

三、修改vendoringherueditorsrcconfigUeConfig.php文件的方法
public function initFilesystem(string $diskName = 'ueditor')
$pathData = appservicesuploadmodelGetFileInfoModel::fileOssTypePath(!empty(Config::get('filesystem'))?Config::get('filesystem')['enterprise_id']:0);
$public_path = !empty($pathData['data']['public_path'])?$pathData['data']['public_path']:'';
return (new yzh52521filesystemFilesystem(app()))->disk($public_path);

风语者!平时喜欢研究各种技术,目前在从事后端开发工作,热爱生活、热爱工作。





U8W/U8W-Mini使用与常见问题解决
QT多线程的5种用法,通过使用线程解决UI主界面的耗时操作代码,防止界面卡死。...
stm32使用HAL库配置串口中断收发数据(保姆级教程)
分享几个国内免费的ChatGPT镜像网址(亲测有效)
Allegro16.6差分等长设置及走线总结