|
|
@@ -83,6 +83,28 @@ class OCRRecord extends Model
|
|
|
return '';
|
|
|
}
|
|
|
|
|
|
+ /**
|
|
|
+ * 获取处理完成时间(确保返回 Carbon 对象)
|
|
|
+ */
|
|
|
+ public function getProcessedAtAttribute($value): ?\Carbon\Carbon
|
|
|
+ {
|
|
|
+ if (empty($value)) {
|
|
|
+ return null;
|
|
|
+ }
|
|
|
+
|
|
|
+ // 如果已经是 Carbon 实例,直接返回
|
|
|
+ if ($value instanceof \Carbon\Carbon) {
|
|
|
+ return $value;
|
|
|
+ }
|
|
|
+
|
|
|
+ // 如果是字符串,解析为 Carbon 实例
|
|
|
+ if (is_string($value)) {
|
|
|
+ return \Carbon\Carbon::parse($value);
|
|
|
+ }
|
|
|
+
|
|
|
+ return null;
|
|
|
+ }
|
|
|
+
|
|
|
public function getProgressPercentageAttribute(): int
|
|
|
{
|
|
|
if ($this->total_questions === 0) {
|