巡检接口

This commit is contained in:
2024-11-28 14:41:32 +08:00
parent ee7058d4de
commit 00688ebe35
7 changed files with 189 additions and 1 deletions

View File

@ -0,0 +1,23 @@
<?php
namespace plugin\inspection\model;
use think\admin\Model;
class InspectionMessage extends Model
{
public function staff()
{
return $this->belongsTo(InspectionStaff::class, 'staff_id', 'id');
}
public function scopeUnread($query)
{
return $query->where('status', 0);
}
public function scopeRead($query)
{
return $query->where('status', 1);
}
}

View File

@ -2,6 +2,7 @@
namespace plugin\inspection\model;
use plugin\ticket\model\TicketTicket;
use think\admin\Model;
class InspectionRecord extends Model
@ -43,4 +44,9 @@ class InspectionRecord extends Model
return $distance;
}
public function ticket()
{
return $this->morphMany(TicketTicket::class, 'source');
}
}

View File

@ -4,6 +4,10 @@ namespace plugin\inspection\model;
use think\admin\Model;
/**
* 检修员工模型
* @property InspectionStaff $name
*/
class InspectionStaff extends Model
{
public function tokens()
@ -15,4 +19,9 @@ class InspectionStaff extends Model
{
return $this->hasMany(InspectionRecord::class, 'staff_id', 'id');
}
public function messages()
{
return $this->hasMany(InspectionMessage::class, 'staff_id', 'id');
}
}