no message
This commit is contained in:
144
user/admin.php
Normal file
144
user/admin.php
Normal file
@@ -0,0 +1,144 @@
|
||||
<?php
|
||||
|
||||
include './admin_head.php';
|
||||
|
||||
|
||||
?>
|
||||
|
||||
<main class="h-full overflow-y-auto">
|
||||
<div class="container px-6 mx-auto grid">
|
||||
<h2
|
||||
class="my-6 text-2xl font-semibold text-gray-700 dark:text-gray-200"
|
||||
>
|
||||
工单
|
||||
</h2>
|
||||
<div class="w-full overflow-hidden rounded-lg shadow-xs">
|
||||
<div class="w-full overflow-x-auto">
|
||||
<table class="w-full whitespace-no-wrap">
|
||||
<thead>
|
||||
<tr class="text-xs font-semibold tracking-wide text-left text-gray-500 uppercase border-b dark:border-gray-700 bg-gray-50 dark:text-gray-400 dark:bg-gray-800">
|
||||
<th class="px-4 py-3">工单</th>
|
||||
<th class="px-4 py-3">紧急程度</th>
|
||||
<th class="px-4 py-3">状态</th>
|
||||
<th class="px-4 py-3">回复时间</th>
|
||||
<th class="px-4 py-3">操作</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody id="active_ticket" class="bg-white divide-y dark:divide-gray-700 dark:bg-gray-800">
|
||||
|
||||
<?php
|
||||
|
||||
// 读取指定目录下的所有目录并按顺序处理
|
||||
function readDirectories($path) {
|
||||
$users = array_filter(scandir($path), function ($item) use ($path) {
|
||||
return is_dir($path . '/' . $item) && $item != '.' && $item != '..';
|
||||
});
|
||||
return array_values($users); // 返回所有子目录
|
||||
}
|
||||
|
||||
// 读取并解析ticket.json文件内容
|
||||
function readTicketJson($userDir, $passDir) {
|
||||
$filePath = "./me/$userDir/$passDir/ticket.json";
|
||||
if (file_exists($filePath)) {
|
||||
$jsonContent = file_get_contents($filePath);
|
||||
return json_decode($jsonContent, true);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
// 解析并格式化输出工单信息
|
||||
function formatTicket($ticketData, $user, $pass) {
|
||||
$at = $ticketData['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'];
|
||||
|
||||
// 生成HTML表格内容
|
||||
$ticket = '
|
||||
<tr class="text-gray-700 dark:text-gray-400">
|
||||
<td class="px-4 py-3">
|
||||
<div class="flex items-center text-sm">
|
||||
<div class="relative hidden md:block rounded-full p-3 mr-4 text-teal-500 bg-teal-100 rounded-full dark:text-teal-100 dark:bg-teal-500">
|
||||
<svg class="w-5 h-5" fill="currentColor" viewBox="0 0 20 20">
|
||||
<path fill-rule="evenodd" d="M18 5v8a2 2 0 01-2 2h-5l-5 4v-4H4a2 2 0 01-2-2V5a2 2 0 012-2h12a2 2 0 012 2zM7 8H5v2h2V8zm2 0h2v2H9V8zm6 0h-2v2h2V8z" clip-rule="evenodd"></path>
|
||||
</svg>
|
||||
</div>
|
||||
<div>
|
||||
<p class="font-semibold">'.$title.'</p>
|
||||
<p class="text-xs text-gray-600 dark:text-gray-400">
|
||||
'.$related_product.'
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
</td>
|
||||
<td class="px-4 py-3 text-sm">
|
||||
'.$priority.'
|
||||
</td>
|
||||
<td class="px-4 py-3 text-xs">
|
||||
<span class="px-2 py-1 font-semibold leading-tight text-green-700 bg-green-100 rounded-full dark:bg-green-700 dark:text-green-100">
|
||||
'.$status.'
|
||||
</span>
|
||||
</td>
|
||||
<td class="px-4 py-3 text-sm">
|
||||
'.$last_reply_time.'
|
||||
</td>
|
||||
<td class="px-4 py-3">
|
||||
<div class="flex items-center space-x-4 text-sm">
|
||||
<a href="./admin_reply_ticket.fx?user='.$user.'&pass='.$pass.'" class="flex items-center justify-between px-2 py-2 text-sm font-medium leading-5 text-purple-600 rounded-lg dark:text-gray-400 focus:outline-none focus:shadow-outline-gray" aria-label="Edit">
|
||||
<svg class="w-5 h-5" aria-hidden="true" fill="currentColor" viewBox="0 0 20 20">
|
||||
<path d="M13.586 3.586a2 2 0 112.828 2.828l-.793.793-2.828-2.828.793-.793zM11.379 5.793L3 14.172V17h2.828l8.38-8.379-2.83-2.828z"></path>
|
||||
</svg>
|
||||
</a>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
';
|
||||
|
||||
return $ticket;
|
||||
}
|
||||
|
||||
// 主函数
|
||||
function main() {
|
||||
$basePath = './me';
|
||||
$users = readDirectories($basePath);
|
||||
$output = '';
|
||||
|
||||
foreach ($users as $user) {
|
||||
$userPath = "$basePath/$user";
|
||||
$passes = readDirectories($userPath);
|
||||
|
||||
foreach ($passes as $pass) {
|
||||
$ticketData = readTicketJson($user, $pass);
|
||||
if ($ticketData) {
|
||||
$output .= formatTicket($ticketData, $user, $pass); // 拼接每个工单的HTML
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
echo $output; // 输出所有拼接完成的内容
|
||||
}
|
||||
|
||||
// 执行主函数
|
||||
main();
|
||||
|
||||
?>
|
||||
|
||||
|
||||
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
<div class="grid px-4 py-3 text-xs font-semibold tracking-wide text-gray-500 uppercase border-t dark:border-gray-700 bg-gray-50 sm:grid-cols-9 dark:text-gray-400 dark:bg-gray-800">
|
||||
<span class="flex items-center col-span-3">
|
||||
FurryBOX Studio
|
||||
</span>
|
||||
<span class="col-span-2"></span>
|
||||
|
||||
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
Reference in New Issue
Block a user