11
This commit is contained in:
parent
11b2bdb036
commit
ea9717c009
@ -53,7 +53,48 @@ final class HookController
|
|||||||
}
|
}
|
||||||
|
|
||||||
$sText = $aUpdate["message"]["text"];
|
$sText = $aUpdate["message"]["text"];
|
||||||
|
|
||||||
|
// 先检查step
|
||||||
|
if ($oTgStep->fromIdHit($aData['fromId'])) {
|
||||||
|
|
||||||
|
$sText = ltrim($sText, '/');
|
||||||
|
|
||||||
|
$aTgStepFirst = $oTgStep->find($aData["fromId"]);
|
||||||
|
|
||||||
|
if ($aTgStepFirst["cmd"] == "reply") {
|
||||||
|
|
||||||
|
if ($aTgStepFirst['step'] == 1) {
|
||||||
|
$oHttp = new Http();
|
||||||
|
|
||||||
|
$oHttp->sMethod = "put";
|
||||||
|
$oHttp->sToUrl = $_ENV['baseUrl']."/api/tg/ticket/".$aTgStepFirst['cache']['ticketId'];
|
||||||
|
$oHttp->bIsJson = true;
|
||||||
|
$aData['comment'] = $sText;
|
||||||
|
$aData['admin_name'] = $aUpdate["message"]["from"]["first_name"];
|
||||||
|
$oHttp->aData = $aData;
|
||||||
|
|
||||||
|
$r = @json_decode($oHttp->send(), true);
|
||||||
|
|
||||||
|
// 不论失败成功都清除step
|
||||||
|
$oTgStep->clearByFromId($aUpdate["message"]["from"]["id"]);
|
||||||
|
|
||||||
|
if ($r["ret"] == 1) {
|
||||||
|
$sMessage = "成功";
|
||||||
|
} else {
|
||||||
|
$sMessage = "失败";
|
||||||
|
Http::response(500, json_encode($aData));
|
||||||
|
}
|
||||||
|
|
||||||
|
$this->sendMessage($sMessage);
|
||||||
|
|
||||||
|
Http::response(200, 'ok');
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
// 命令
|
||||||
if ($sText === "/test") {
|
if ($sText === "/test") {
|
||||||
|
|
||||||
$serverTime = date("Y-m-d H:i:s");
|
$serverTime = date("Y-m-d H:i:s");
|
||||||
@ -90,43 +131,6 @@ final class HookController
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($oTgStep->fromIdHit($aData['fromId'])) {
|
|
||||||
|
|
||||||
$aTgStepFirst = $oTgStep->find($aData["fromId"]);
|
|
||||||
|
|
||||||
if ($aTgStepFirst["cmd"] == "reply") {
|
|
||||||
|
|
||||||
if ($aTgStepFirst['step'] == 1) {
|
|
||||||
$oHttp = new Http();
|
|
||||||
|
|
||||||
$oHttp->sMethod = "put";
|
|
||||||
$oHttp->sToUrl = $_ENV['baseUrl']."/api/tg/ticket/".$aTgStepFirst['cache']['ticketId'];
|
|
||||||
$oHttp->bIsJson = true;
|
|
||||||
$aData['comment'] = $sText;
|
|
||||||
$aData['admin_name'] = $aUpdate["message"]["from"]["first_name"];
|
|
||||||
$oHttp->aData = $aData;
|
|
||||||
|
|
||||||
$r = @json_decode($oHttp->send(), true);
|
|
||||||
|
|
||||||
// 不论失败成功都清除step
|
|
||||||
$oTgStep->clearByFromId($aUpdate["message"]["from"]["id"]);
|
|
||||||
|
|
||||||
if ($r["ret"] == 1) {
|
|
||||||
$sMessage = "成功";
|
|
||||||
} else {
|
|
||||||
$sMessage = "失败";
|
|
||||||
Http::response(500, json_encode($aData));
|
|
||||||
}
|
|
||||||
|
|
||||||
$this->sendMessage($sMessage);
|
|
||||||
|
|
||||||
Http::response(200, 'ok');
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
Http::response(200, '无');
|
Http::response(200, '无');
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user