Compare commits
2 Commits
0d82bd27b3
...
c30385b073
| Author | SHA1 | Date | |
|---|---|---|---|
| c30385b073 | |||
| 02a7a4e518 |
@@ -118,7 +118,7 @@ class TicketService
|
||||
* @param $role 当前登录用户角色
|
||||
* @return array
|
||||
*/
|
||||
public function updateTicket($id, $data, $allowFields, $uid, $isSuper = false)
|
||||
public function updateTicket($id, $data, $allowFields, $isRole, $isSuper = false)
|
||||
{
|
||||
$ticket = Tickets::where('id', $id)->find();
|
||||
|
||||
@@ -126,14 +126,6 @@ class TicketService
|
||||
throw new \Exception('工单不存在');
|
||||
}
|
||||
|
||||
// 当不是管理员,进入判断
|
||||
if (!$isSuper) {
|
||||
if (!is_null($ticket->user_id) && $ticket->user_id != $uid) {
|
||||
throw new \Exception('没有权限修改该工单');
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// 提取 $allowFields 允许修改的字段
|
||||
$updateData = [];
|
||||
foreach ($allowFields as $field) {
|
||||
|
||||
@@ -14,13 +14,13 @@ class Ticket extends BaseController
|
||||
public function updateTicket(TicketService $ticketService, $id)
|
||||
{
|
||||
|
||||
$adminId = Session::get('id'); // 获取当前登录ID
|
||||
$isUser = Session::get('user_info.role') === 'user'; // 获取当前登录ID
|
||||
$data = $this->request->post();
|
||||
|
||||
$allowFields = ['datanum', 'progress', 'status', 'remark', 'lock_time'];
|
||||
|
||||
try {
|
||||
$result = $ticketService->updateTicket($id, $data, $allowFields, $adminId, false);
|
||||
$result = $ticketService->updateTicket($id, $data, $allowFields, $isUser, false);
|
||||
return json(['code' => 200, 'msg' => '更新成功', 'data' => $result]);
|
||||
} catch (\Exception $e) {
|
||||
return json(['code' => 400, 'msg' => $e->getMessage()]);
|
||||
|
||||
Reference in New Issue
Block a user