You've already forked guangan
内外部工单
This commit is contained in:
77
plugs/think-plugs-ticket/src/controller/TicketOuter.php
Normal file
77
plugs/think-plugs-ticket/src/controller/TicketOuter.php
Normal file
@ -0,0 +1,77 @@
|
||||
<?php
|
||||
|
||||
namespace plugin\ticket\controller;
|
||||
|
||||
use plugin\ticket\model\TicketReply;
|
||||
use plugin\ticket\model\TicketTicketOuter;
|
||||
use plugin\ticket\model\TicketType;
|
||||
use think\admin\Controller;
|
||||
use think\admin\helper\QueryHelper;
|
||||
|
||||
/**
|
||||
* 外部工单管理
|
||||
*/
|
||||
class TicketOuter extends Controller
|
||||
{
|
||||
/**
|
||||
* 工单列表
|
||||
* @auth true
|
||||
* @menu true
|
||||
* @return void
|
||||
* @throws \think\db\exception\DataNotFoundException
|
||||
* @throws \think\db\exception\DbException
|
||||
* @throws \think\db\exception\ModelNotFoundException
|
||||
*/
|
||||
public function index()
|
||||
{
|
||||
$this->title = '工单中心';
|
||||
$this->type_list = TicketType::getList();
|
||||
$this->user_id = $this->request->session('user')['id'];
|
||||
TicketTicketOuter::mQuery()->layTable(function () {
|
||||
|
||||
}, function (QueryHelper $query) {
|
||||
$query->like(['title|content|contact_name|ticket_address|contact_phone#keyword'])
|
||||
->dateBetween(['create_at'])
|
||||
->equal(['status', 'type_id']);
|
||||
$query->append(['imgs_arr', 'source_type_name', 'status_text', 'type_name', 'last_reply']);
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* 添加工单
|
||||
* @auth true
|
||||
* @menu true
|
||||
* @return void
|
||||
* @throws \think\db\exception\DataNotFoundException
|
||||
* @throws \think\db\exception\DbException
|
||||
* @throws \think\db\exception\ModelNotFoundException
|
||||
*/
|
||||
public function add()
|
||||
{
|
||||
$this->title = '添加工单';
|
||||
$this->types = TicketType::mk()->scope('active')->select();
|
||||
TicketTicketOuter::mForm('form');
|
||||
}
|
||||
|
||||
public function _form_filter(&$data)
|
||||
{
|
||||
if ($this->request->isPost()) {
|
||||
$data['user_id'] = 0;
|
||||
}
|
||||
$data['status'] = 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* 查看工单
|
||||
* @auth true
|
||||
* @menu true
|
||||
* @return void
|
||||
*/
|
||||
public function detail()
|
||||
{
|
||||
$this->title = '工单详情';
|
||||
['id' => $id] = $this->_vali(['id.require' => '请指定工单ID!']);
|
||||
$this->vo = TicketTicketOuter::mk()->with(['user', 'type', 'reply'])->append(['imgs_arr', 'status_text', 'type_name', 'last_reply'])->find($id);
|
||||
$this->fetch();
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user