You've already forked guangan
统计
This commit is contained in:
@ -115,4 +115,10 @@ class Record extends Auth
|
|||||||
$this->success("成功");
|
$this->success("成功");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function count()
|
||||||
|
{
|
||||||
|
$total = $this->staff->records()->where('status', 0)->count();
|
||||||
|
$this->success('获取记录数量成功', compact('total'));
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
@ -142,4 +142,13 @@ class Ticket extends Auth
|
|||||||
$ticket->save();
|
$ticket->save();
|
||||||
$this->success('工单维修成功');
|
$this->success('工单维修成功');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function count()
|
||||||
|
{
|
||||||
|
$view_count = $this->staff->views()->where('status', '=', 0)->count();
|
||||||
|
$repair_count = $this->staff->repairs()->where('status', '=', 0)->count();
|
||||||
|
$verify_count = $this->staff->verifys()->where('status', '=', 0)->count();
|
||||||
|
$total = $view_count + $repair_count + $verify_count;
|
||||||
|
$this->success('获取工单统计', compact('view_count', 'repair_count', 'verify_count', 'total'));
|
||||||
|
}
|
||||||
}
|
}
|
@ -2,6 +2,9 @@
|
|||||||
|
|
||||||
namespace plugin\inspection\model;
|
namespace plugin\inspection\model;
|
||||||
|
|
||||||
|
use plugin\ticket\model\TicketRepair;
|
||||||
|
use plugin\ticket\model\TicketVerify;
|
||||||
|
use plugin\ticket\model\TicketView;
|
||||||
use think\admin\Model;
|
use think\admin\Model;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -15,6 +18,21 @@ class InspectionStaff extends Model
|
|||||||
return $this->hasMany(InspectionStaffToken::class, 'staff_id', 'id');
|
return $this->hasMany(InspectionStaffToken::class, 'staff_id', 'id');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function views()
|
||||||
|
{
|
||||||
|
return $this->hasMany(TicketView::class, 'staff_id', 'id');
|
||||||
|
}
|
||||||
|
|
||||||
|
public function repairs()
|
||||||
|
{
|
||||||
|
return $this->hasMany(TicketRepair::class, 'staff_id', 'id');
|
||||||
|
}
|
||||||
|
|
||||||
|
public function verifys()
|
||||||
|
{
|
||||||
|
return $this->hasMany(TicketVerify::class, 'staff_id', 'id');
|
||||||
|
}
|
||||||
|
|
||||||
public function records()
|
public function records()
|
||||||
{
|
{
|
||||||
return $this->hasMany(InspectionRecord::class, 'staff_id', 'id');
|
return $this->hasMany(InspectionRecord::class, 'staff_id', 'id');
|
||||||
|
Reference in New Issue
Block a user