1、后台编辑器图片上传问题解决
2、文件代码格式化
This commit is contained in:
@@ -72,7 +72,7 @@ class InitHook {
|
||||
$route["user/" . $value['name'] . "/del"] = "user/content/del?model_id=" . $value['id'];
|
||||
$route["user/" . $value['name'] . "/status"] = "user/content/status?model_id=" . $value['id'];
|
||||
}
|
||||
$route["list/:id"] = "index/content/category";
|
||||
$route["list/:id"] = "index/content/category";
|
||||
\think\Route::rule($route);
|
||||
}
|
||||
}
|
||||
@@ -61,17 +61,30 @@ class Upload {
|
||||
}
|
||||
|
||||
public function editor() {
|
||||
$callback = request()->get('callback');
|
||||
$file = request()->file('upfile');
|
||||
$info = $file->move(config('editor_upload.rootPath'), true, false);
|
||||
if ($info) {
|
||||
$data = $this->parseFile($info);
|
||||
$data['success'] = true;
|
||||
$data['file_path'] = $data['url'];
|
||||
$fileInfo = $this->parseFile($info);
|
||||
$data = array(
|
||||
"originalName" => $fileInfo['name'],
|
||||
"name" => $fileInfo['name'],
|
||||
"url" => $fileInfo['url'],
|
||||
"size" => $fileInfo['size'],
|
||||
"type" => $fileInfo['ext'],
|
||||
"state" => 'SUCCESS'
|
||||
);
|
||||
} else {
|
||||
$data['success'] = false;
|
||||
$data['msg'] = "error message";
|
||||
$data['state'] = $file->getError();
|
||||
}
|
||||
/**
|
||||
* 返回数据
|
||||
*/
|
||||
if($callback) {
|
||||
return '<script>'.$callback.'('.json_encode($data).')</script>';
|
||||
} else {
|
||||
return json_encode($data);
|
||||
}
|
||||
return $data;
|
||||
}
|
||||
|
||||
public function delete() {
|
||||
|
||||
Reference in New Issue
Block a user