Files
NewTicket/app/index/service/ClientTicketService.php
2026-05-26 09:44:21 +08:00

28 lines
638 B
PHP

<?php
namespace app\index\service;
use app\common\model\User as UserModel;
class ClientTicketService
{
/* 获取客户关联工单 */
public function getClientTickets($clientId)
{
# 查询当前登录用户所对应的工单
$tickets = UserModel::with(['tickets'])->find($clientId);
$newList = [];
foreach ($tickets->tickets as $ticket) {
if (in_array($ticket->status, [0, 1, 2])) {
$ticket->visible(['id', 'website', 'datanum', 'progress', 'status']);
$newList[] = $ticket->toArray();
}
}
return $newList;
}
}