|
@ -1,23 +1,19 @@ |
|
|
<?php |
|
|
<?php |
|
|
|
|
|
|
|
|
class cfopPic { |
|
|
class cfopPicEntry { |
|
|
private function picList() { |
|
|
private function getCfopMsg() { |
|
|
return array( |
|
|
return array( |
|
|
'text' => 'CFOP魔方公式合集', |
|
|
'text' => 'CFOP魔方公式合集', |
|
|
'reply_markup' => json_encode(array( |
|
|
'reply_markup' => json_encode(array( |
|
|
'inline_keyboard' => array( |
|
|
'inline_keyboard' => array( |
|
|
array( |
|
|
array([ |
|
|
array( |
|
|
|
|
|
'text' => '网页下载', |
|
|
'text' => '网页下载', |
|
|
'url' => 'https://res.dnomd343.top/Share/cfop/' |
|
|
'url' => 'https://res.dnomd343.top/Share/cfop/' |
|
|
) |
|
|
]), |
|
|
), |
|
|
array([ |
|
|
array( |
|
|
|
|
|
array( |
|
|
|
|
|
'text' => '获取全部', |
|
|
'text' => '获取全部', |
|
|
'callback_data' => '/cfop all' |
|
|
'callback_data' => '/cfop all' |
|
|
) |
|
|
]), |
|
|
), |
|
|
|
|
|
array( |
|
|
array( |
|
|
array( |
|
|
array( |
|
|
'text' => 'GAN', |
|
|
'text' => 'GAN', |
|
@ -37,58 +33,59 @@ class cfopPic { |
|
|
); |
|
|
); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
private function sendPic($type) { // 返回图片文件ID |
|
|
private function getPicId($type) { // 返回图片文件ID |
|
|
switch ($type) { |
|
|
switch ($type) { |
|
|
case 'gan': |
|
|
case 'gan': |
|
|
$fileId = 'BQACAgUAAxkBAAIBtGEOLnr4Q6D4Z_80bgfXq5xsZMeWAAKtAwACWy55VOU-SGKqc7aMIAQ'; |
|
|
return 'BQACAgUAAxkBAAIBtGEOLnr4Q6D4Z_80bgfXq5xsZMeWAAKtAwACWy55VOU-SGKqc7aMIAQ'; |
|
|
break; |
|
|
|
|
|
case 'mfg': |
|
|
case 'mfg': |
|
|
$fileId = 'BQACAgUAAxkBAAIB3WEOVHKeYrrGhFo-GffB0W-tQRKlAALQAwACWy55VGny8ArGMkfoIAQ'; |
|
|
return 'BQACAgUAAxkBAAIB3WEOVHKeYrrGhFo-GffB0W-tQRKlAALQAwACWy55VGny8ArGMkfoIAQ'; |
|
|
break; |
|
|
|
|
|
case 'yx': |
|
|
case 'yx': |
|
|
$fileId = 'BQACAgUAAxkBAAIB32EOVISFQbgmir2abj6QkgqaSX1WAALRAwACWy55VMEuU9lCYTYWIAQ'; |
|
|
return 'BQACAgUAAxkBAAIB32EOVISFQbgmir2abj6QkgqaSX1WAALRAwACWy55VMEuU9lCYTYWIAQ'; |
|
|
break; |
|
|
|
|
|
} |
|
|
} |
|
|
return array( |
|
|
|
|
|
'document' => $fileId |
|
|
|
|
|
); |
|
|
|
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
public function getPic($type) { |
|
|
private function getPic($type) { // 获取图片 |
|
|
switch ($type) { |
|
|
switch ($type) { |
|
|
case 'gan': |
|
|
case 'gan': |
|
|
case 'mfg': |
|
|
case 'mfg': |
|
|
case 'yx': |
|
|
case 'yx': |
|
|
return $this->sendPic($type); |
|
|
return array( |
|
|
|
|
|
'document' => $this->getPicId($type) |
|
|
|
|
|
); |
|
|
case '': |
|
|
case '': |
|
|
return $this->picList(); |
|
|
return $this->getCfopMsg(); |
|
|
default: |
|
|
default: |
|
|
return array( |
|
|
return array( |
|
|
'text' => '未知公式' |
|
|
'text' => '未知公式' |
|
|
); |
|
|
); |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
private function sendCfopPic($params) { // 发送图片或信息 |
|
|
|
|
|
if ($params['document']) { |
|
|
|
|
|
tgApi::sendDocument($params); |
|
|
|
|
|
} else { |
|
|
|
|
|
tgApi::sendMessage($params); |
|
|
|
|
|
} |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
function cfopPic($rawParam) { // 发送CFOP图片入口 |
|
|
public function query($rawParam) { // CFOP图片查询入口 |
|
|
global $chatId; |
|
|
$this->sendCfopPic($this->getPic($rawParam)); |
|
|
sendAuto($chatId, (new cfopPic)->getPic($rawParam)); |
|
|
|
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
function cfopPicCallback($rawParam) { // 发送CFOP图片回调入口 |
|
|
public function callback($rawParam) { // CFOP图片回调入口 |
|
|
global $chatId, $messageId; |
|
|
|
|
|
if ($rawParam === 'all') { |
|
|
if ($rawParam === 'all') { |
|
|
sendAuto($chatId, (new cfopPic)->getPic('gan')); |
|
|
global $tgEnv; |
|
|
sendAuto($chatId, (new cfopPic)->getPic('mfg')); |
|
|
tgApi::deleteMessage(array( // 删除源消息 |
|
|
sendAuto($chatId, (new cfopPic)->getPic('yx')); |
|
|
'message_id' => $tgEnv['messageId'] |
|
|
sendPayload(array( // 删除源消息 |
|
|
|
|
|
'method' => 'deleteMessage', |
|
|
|
|
|
'chat_id' => $chatId, |
|
|
|
|
|
'message_id' => $messageId |
|
|
|
|
|
)); |
|
|
)); |
|
|
|
|
|
$this->sendCfopPic($this->getPic('gan')); |
|
|
|
|
|
$this->sendCfopPic($this->getPic('mfg')); |
|
|
|
|
|
$this->sendCfopPic($this->getPic('yx')); |
|
|
return; |
|
|
return; |
|
|
} |
|
|
} |
|
|
sendAuto($chatId, (new cfopPic)->getPic($rawParam)); |
|
|
$this->sendCfopPic($this->getPic($rawParam)); |
|
|
|
|
|
} |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
?> |
|
|
?> |
|
|