You've already forked guangan
工单分类
This commit is contained in:
@ -0,0 +1,22 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace plugin\inspection\controller\api\auth;
|
||||||
|
|
||||||
|
use plugin\inspection\controller\api\Auth;
|
||||||
|
use plugin\ticket\model\TicketRepair as Model;
|
||||||
|
|
||||||
|
class TicketRepair extends Auth
|
||||||
|
{
|
||||||
|
|
||||||
|
public function list()
|
||||||
|
{
|
||||||
|
$query = Model::query()->scope(['notFinish'])->with(['ticket'])->where(['staff_id'=>$this->staff->id]);
|
||||||
|
$keyword = $this->request->get('keyword', null);
|
||||||
|
if ($keyword) {
|
||||||
|
$query->where('title', 'like', "%{$keyword}%");
|
||||||
|
}
|
||||||
|
$pageData = $query->paginate();
|
||||||
|
$this->success('获取工单列表', $pageData);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,22 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace plugin\inspection\controller\api\auth;
|
||||||
|
|
||||||
|
use plugin\inspection\controller\api\Auth;
|
||||||
|
use plugin\ticket\model\TicketVerify as Model;
|
||||||
|
|
||||||
|
class TicketVerify extends Auth
|
||||||
|
{
|
||||||
|
|
||||||
|
public function list()
|
||||||
|
{
|
||||||
|
$query = Model::query()->scope(['notFinish'])->with(['ticket'])->where(['staff_id'=>$this->staff->id]);
|
||||||
|
$keyword = $this->request->get('keyword', null);
|
||||||
|
if ($keyword) {
|
||||||
|
$query->where('title', 'like', "%{$keyword}%");
|
||||||
|
}
|
||||||
|
$pageData = $query->paginate();
|
||||||
|
$this->success('获取工单列表', $pageData);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,22 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace plugin\inspection\controller\api\auth;
|
||||||
|
|
||||||
|
use plugin\inspection\controller\api\Auth;
|
||||||
|
use plugin\ticket\model\TicketView as Model;
|
||||||
|
|
||||||
|
class TicketView extends Auth
|
||||||
|
{
|
||||||
|
|
||||||
|
public function list()
|
||||||
|
{
|
||||||
|
$query = Model::query()->scope(['notFinish'])->with(['ticket'])->where(['staff_id'=>$this->staff->id]);
|
||||||
|
$keyword = $this->request->get('keyword', null);
|
||||||
|
if ($keyword) {
|
||||||
|
$query->where('title', 'like', "%{$keyword}%");
|
||||||
|
}
|
||||||
|
$pageData = $query->paginate();
|
||||||
|
$this->success('获取工单列表', $pageData);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -22,4 +22,9 @@ class TicketRepair extends Model
|
|||||||
{
|
{
|
||||||
return str2arr($data['imgs'] ?: '', '|');
|
return str2arr($data['imgs'] ?: '', '|');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function scopeNotFinish($query)
|
||||||
|
{
|
||||||
|
$query->where('status', '=', '0');
|
||||||
|
}
|
||||||
}
|
}
|
@ -125,6 +125,10 @@ class TicketTicket extends Model
|
|||||||
return $this->hasMany(TicketRepair::class, 'ticket_id')->order('create_at', 'desc');
|
return $this->hasMany(TicketRepair::class, 'ticket_id')->order('create_at', 'desc');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function views() {
|
||||||
|
return $this->hasMany(TicketView::class, 'ticket_id')->order('create_at', 'desc');
|
||||||
|
}
|
||||||
|
|
||||||
public function repair_accept()
|
public function repair_accept()
|
||||||
{
|
{
|
||||||
return $this->hasMany(TicketRepairAccept::class, 'ticket_id')->order('create_at', 'desc');
|
return $this->hasMany(TicketRepairAccept::class, 'ticket_id')->order('create_at', 'desc');
|
||||||
|
@ -22,4 +22,9 @@ class TicketVerify extends Model
|
|||||||
{
|
{
|
||||||
return str2arr($data['imgs'] ?: '', '|');
|
return str2arr($data['imgs'] ?: '', '|');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function scopeNotFinish($query)
|
||||||
|
{
|
||||||
|
$query->where('status', '=', '0');
|
||||||
|
}
|
||||||
}
|
}
|
30
plugs/think-plugs-ticket/src/model/TicketView.php
Normal file
30
plugs/think-plugs-ticket/src/model/TicketView.php
Normal file
@ -0,0 +1,30 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace plugin\ticket\model;
|
||||||
|
|
||||||
|
use plugin\inspection\model\InspectionStaff;
|
||||||
|
use think\admin\Model;
|
||||||
|
|
||||||
|
class TicketView extends Model
|
||||||
|
{
|
||||||
|
protected $append = ['imgs_arr'];
|
||||||
|
public function ticket()
|
||||||
|
{
|
||||||
|
return $this->belongsTo(TicketTicket::class, 'ticket_id');
|
||||||
|
}
|
||||||
|
|
||||||
|
public function staff()
|
||||||
|
{
|
||||||
|
return $this->belongsTo(InspectionStaff::class, 'staff_id');
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getImgsArrAttr($value, $data)
|
||||||
|
{
|
||||||
|
return str2arr($data['imgs'] ?: '', '|');
|
||||||
|
}
|
||||||
|
|
||||||
|
public function scopeNotFinish($query)
|
||||||
|
{
|
||||||
|
$query->where('status', '=', '0');
|
||||||
|
}
|
||||||
|
}
|
Reference in New Issue
Block a user