feat : oss

This commit is contained in:
2024-11-12 11:14:48 +08:00
parent a9f81888b7
commit 86b94d168c
7 changed files with 74 additions and 12 deletions

View File

@@ -4,6 +4,7 @@ declare(strict_types=1);
namespace App\Model;
use App\Constants\Common\OssObjectCode;
use Hyperf\Collection\Collection;
use Hyperf\DbConnection\Model\Model;
use function Hyperf\Config\config;
@@ -69,7 +70,7 @@ class OssObject extends Model
*/
public function updateEnabledByIds(array $ids): int
{
return $this->whereIn('id', $ids)->update(['is_enabled' => 1]);
return $this->whereIn('id', $ids)->update(['is_enabled' => OssObjectCode::ENABLE]);
}
/**
@@ -79,7 +80,7 @@ class OssObject extends Model
*/
public function updateDisableByIds(array $ids): int
{
return $this->whereIn('id', $ids)->update(['is_enabled' => 0]);
return $this->whereIn('id', $ids)->update(['is_enabled' => OssObjectCode::DISABLE]);
}
/**
@@ -100,7 +101,7 @@ class OssObject extends Model
public function getOssIdListByIsEnabled($time): Collection|false
{
return $this->where([
['is_enabled', '=', 0],
['is_enabled', '=', OssObjectCode::DISABLE],
['create_time', '<',$time]
])->pluck('id') ?? false;
}