158 lines
3.4 KiB
PHP
158 lines
3.4 KiB
PHP
<?php
|
||
include './head.php';
|
||
|
||
?>
|
||
|
||
<?php
|
||
|
||
|
||
if ($active_ticket != "无") {
|
||
|
||
$at = json_decode($active_ticket, true);
|
||
|
||
$at = $at['ticket'];
|
||
$title = $at['title'];
|
||
$created_at = $at['created_at'];
|
||
$priority = $at['priority'];
|
||
$last_reply_time = $at['last_reply_time'];
|
||
$related_product = $at['related_product'];
|
||
$status = $at['status'];
|
||
|
||
|
||
$i_ticket = '
|
||
|
||
<tr>
|
||
<td>' . $title . '</td>
|
||
<td>' . $related_product . '</td>
|
||
<td>' . $priority . '</td>
|
||
<td><code>' . $status . '</code></td>
|
||
<td>' . $last_reply_time . '</td>
|
||
<td><a href="./u_ticket.fx" class="mdui-btn mdui-btn-icon mdui-ripple">
|
||
<i class="mdui-icon material-icons">border_color</i>
|
||
</a></td>
|
||
</tr>
|
||
|
||
';
|
||
|
||
}else{
|
||
$i_ticket = '';
|
||
|
||
|
||
|
||
}
|
||
|
||
|
||
?>
|
||
|
||
|
||
|
||
<?php
|
||
if ($active_ticket == "无") {
|
||
|
||
echo '<a href="./u_ticket.fx" class="mdui-btn mdui-btn-block mdui-color-theme-accent mdui-ripple">
|
||
提交工单
|
||
</a><br>';
|
||
|
||
|
||
|
||
}
|
||
|
||
|
||
?>
|
||
|
||
<div class="rx mdui-table-fluid mdui-card rk-j-ro">
|
||
<table class="mdui-table mdui-card rk-j-ro">
|
||
<thead>
|
||
<tr>
|
||
<th>工单标题</th>
|
||
<th>关联项目</th>
|
||
<th>紧急程度</th>
|
||
<th>工单状态</th>
|
||
<th>最近回复</th>
|
||
<th>工单操作</th>
|
||
</tr>
|
||
</thead>
|
||
<tbody>
|
||
<?=$i_ticket?>
|
||
<?php
|
||
// 设置要读取的目录路径
|
||
$directory = './me/' . $user . '/' . $pass . '/tickets';
|
||
// 检查目录是否存在
|
||
if (!is_dir($directory)) {
|
||
|
||
@mkdir($targetDirectory, 0755, true);
|
||
|
||
|
||
}
|
||
|
||
// 获取目录下的所有.json文件
|
||
$jsonFiles = glob($directory . '/*.json');
|
||
|
||
// 如果没有找到任何.json文件,输出无数据的表格
|
||
if (empty($jsonFiles)) {
|
||
echo '
|
||
|
||
|
||
|
||
<tr>
|
||
<td>无数据</td>
|
||
<td>无数据</td>
|
||
<td>无数据</td>
|
||
<td class="mdui-typo">无数据</td>
|
||
<td>无数据</td>
|
||
<td>无数据</td>
|
||
</tr>';
|
||
} else {
|
||
// 遍历每个.json文件
|
||
foreach ($jsonFiles as $file) {
|
||
// 读取文件内容
|
||
$jsonContent = file_get_contents($file);
|
||
// 将内容解析为数组
|
||
$ticketData = json_decode($jsonContent, true);
|
||
|
||
// 解析工单信息
|
||
if (isset($ticketData['ticket'])) {
|
||
$ticket = $ticketData['ticket'];
|
||
$title = htmlspecialchars($ticket['title']);
|
||
$created_at = htmlspecialchars($ticket['created_at']);
|
||
$priority = htmlspecialchars($ticket['priority']);
|
||
$last_reply_time = htmlspecialchars($ticket['last_reply_time']);
|
||
$related_product = htmlspecialchars($ticket['related_product']);
|
||
$status = htmlspecialchars($ticket['status']);
|
||
$fileName = basename($file); // 获取文件名
|
||
|
||
// 输出HTML表格行
|
||
echo '
|
||
|
||
|
||
|
||
<tr>
|
||
<td>' . $title . '</td>
|
||
<td>' . $related_product . '</td>
|
||
<td>' . $priority . '</td>
|
||
<td class="mdui-typo"><code>' . $status . '</code></td>
|
||
<td>' . $last_reply_time . '</td>
|
||
<td><a href="./show_ticket.fx?name=' . $fileName . '" class="mdui-btn mdui-btn-icon mdui-ripple">
|
||
<i class="mdui-icon material-icons">remove_red_eye</i>
|
||
</a></td>
|
||
</tr>
|
||
|
||
|
||
';
|
||
}
|
||
}
|
||
}
|
||
?>
|
||
|
||
|
||
</tbody>
|
||
</table>
|
||
</div>
|
||
|
||
|
||
<br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br>
|
||
|
||
|
||
|
||
|