feat: add article and production modules

This commit is contained in:
2026-08-31 13:16:46 +08:00
parent ac3da246b2
commit 5c586a1a95
334 changed files with 34419 additions and 1 deletions
@@ -0,0 +1,81 @@
<?php
declare(strict_types=1);
namespace plugin\produce\app\model;
class ExceptionRecord extends BaseModel
{
protected $table = 'produce_exception_record';
protected $appends = ['reported_date', 'handled_date', 'status_name'];
protected static function booted(): void
{
static::creating(function (self $model) {
if (empty($model->reported_at)) {
$model->reported_at = time();
}
});
}
protected $fillable = [
'id',
'order_no',
'user_code',
'reporter',
'reporter_id',
'type_id',
'type_code',
'type_name',
'reason_id',
'reason_code',
'reason_name',
'issue_id',
'issue_code',
'issue_name',
'images',
'remark',
'status',
'handler',
'handler_id',
'handled_at',
'reported_at',
'created_by',
'updated_by',
'created_at',
'updated_at',
'deleted_at',
];
protected $casts = [
'images' => 'array',
'status' => 'integer',
'handled_at' => 'integer',
'reported_at' => 'integer',
'created_by' => 'integer',
'updated_by' => 'integer',
'created_at' => 'integer',
'updated_at' => 'integer',
'deleted_at' => 'integer',
];
public function getReportedDateAttribute(): ?string
{
return $this->reported_at ? date('Y-m-d H:i:s', (int) $this->reported_at) : null;
}
public function getHandledDateAttribute(): ?string
{
return $this->handled_at ? date('Y-m-d H:i:s', (int) $this->handled_at) : null;
}
public function getStatusNameAttribute(): string
{
return match ((int) $this->status) {
1 => '处理中',
2 => '已处理',
default => '待处理',
};
}
}