You've already forked guangan
巡检接口
This commit is contained in:
23
plugs/think-plugs-inspection/src/model/InspectionMessage.php
Normal file
23
plugs/think-plugs-inspection/src/model/InspectionMessage.php
Normal 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);
|
||||
}
|
||||
}
|
@ -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');
|
||||
}
|
||||
|
||||
}
|
@ -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');
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user