|
@ -29,7 +29,8 @@ class FileManager |
|
|
* @return bool|int|string |
|
|
* @return bool|int|string |
|
|
* 根据文件拓展名在$extension中查找对应的文件类型,若不存在则返回false |
|
|
* 根据文件拓展名在$extension中查找对应的文件类型,若不存在则返回false |
|
|
*/ |
|
|
*/ |
|
|
public function searchType($array, $keyword){ |
|
|
|
|
|
|
|
|
public function searchType($array, $keyword) |
|
|
|
|
|
{ |
|
|
foreach($array as $key => $value){ |
|
|
foreach($array as $key => $value){ |
|
|
foreach ($value as $k => $v) { |
|
|
foreach ($value as $k => $v) { |
|
|
if($v == $keyword){ |
|
|
if($v == $keyword){ |
|
@ -47,16 +48,15 @@ class FileManager |
|
|
* @return array |
|
|
* @return array |
|
|
* 根据临时文件id(字符串)将临时文件保存在文件中 |
|
|
* 根据临时文件id(字符串)将临时文件保存在文件中 |
|
|
*/ |
|
|
*/ |
|
|
public function saveTemFileToFile($temFIleIdStr, $ownId, $ownType) |
|
|
|
|
|
|
|
|
public function saveTemFileToFile($temFIleIdArr, $ownId, $ownType) |
|
|
{ |
|
|
{ |
|
|
if(!$temFIleIdStr || !$ownId) { |
|
|
|
|
|
|
|
|
if(!$temFIleIdArr || !$ownId) { |
|
|
return ['status' => false, 'info' => '参数错误']; |
|
|
return ['status' => false, 'info' => '参数错误']; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
$img_id_arr = explode(',', $temFIleIdStr); |
|
|
|
|
|
$i = 1; |
|
|
$i = 1; |
|
|
$first_file_id = 0; |
|
|
$first_file_id = 0; |
|
|
foreach ($img_id_arr as $key => $value) { |
|
|
|
|
|
|
|
|
foreach ($temFIleIdArr as $key => $value) { |
|
|
$tem_file = TemFile::findOne($value); |
|
|
$tem_file = TemFile::findOne($value); |
|
|
|
|
|
|
|
|
if(!$tem_file) { |
|
|
if(!$tem_file) { |
|
@ -99,4 +99,21 @@ class FileManager |
|
|
return ['status' => false]; |
|
|
return ['status' => false]; |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
|
* @param $fileIdArr |
|
|
|
|
|
* 删除file表中的文件 |
|
|
|
|
|
*/ |
|
|
|
|
|
public function deleteFile($fileIdArr) |
|
|
|
|
|
{ |
|
|
|
|
|
if($fileIdArr){ |
|
|
|
|
|
foreach ($fileIdArr as $key => $value) { |
|
|
|
|
|
$file_model = File::findOne($value); |
|
|
|
|
|
if($file_model){ |
|
|
|
|
|
$file_model->is_delete = File::IS_DELETE_YES; |
|
|
|
|
|
$file_model->save(); |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
} |
|
|
} |