Explorar el Código

修复:后台删除文件库图片时报错

萤火科技 hace 1 año
padre
commit
6bbe6d0c3a
Se han modificado 2 ficheros con 4 adiciones y 4 borrados
  1. 2 2
      app/common/model/UploadFile.php
  2. 2 2
      app/store/model/UploadFile.php

+ 2 - 2
app/common/model/UploadFile.php

@@ -84,7 +84,7 @@ class UploadFile extends BaseModel
      */
     public static function detail(int $fileId)
     {
-        return self::get($fileId);
+        return static::get($fileId);
     }
 
     /**
@@ -93,7 +93,7 @@ class UploadFile extends BaseModel
      * @param int|null $storeId
      * @return array
      */
-    public static function filteFileIds(array $fileIds, int $storeId = null): array
+    public static function filterFileIds(array $fileIds, int $storeId = null): array
     {
         return (new static)->where('file_id', 'in', $fileIds)
             ->where('store_id', '=', $storeId ?: self::$storeId)

+ 2 - 2
app/store/model/UploadFile.php

@@ -83,7 +83,7 @@ class UploadFile extends UploadFileModel
     public function setDelete(array $fileIds): bool
     {
         // 验证文件数量
-        if (count($fileIds) > 15) {
+        if (\count($fileIds) > 15) {
             $this->error = '一次性最多删除15个文件';
             return false;
         }
@@ -91,7 +91,7 @@ class UploadFile extends UploadFileModel
         $config = SettingModel::getItem(SettingEnum::STORAGE);
         foreach ($fileIds as $fileId) {
             // 获取文件详情
-            $fileInfo = static::detail($fileId);
+            $fileInfo = static::detail((int)$fileId);
             if ($fileInfo['storage'] != 'external') {
                 // 实例化存储驱动
                 $storage = new StorageDriver($config, $fileInfo['storage']);