You've already forked guangan
Dept
This commit is contained in:
10
plugs/think-plugs-ticket/src/model/TicketDept.php
Normal file
10
plugs/think-plugs-ticket/src/model/TicketDept.php
Normal file
@ -0,0 +1,10 @@
|
||||
<?php
|
||||
|
||||
namespace plugin\ticket\model;
|
||||
|
||||
use think\admin\Model;
|
||||
|
||||
class TicketDept extends Model
|
||||
{
|
||||
|
||||
}
|
@ -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');
|
||||
|
@ -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()
|
||||
|
@ -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()
|
||||
|
Reference in New Issue
Block a user