This commit is contained in:
2024-12-01 16:56:00 +08:00
parent 9f10f727ed
commit 19d38802a9
10 changed files with 206 additions and 4 deletions

View File

@ -0,0 +1,10 @@
<?php
namespace plugin\ticket\model;
use think\admin\Model;
class TicketDept extends Model
{
}

View File

@ -69,6 +69,16 @@ class TicketTicket extends Model
}
}
public function getDeptNameAttr($value, $data)
{
$dept = $this->dept()->find();
if (!empty($dept)) {
return $dept['name'];
} else {
return '未知';
}
}
private function getStatusList()
{
return [
@ -88,6 +98,11 @@ class TicketTicket extends Model
return $this->hasMany(TicketUserShare::class, 'linked_ticket_id');
}
public function dept()
{
return $this->belongsTo(TicketDept::class, 'dept_id');
}
public function scopeUnConf($query)
{
return $query->where('state', '=', '0');

View File

@ -4,7 +4,7 @@ namespace plugin\ticket\model;
class TicketTicketInter extends TicketTicket
{
protected $append = ['status_text', 'type_name'];
protected $append = ['status_text', 'type_name', 'dept_name'];
protected $globalScope = ['inter'];
protected $table = 'ticket_ticket';
public function type()

View File

@ -4,7 +4,7 @@ namespace plugin\ticket\model;
class TicketTicketOuter extends TicketTicket
{
protected $append = ['status_text', 'type_name'];
protected $append = ['status_text', 'type_name', 'dept_name'];
protected $globalScope = ['outer'];
protected $table = 'ticket_ticket';
public function type()