新增解析功能
This commit is contained in:
@@ -1,31 +0,0 @@
|
||||
<?php
|
||||
namespace catchAdmin\system\controller;
|
||||
|
||||
use catcher\base\CatchController;
|
||||
use catcher\CatchResponse;
|
||||
use catchAdmin\system\model\Attachments as AttachmentsModel;
|
||||
use catcher\Utils;
|
||||
use think\facade\Filesystem;
|
||||
|
||||
class Attachments extends CatchController
|
||||
{
|
||||
|
||||
public function index(AttachmentsModel $model)
|
||||
{
|
||||
return CatchResponse::paginate($model->getList());
|
||||
}
|
||||
|
||||
public function delete($id, AttachmentsModel $model)
|
||||
{
|
||||
$ids = Utils::stringToArrayBy($id);
|
||||
|
||||
foreach ($ids as $id) {
|
||||
$attachment = $model->findBy($id);
|
||||
if ($attachment && $model->deleteBy($id)) {
|
||||
Filesystem::delete($attachment->path);
|
||||
}
|
||||
}
|
||||
|
||||
return CatchResponse::success();
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user