1
This commit is contained in:
@@ -643,7 +643,10 @@ class Preaccept extends Base
|
||||
}
|
||||
$insert['ctime'] = time();
|
||||
$this->article_main_image_obj->insert($insert);
|
||||
return jsonSuccess([]);
|
||||
$re['url'] = $data['url'];
|
||||
|
||||
|
||||
return jsonSuccess($re);
|
||||
}
|
||||
|
||||
public function editMainImage(){
|
||||
@@ -668,7 +671,6 @@ class Preaccept extends Base
|
||||
"article_id"=>"require",
|
||||
"table_data"=>"require",
|
||||
"title"=>"require",
|
||||
"note"=>"require"
|
||||
]);
|
||||
if(!$rule->check($data)){
|
||||
return jsonError($rule->getError());
|
||||
@@ -681,7 +683,9 @@ class Preaccept extends Base
|
||||
$insert['html_data'] = $data['html_data'];
|
||||
}
|
||||
$insert['title']=$data['title'];
|
||||
$insert['note'] = $data['note'];
|
||||
if(isset($data['note'])){
|
||||
$insert['note'] = $data['note'];
|
||||
}
|
||||
$insert['ctime'] = time();
|
||||
$this->article_main_table_obj->insert($insert);
|
||||
return jsonSuccess([]);
|
||||
@@ -720,16 +724,23 @@ class Preaccept extends Base
|
||||
|
||||
// 定义上传目录
|
||||
$uploadDir = ROOT_PATH . 'public' . DS . "articleImage".DS.$article_id;
|
||||
|
||||
$extension = pathinfo($file->getInfo("name"),PATHINFO_EXTENSION);
|
||||
// 生成自定义文件名,使用 uniqid 生成唯一的文件名
|
||||
$fileName = uniqid('file_') . '.' . pathinfo($file->getInfo("name"),PATHINFO_EXTENSION);
|
||||
$fileName = uniqid('file_') . '.' .$extension;
|
||||
|
||||
// 移动文件到指定目录,并重命名
|
||||
$info = $file->move($uploadDir, $fileName);
|
||||
|
||||
// 检查文件是否上传成功
|
||||
if ($info) {
|
||||
$re['upurl'] = $article_id."/".$fileName;
|
||||
$ff = '';
|
||||
if($extension=="tif"||$extension=="tiff"){
|
||||
$ff = $this->crossTifToPng($article_id."/".$fileName);
|
||||
}else{
|
||||
$ff = $article_id."/".$fileName;
|
||||
}
|
||||
|
||||
$re['upurl'] = $ff;
|
||||
return jsonSuccess($re);
|
||||
} else {
|
||||
return jsonError("error");
|
||||
|
||||
Reference in New Issue
Block a user