support pg problem fix

This commit is contained in:
xiaomlove
2026-04-16 04:03:52 +07:00
parent 00fdc2d08f
commit e3376c3f1b
5 changed files with 27 additions and 8 deletions
+9
View File
@@ -200,6 +200,15 @@ class Torrent extends NexusModel
throw new \RuntimeException("Not supported database");
}
/**
* 重写获取 info_hash 的方法,确保从数据库读出时是正确的格式
*/
public function getInfoHashAttribute($value): false|string
{
// PostgreSQL 返回 bytea 时可能是十六进制流或资源
return is_resource($value) ? stream_get_contents($value) : $value;
}
public function getPickInfoAttribute()
{
$info = self::$pickTypes[$this->picktype] ?? null;