From 158fc445e6eeb88d697da028dbe78aeac8878672 Mon Sep 17 00:00:00 2001 From: Jerry Yan <792602257@qq.com> Date: Sun, 1 Dec 2024 15:44:47 +0800 Subject: [PATCH] UserShare --- .../src/controller/UserShare.php | 48 +++++ .../src/view/user_share/detail.html | 194 ++++++++++++++++-- .../src/view/user_share/index.html | 7 + .../src/view/user_share/index_search.html | 10 + 4 files changed, 240 insertions(+), 19 deletions(-) diff --git a/plugs/think-plugs-ticket/src/controller/UserShare.php b/plugs/think-plugs-ticket/src/controller/UserShare.php index 197fbcf..a013325 100644 --- a/plugs/think-plugs-ticket/src/controller/UserShare.php +++ b/plugs/think-plugs-ticket/src/controller/UserShare.php @@ -2,6 +2,8 @@ namespace plugin\ticket\controller; +use plugin\points_mall\service\UserPointService; +use plugin\ticket\model\TicketTicket; use plugin\ticket\model\TicketType; use plugin\ticket\model\TicketUserShare; use think\admin\Controller; @@ -49,6 +51,52 @@ class UserShare extends Controller ]); $this->vo = TicketUserShare::mk()->where($where)->with(['linked_ticket'])->findOrEmpty(); if ($this->vo->isEmpty()) $this->error('用户随手拍不存在!'); + if (!$this->vo->linked_ticket_id) { + $this->ticket_list = TicketTicket::mk()->scope(['avail'])->select(); + } else { + $this->ticket_list = []; + } + $this->type_list = TicketType::getList(); + $this->user_list = []; $this->fetch('detail'); } + + public function link() + { + $basic_data = $this->_vali([ + 'id.require' => '随手拍ID不能为空', + '_type.require' => '类型不能为空', + 'content.require' => '回复内容不能为空', + 'point_aware.require' => '奖励积分不能为空', + 'point_aware.number' => '奖励积分必须为数字', + ]); + $userShare = TicketUserShare::mk()->where(['id' => $basic_data['id']])->findOrEmpty(); + if ($userShare->isEmpty()) $this->error('用户随手拍不存在!'); + if ($userShare->status !== 0) $this->error('用户随手拍已处理!'); + $ticket_id = null; + switch ($basic_data['_type']) { + case 'new': + $data = $this->_vali([ + 'type_id.require' => '类型不能为空', + 'user_id.require' => '请选择处理人员', + ]); + break; + case 'exist': + $data = $this->_vali([ + 'ticket_id.require' => '请选择处理工单', + ]); + $ticket_id = $data['ticket_id']; + $ticket = TicketTicket::mk()->where(['id' => $data['ticket_id']])->findOrEmpty(); + if ($ticket->isEmpty()) $this->error('工单不存在!'); + break; + default: + $this->error('参数错误'); + } + $userShare->linked_ticket_id = $ticket_id; + $userShare->response = $basic_data['content']; + $userShare->point_aware = $basic_data['point_aware']; + UserPointService::addUserPoint($userShare->user_id, $basic_data['point_aware'], '用户随手拍奖励积分'); + $userShare->status = 1; + $userShare->save(); + } } \ No newline at end of file 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 58ff4dc..45788d6 100644 --- a/plugs/think-plugs-ticket/src/view/user_share/detail.html +++ b/plugs/think-plugs-ticket/src/view/user_share/detail.html @@ -1,9 +1,7 @@
@@ -36,37 +34,46 @@ 随手拍图片
+ {if count($vo.imgs_arr) > 0} {foreach $vo.imgs_arr as $img} image   {/foreach} + {else} + 无图片 + {/if}
+ {if $vo.status} + + 回复内容 + {$vo.content|default=""} + + {/if} + {if $vo.ticket_lat && $vo.ticket_lng} + + 位置 + +
+ + + {/if}
{if $vo.ticket_lat && $vo.ticket_lng} -
-
地图位置
-
-
-
-
{/if}
- {if $vo.linked_ticket_id}
- 123 + {if $vo.linked_ticket_id} +
+
关联工单
+
+ + + + + + + + + + + +
工单编号{$vo.ticket.id|default=""}
工单类型{$vo.ticket.type_name|default=""}
+
+
+ {else} +
+
关联工单
+
+
+ +
+ +
+ +
+
+
+ +
+ +
+
+
+ +
+ +
+
+
+ +
+ +
+
+
+ +
+ +
给用户反馈的内容,会发送给用户,请谨慎填写
+
+
+
+ +
+ +
+
+
+
+ +
+
+
+
+
+ + {/if}
- {/if} diff --git a/plugs/think-plugs-ticket/src/view/user_share/index.html b/plugs/think-plugs-ticket/src/view/user_share/index.html index 68375ad..94a1a92 100644 --- a/plugs/think-plugs-ticket/src/view/user_share/index.html +++ b/plugs/think-plugs-ticket/src/view/user_share/index.html @@ -52,6 +52,13 @@ return ''; } }}, + {field:'status', title:'回复状态', width:100, templet:function(item){ + if (item.status == 0) { + return '未回复'; + } else { + return '已回复'; + } + }}, {fixed: 'right', title:'操作', toolbar: '#toolbar', width:200} ]], page: true diff --git a/plugs/think-plugs-ticket/src/view/user_share/index_search.html b/plugs/think-plugs-ticket/src/view/user_share/index_search.html index ccb90db..ef51365 100644 --- a/plugs/think-plugs-ticket/src/view/user_share/index_search.html +++ b/plugs/think-plugs-ticket/src/view/user_share/index_search.html @@ -24,6 +24,16 @@ +
+ +
+ +
+