From ad8bebc46d1ac65f44aaf4bb25e6e0e084610f6c Mon Sep 17 00:00:00 2001 From: root Date: Sat, 24 May 2025 10:31:21 +0000 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E8=87=AA=E5=AE=9A=E4=B9=89?= =?UTF-8?q?=E5=85=85=E5=80=BC=E9=87=91=E9=A2=9D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/service/plugins/Premium.php | 127 ++++++++++++++++++++++++++++++-- 1 file changed, 121 insertions(+), 6 deletions(-) diff --git a/app/service/plugins/Premium.php b/app/service/plugins/Premium.php index 88b8bfe..e9ae946 100755 --- a/app/service/plugins/Premium.php +++ b/app/service/plugins/Premium.php @@ -704,7 +704,9 @@ TG ID: {$from['id']} public function reply_message($text, $message_id, $reply_to_text, $reply_to_message_id, $reply_to_date, $from, $chat, $reply_to_is_bot) { - //var_dump($text,$message_id,$reply_to_text,$reply_to_message_id,$reply_to_date,$from,$chat,$reply_to_is_bot); + var_dump($text,$message_id,$reply_to_text,$reply_to_message_id,$reply_to_date,$from,$chat,$reply_to_is_bot); + + $userinfo = $this->handlename($from); if ($chat['type'] == "private") { if ($reply_to_text == "请回复本条并输入您新的地址!") { //判断地址是否合法 @@ -720,6 +722,122 @@ TG ID: {$from['id']} $this->telegram->sendMessage($chat['id'], "您的地址不合法 请检查地址是否正确", $message_id); } } + if ($reply_to_text == "请回复本条并输入您要充值的金额、例如:100 (输入纯数字即可、单位默认USDT)") { + //建立充值 + if (is_numeric($text)) { + $paymoney = $this->paymoney($text); + $order_no = uniqid(); + $jzsh = time() + 60 * 15; + + $lstime = time() - 600; + $lsdingdan = Db::name('order')->where(['userid' => $from['id'], "botid" => $this->bots['botid'], 'start' => 0])->where('create_time', '>=', $lstime)->count(); + + if ($lsdingdan >= 5) { + //不在支持新订单创建 + // $this->telegram->answerCallback($callback_id, "如果您无法支付!请联系客服处理订单哟!", true); + $url = "https://img.picui.cn/free/2024/07/10/668e1ed44a8cd.jpg"; + $button = json_encode( + array( + 'inline_keyboard' => array( + array( + array( + 'text' => '关闭', + 'callback_data' => 'close' + ), + array( + 'text' => '联系客服', + 'callback_data' => 'CUSTOMER_SERVICE' + ) + + ) + + + ) + ) + ); + + $msgg = "订单建立失败了!" . "\r\n" . "如果您无法支付!请联系客服哟!" . "\r\n" . "感谢您的支持"; + $media = array( + 'type' => 'photo', + 'media' => $url, + 'caption' => $msgg, + "parse_mode" => 'HTML', + ); + + $this->telegram->editMessageMedia($chat['id'], $message_id, NULL, json_encode($media), $button); + + // $this->telegram->editMessageCaption($chat['id'], $message_id, null, "订单建立失败了!"//."\r\n"."如果您无法支付!请联系客服哟!"."\r\n"."感谢您的支持"); + // $this->telegram->editMessageReplyMarkup($chat['id'], $message_id, null, $button); + + // $this->telegram->editMessage($chat['id'], $message_id, "订单建立失败了!"."\r\n"."如果您无法支付!请联系客服哟!"."\r\n"."感谢您的支持", $button, 'HTML', true); + + + } else { + + Db::name('order')->insert(['userid' => $from['id'], 'money' => $text, 'paymoney' => $paymoney, 'create_time' => time(), "trxadd" => $this->bots['trxadd'], "botid" => $this->bots['botid'], "nichen" => $userinfo['tgnames'], "name" => "余额充值" . $userinfo['tgnames'], 'start' => 0, 'order_no' => $order_no, 'end_time' => $jzsh, 'smessage_id' => $message_id, "mode" => "Daikaihuiyuan", "moth" => "yuepay", 'lirun' => 0]); + + if ($lsdingdan > 1) { + //不在监听 减少资源浪费 + } else { + $job = 'app\bapi\syservice\Getzhandam'; + $queueName = 'zhandam'; + $data = array("end_time" => time() + 60 * 20, "trxadd" => $this->bots['trxadd'], 'order_no' => $order_no); + // Queue::push($job, $data, $queueName); + } + $odder = Db::name('order')->where("order_no", $order_no)->find(); + + + + + $xzssss = date("m-d H:i:s"); + $msg = "订单号:{$odder['order_no']} +商品名称:{$odder['name']} +订单金额:{$odder['paymoney']} USDT +当前时间:{$xzssss} + +请选择支付方式:"; + + $button = json_encode( + array( + 'inline_keyboard' => array( + array( + array( + 'text' => 'USDT支付', + 'callback_data' => 'payodderkkkssskkk payue ' . $order_no + ) + ), + array( + array( + 'text' => '刷新', + 'callback_data' => 'payodderkkkssskkk re ' . $order_no + ), + array( + 'text' => '取消订单', + 'callback_data' => 'checkodder ' . $order_no + ) + + ), + array( + array( + 'text' => '联系客服', + 'callback_data' => 'CUSTOMER_SERVICE' + ) + + ) + + + ) + ) + ); + $this->telegram->sendMessage($chat['id'], $msg, "", $button, 'HTML', true); + } + } else { + + $this->telegram->sendMessage($chat['id'], "机器人不能理解这个金额! 请输入数字哟! 祝你每天开心"); + } + } + + } } @@ -776,7 +894,7 @@ TG ID: {$from['id']} public function reply_to_message($message, $message_id, $date, $textmessage, $reply_to_message, $xdate, $from, $chat, $is_bot, $is_topic_message = null) { if ($chat['type'] == "private") { - $userinfo = $this->Custom->handlename($from); + $userinfo = $this->handlename($from); if ($textmessage == "请回复本条并输入您要充值的金额、例如:100 (输入纯数字即可、单位默认USDT)") { //建立充值 @@ -2156,10 +2274,7 @@ TG ID: {$from['id']} ), array( - array( - 'text' => '更换支付方式', - 'callback_data' => 'changepay ' . $order_no - ), + array( 'text' => '取消订单', 'callback_data' => 'checkodder ' . $order_no