From b5a515b0ac444ffdbd5b582598c4192cb48f9eb9 Mon Sep 17 00:00:00 2001
From: Jerry Yan <792602257@qq.com>
Date: Wed, 12 Mar 2025 14:51:19 +0800
Subject: [PATCH] =?UTF-8?q?=E5=B8=B8=E7=94=A8=E5=9B=9E=E5=A4=8D=E5=92=8C?=
=?UTF-8?q?=E7=9B=B4=E6=8E=A5=E5=9B=9E=E5=A4=8D=E5=8A=9F=E8=83=BD?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.../src/controller/CommonReply.php | 97 +++++++++++++++++++
.../src/controller/UserShare.php | 12 +++
.../src/model/TicketCommonReply.php | 23 +++++
.../src/model/TicketUserShare.php | 5 +
.../src/model/TicketUserShareLog.php | 21 ++++
.../src/view/common_reply/form.html | 20 ++++
.../src/view/common_reply/index.html | 60 ++++++++++++
.../src/view/common_reply/index_search.html | 16 +++
.../src/view/user_share/detail.html | 80 ++++++++++-----
9 files changed, 311 insertions(+), 23 deletions(-)
create mode 100644 plugs/think-plugs-ticket/src/controller/CommonReply.php
create mode 100644 plugs/think-plugs-ticket/src/model/TicketCommonReply.php
create mode 100644 plugs/think-plugs-ticket/src/model/TicketUserShareLog.php
create mode 100644 plugs/think-plugs-ticket/src/view/common_reply/form.html
create mode 100644 plugs/think-plugs-ticket/src/view/common_reply/index.html
create mode 100644 plugs/think-plugs-ticket/src/view/common_reply/index_search.html
diff --git a/plugs/think-plugs-ticket/src/controller/CommonReply.php b/plugs/think-plugs-ticket/src/controller/CommonReply.php
new file mode 100644
index 0000000..1720efc
--- /dev/null
+++ b/plugs/think-plugs-ticket/src/controller/CommonReply.php
@@ -0,0 +1,97 @@
+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('禁用成功!');
+ }
+}
\ No newline at end of file
diff --git a/plugs/think-plugs-ticket/src/controller/UserShare.php b/plugs/think-plugs-ticket/src/controller/UserShare.php
index 7283a6a..7487368 100644
--- a/plugs/think-plugs-ticket/src/controller/UserShare.php
+++ b/plugs/think-plugs-ticket/src/controller/UserShare.php
@@ -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('处理成功!');
}
}
\ No newline at end of file
diff --git a/plugs/think-plugs-ticket/src/model/TicketCommonReply.php b/plugs/think-plugs-ticket/src/model/TicketCommonReply.php
new file mode 100644
index 0000000..559a7ca
--- /dev/null
+++ b/plugs/think-plugs-ticket/src/model/TicketCommonReply.php
@@ -0,0 +1,23 @@
+where('status', '=', 1);
+ }
+}
\ No newline at end of file
diff --git a/plugs/think-plugs-ticket/src/model/TicketUserShare.php b/plugs/think-plugs-ticket/src/model/TicketUserShare.php
index a9c4284..198e17b 100644
--- a/plugs/think-plugs-ticket/src/model/TicketUserShare.php
+++ b/plugs/think-plugs-ticket/src/model/TicketUserShare.php
@@ -31,4 +31,9 @@ class TicketUserShare extends Model
{
return $this->belongsTo(TicketTicket::class, 'linked_ticket_id', 'id');
}
+
+ public function logs()
+ {
+ return $this->hasMany(TicketUserShareLog::class, 'us_id', 'id');
+ }
}
\ No newline at end of file
diff --git a/plugs/think-plugs-ticket/src/model/TicketUserShareLog.php b/plugs/think-plugs-ticket/src/model/TicketUserShareLog.php
new file mode 100644
index 0000000..4e232f7
--- /dev/null
+++ b/plugs/think-plugs-ticket/src/model/TicketUserShareLog.php
@@ -0,0 +1,21 @@
+belongsTo(TicketUserShare::class, 'us_id', 'id');
+ }
+}
\ No newline at end of file
diff --git a/plugs/think-plugs-ticket/src/view/common_reply/form.html b/plugs/think-plugs-ticket/src/view/common_reply/form.html
new file mode 100644
index 0000000..5e309a7
--- /dev/null
+++ b/plugs/think-plugs-ticket/src/view/common_reply/form.html
@@ -0,0 +1,20 @@
+
\ No newline at end of file
diff --git a/plugs/think-plugs-ticket/src/view/common_reply/index.html b/plugs/think-plugs-ticket/src/view/common_reply/index.html
new file mode 100644
index 0000000..558038b
--- /dev/null
+++ b/plugs/think-plugs-ticket/src/view/common_reply/index.html
@@ -0,0 +1,60 @@
+{extend name="table"}
+
+{block name="button"}
+
+新增
+
+{/block}
+
+{block name="content"}
+
+
+
+ {include file='common_reply/index_search'}
+
+
+
+
+
+{/block}
+
+{block name='style'}
+
+{/block}
+
+{block name='script'}
+
+{/block}
\ No newline at end of file
diff --git a/plugs/think-plugs-ticket/src/view/common_reply/index_search.html b/plugs/think-plugs-ticket/src/view/common_reply/index_search.html
new file mode 100644
index 0000000..ee3bcfc
--- /dev/null
+++ b/plugs/think-plugs-ticket/src/view/common_reply/index_search.html
@@ -0,0 +1,16 @@
+
diff --git a/plugs/think-plugs-ticket/src/view/user_share/detail.html b/plugs/think-plugs-ticket/src/view/user_share/detail.html
index c0133e9..a244333 100644
--- a/plugs/think-plugs-ticket/src/view/user_share/detail.html
+++ b/plugs/think-plugs-ticket/src/view/user_share/detail.html
@@ -1,7 +1,7 @@
@@ -105,35 +105,60 @@
{/if}
- {if $vo.linked_ticket_id}
-
-
-
-
-
-
- 工单编号 |
- {$vo.linked_ticket.id|default=""} |
-
-
- 工单类型 |
- {$vo.linked_ticket.type_name|default=""} |
-
-
-
+ {if $vo.status eq 1}
+ {if $vo.linked_ticket_id}
+
+
+
+
+
+
+ 工单编号 |
+ {$vo.linked_ticket.id|default=""} |
+
+
+ 工单类型 |
+ {$vo.linked_ticket.type_name|default=""} |
+
+
+ 工单标题 |
+ {$vo.linked_ticket.title|default=""} |
+
+
+ 工单内容 |
+ {$vo.linked_ticket.content|default=""} |
+
+
+
+
-
+ {else}
+
+
+
+
+
+
+ 回复内容 |
+ {$vo.content|default=""} |
+
+
+
+
+
+ {/if}
{else}