UserShare

This commit is contained in:
2024-12-01 15:53:17 +08:00
parent 158fc445e6
commit 3ec08279fe
4 changed files with 55 additions and 12 deletions

View File

@ -22,11 +22,6 @@ class TicketTicket extends Model
return $this->hasMany(TicketReply::class, 'ticket_id')->order("create_at", 'asc');
}
public function source()
{
return $this->morphTo();
}
public function getImgsArrAttr($value, $data)
{
return str2arr($data['imgs'] ?: '', '|');
@ -37,6 +32,24 @@ class TicketTicket extends Model
return $this->reply()->order('create_at', 'desc')->find();
}
public function getSourceTypeNameAttr($value, $data)
{
if (!empty($this->getSourceTypeList()[$data['source_type']])) {
return $this->getSourceTypeList()[$data['source_type']];
} else {
return '未知';
}
}
public function getSourceTypeList()
{
return [
0 => '其他',
1 => '用户随手拍',
2 => '工单',
];
}
public function getTypeNameAttr($value, $data)
{
$type = $this->type()->find();