no message
This commit is contained in:
85
user/admin_api_reply_ticket.php
Normal file
85
user/admin_api_reply_ticket.php
Normal file
@@ -0,0 +1,85 @@
|
||||
<?php
|
||||
|
||||
include './admin_sc.php';
|
||||
include './email.php';
|
||||
|
||||
|
||||
$a_user = $_GET['user'];
|
||||
$a_pass = $_GET['pass'];
|
||||
|
||||
|
||||
$ticket = @file_get_contents("./me/".$a_user."/".$a_pass."/ticket.json");
|
||||
|
||||
if (!$ticket) {
|
||||
die("error");
|
||||
}
|
||||
|
||||
// 获取当前时间并格式化
|
||||
$time = date('Y-m-d H:i:s');
|
||||
|
||||
$data = json_decode($ticket, true);
|
||||
|
||||
$msg = $_POST['msg'];
|
||||
$name = $_POST['name'];
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
$lt = $data['ticket']['last_reply_time'];
|
||||
|
||||
|
||||
// 指定的时间字符串
|
||||
$specifiedTimeStr = $lt;
|
||||
|
||||
// 将指定时间字符串转换为 DateTime 对象
|
||||
$specifiedTime = new DateTime($specifiedTimeStr);
|
||||
|
||||
// 获取当前时间
|
||||
$currentTime = new DateTime();
|
||||
|
||||
// 计算时间差
|
||||
$interval = $currentTime->diff($specifiedTime);
|
||||
|
||||
// 判断差值是否大于 1 分钟
|
||||
if ($interval->i >= 1 || $interval->d > 0 || $interval->m > 0 || $interval->y > 0) {
|
||||
echo "202:";
|
||||
|
||||
|
||||
sendMail($a_user . '@qq.com', '#Fuxsto Admin 工单提醒!', "<h2>尊敬的用户</h2><br>你创建的工单有新回复!");
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
$data['ticket']['last_reply_time'] = $time;
|
||||
$data['ticket']['status'] = "客服回复";
|
||||
|
||||
// 添加新的对话到尾部
|
||||
$new_conversation_tail = [
|
||||
"responder" => $name,
|
||||
"role" => "admin",
|
||||
"reply_time" => $time,
|
||||
"reply_content" => $msg
|
||||
];
|
||||
|
||||
array_push($data['ticket']['conversation'], $new_conversation_tail);
|
||||
|
||||
|
||||
|
||||
// 编码为 JSON 字符串
|
||||
$main = json_encode($data, JSON_UNESCAPED_UNICODE | JSON_PRETTY_PRINT);
|
||||
|
||||
|
||||
// 定义要检查的文件路径
|
||||
$filename = './me/' . $a_user . '/' . $a_pass . '/ticket.json'; // 目录路径
|
||||
@file_put_contents($filename, $main);
|
||||
|
||||
echo "回复成功!";
|
||||
|
||||
?>
|
||||
Reference in New Issue
Block a user