62 lines
2.1 KiB
PHP
62 lines
2.1 KiB
PHP
<?php
|
|
|
|
namespace App\Models\Business;
|
|
|
|
use App\Abstracts\Model;
|
|
use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
|
|
|
class CourierOnboardingEvent extends Model
|
|
{
|
|
protected $table = 'business_courier_onboarding_events';
|
|
|
|
protected $fillable = ['company_id', 'onboarding_id', 'event_type', 'from_status', 'to_status', 'note', 'actor_type', 'actor_id'];
|
|
|
|
protected $casts = [
|
|
'company_id' => 'integer',
|
|
'onboarding_id' => 'integer',
|
|
'actor_id' => 'integer',
|
|
'deleted_at' => 'datetime',
|
|
];
|
|
|
|
public function actor(): BelongsTo
|
|
{
|
|
return $this->belongsTo(user_model_class(), 'actor_id');
|
|
}
|
|
|
|
public function eventLabel(): string
|
|
{
|
|
return match ($this->event_type) {
|
|
'invited' => '生成入驻二维码',
|
|
'saved' => '快递方保存资料',
|
|
'submitted' => '快递方提交审核',
|
|
'dingtalk_starting' => '正在发起钉钉审批',
|
|
'dingtalk_started' => '已发起钉钉审批',
|
|
'dingtalk_failed' => '钉钉审批发起失败',
|
|
'dingtalk_unknown' => '钉钉审批结果待核查',
|
|
'dingtalk_profile_synced' => '钉钉快递资料已同步',
|
|
'dingtalk_profile_failed' => '钉钉快递资料同步待处理',
|
|
'dingtalk_profile_closed' => '钉钉审批未通过,未同步资料',
|
|
'first_approved' => '初审通过',
|
|
'returned' => '退回补件',
|
|
'final_approved' => '财务复审通过',
|
|
'activated' => '确认开通',
|
|
'rejected' => '不予合作',
|
|
'cancelled' => '作废邀请',
|
|
'extended' => '延长链接有效期',
|
|
'internal_updated' => '更新内部信息',
|
|
'quote_pushed' => '推送报价确认单到 e签宝',
|
|
'quote_push_failed' => '报价确认单推送失败',
|
|
default => $this->event_type,
|
|
};
|
|
}
|
|
|
|
public function actorLabel(): string
|
|
{
|
|
if ($this->actor_type === 'courier') {
|
|
return '快递方';
|
|
}
|
|
|
|
return (string) ($this->actor?->name ?? '系统');
|
|
}
|
|
}
|