You've already forked guangan
常用回复和直接回复功能
This commit is contained in:
97
plugs/think-plugs-ticket/src/controller/CommonReply.php
Normal file
97
plugs/think-plugs-ticket/src/controller/CommonReply.php
Normal file
@ -0,0 +1,97 @@
|
||||
<?php
|
||||
|
||||
namespace plugin\ticket\controller;
|
||||
|
||||
use plugin\ticket\model\TicketCommonReply;
|
||||
use think\admin\Controller;
|
||||
use think\admin\helper\QueryHelper;
|
||||
|
||||
/**
|
||||
* 常用回复管理
|
||||
*/
|
||||
class CommonReply 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 = '常用回复列表';
|
||||
TicketCommonReply::mQuery()->layTable(function () {
|
||||
}, function (QueryHelper $query) {
|
||||
$query->like(['title#keyword'])
|
||||
->dateBetween(['create_at'])
|
||||
->equal(['status']);
|
||||
$query->append(['status_text']);
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* 添加常用回复
|
||||
* @auth true
|
||||
* @menu true
|
||||
* @return void
|
||||
*/
|
||||
public function add()
|
||||
{
|
||||
$this->title = '添加常用回复';
|
||||
TicketCommonReply::mForm('form');
|
||||
}
|
||||
|
||||
/**
|
||||
* 编辑常用回复
|
||||
* @auth true
|
||||
* @menu true
|
||||
* @return void
|
||||
*/
|
||||
public function edit()
|
||||
{
|
||||
$this->title = '编辑常用回复';
|
||||
TicketCommonReply::mForm('form');
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除常用回复
|
||||
* @auth true
|
||||
* @menu true
|
||||
* @return void
|
||||
*/
|
||||
public function remove()
|
||||
{
|
||||
TicketCommonReply::mDelete();
|
||||
}
|
||||
|
||||
/**
|
||||
* 启用常用回复
|
||||
* @auth true
|
||||
* @menu true
|
||||
* @return void
|
||||
*/
|
||||
public function enable()
|
||||
{
|
||||
$this->_applyFormToken();
|
||||
['id' => $id] = $this->_vali(['id.require' => '请指定常用回复ID!']);
|
||||
TicketCommonReply::mk()->where(['id' => $id])->update(['status' => 1]);
|
||||
$this->success('启用成功!');
|
||||
}
|
||||
|
||||
/**
|
||||
* 禁用常用回复
|
||||
* @auth true
|
||||
* @menu true
|
||||
* @return void
|
||||
*/
|
||||
public function disable()
|
||||
{
|
||||
$this->_applyFormToken();
|
||||
['id' => $id] = $this->_vali(['id.require' => '请指定常用回复ID!']);
|
||||
TicketCommonReply::mk()->where(['id' => $id])->update(['status' => 0]);
|
||||
$this->success('禁用成功!');
|
||||
}
|
||||
}
|
@ -3,6 +3,7 @@
|
||||
namespace plugin\ticket\controller;
|
||||
|
||||
use plugin\points_mall\service\UserPointService;
|
||||
use plugin\ticket\model\TicketCommonReply;
|
||||
use plugin\ticket\model\TicketTicket;
|
||||
use plugin\ticket\model\TicketType;
|
||||
use plugin\ticket\model\TicketUserShare;
|
||||
@ -59,6 +60,7 @@ class UserShare extends Controller
|
||||
}
|
||||
$this->type_list = TicketType::getList();
|
||||
$this->user_list = SystemUser::query()->select();
|
||||
$this->common_reply_list = TicketCommonReply::query()->scope(['avail'])->select();
|
||||
$this->fetch('detail');
|
||||
}
|
||||
|
||||
@ -75,6 +77,7 @@ class UserShare extends Controller
|
||||
if ($userShare->isEmpty()) $this->error('用户随手拍不存在!');
|
||||
if ($userShare->status !== 0) $this->error('用户随手拍已处理!');
|
||||
$ticket_id = null;
|
||||
$result = "已形成工单交由专人处理";
|
||||
switch ($basic_data['_type']) {
|
||||
case 'new':
|
||||
$data = $this->_vali([
|
||||
@ -112,6 +115,9 @@ class UserShare extends Controller
|
||||
$ticket->source = $userShare;
|
||||
$ticket->save();
|
||||
break;
|
||||
case 'skip':
|
||||
$result = "已处理完毕";
|
||||
break;
|
||||
default:
|
||||
$this->error('参数错误');
|
||||
}
|
||||
@ -121,6 +127,12 @@ class UserShare extends Controller
|
||||
UserPointService::addUserPoint($userShare->user_id, $basic_data['point_aware'], '用户随手拍奖励积分');
|
||||
$userShare->status = 1;
|
||||
$userShare->save();
|
||||
$adminInfo = $this->request->session('user');
|
||||
$userShare->logs()->save([
|
||||
'op_name' => $adminInfo["username"],
|
||||
'content' => $basic_data['content'],
|
||||
'result' => $result,
|
||||
]);
|
||||
$this->success('处理成功!');
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user