|
|
@@ -7,6 +7,7 @@ use App\Constants\Util;
|
|
|
use App\Exceptions\MessageException;
|
|
|
use App\Models\Message;
|
|
|
use App\Models\User;
|
|
|
+use App\Services\PublicService;
|
|
|
use App\Services\QianBaoWithdrawService;
|
|
|
use App\Services\SanJinRechargeService;
|
|
|
use App\Services\SecretService;
|
|
|
@@ -92,253 +93,19 @@ class TelegramWebHook extends BaseController
|
|
|
WalletService::getUserWallet($chatId);
|
|
|
|
|
|
|
|
|
+ PublicService::init($telegram, $data, $chatId, $firstName, $messageId);
|
|
|
+ WalletService::init($telegram, $data, $chatId, $firstName, $messageId, $callbackId);
|
|
|
+ TopUpService::init($telegram, $data, $chatId, $firstName, $messageId);
|
|
|
QianBaoWithdrawService::init($telegram, $data, $chatId, $firstName, $messageId);
|
|
|
SanJinRechargeService::init($telegram, $data, $chatId, $firstName, $messageId);
|
|
|
SecretService::init($telegram, $data, $chatId, $firstName, $messageId);
|
|
|
UserService::init($telegram, $data, $chatId, $firstName, $messageId);
|
|
|
+ WithdrawService::init($telegram, $data, $chatId, $firstName, $messageId);
|
|
|
+ BetService::init($telegram, $data, $chatId, $firstName, $messageId, $callbackId);
|
|
|
+ BalanceLogService::init($telegram, $data, $chatId, $firstName, $messageId, $callbackId);
|
|
|
+ IssueService::init($telegram, $data, $chatId, $firstName, $messageId);
|
|
|
|
|
|
|
|
|
- // 查看余额弹窗
|
|
|
- if ($data === 'balanceAlert') {
|
|
|
- $alertText = WalletService::getBalance($chatId)['text'];
|
|
|
- WalletService::alertNotice($callbackId, $alertText);
|
|
|
- }
|
|
|
- // 今日流水弹窗
|
|
|
- if ($data === 'todayFlowAlert') {
|
|
|
- $alertText = BalanceLogService::getTodayFlowing($chatId)['text'];
|
|
|
- BalanceLogService::alertNotice($callbackId, $alertText);
|
|
|
- }
|
|
|
- // 近期注单弹窗
|
|
|
- if ($data === 'betsAlert') {
|
|
|
- Cache::put('message_id_bet_record_' . $chatId, 0, 600);
|
|
|
- $alertText = BetService::recentlyRecord($chatId);
|
|
|
- BetService::alertNotice($callbackId, $alertText);
|
|
|
- }
|
|
|
-
|
|
|
- //选择充值地址
|
|
|
- if ($data === "topUp@@TRC20" || $data === "topUp@@ERC20") {
|
|
|
- $type = preg_replace('/^topUp@@/', '', $data);
|
|
|
- $topService = new TopUpService();
|
|
|
- $res = $topService->scan($chatId, $messageId, $type);
|
|
|
- $telegram->deleteMessage([
|
|
|
- 'chat_id' => $chatId,
|
|
|
- 'message_id' => $messageId,
|
|
|
- ]);
|
|
|
- $telegram->sendPhoto($res);
|
|
|
- }
|
|
|
-
|
|
|
- //点击充值按钮
|
|
|
- if ($data === 'topup@@topup') {
|
|
|
-
|
|
|
- $res = TopUpService::chooseAddress($chatId, $messageId);
|
|
|
- $telegram->editMessageText($res);
|
|
|
- }
|
|
|
-
|
|
|
- //点击充值的账单按钮
|
|
|
- if ($data === 'topup@@bill') {
|
|
|
- $res = (new TopUpService())->bill($chatId, $firstName, $messageId);
|
|
|
- $telegram->editMessageText($res);
|
|
|
- }
|
|
|
-
|
|
|
- //点击我已付款按钮
|
|
|
- //手动充值(后台审核后到账)
|
|
|
- if ($data === 'topUp@@pay2') {
|
|
|
- $telegram->deleteMessage([
|
|
|
- 'chat_id' => $chatId,
|
|
|
- 'message_id' => $messageId
|
|
|
- ]);
|
|
|
- $res = TopUpService::pay2($chatId);
|
|
|
- $telegram->sendMessage($res);
|
|
|
- } //
|
|
|
- //自动充值
|
|
|
- elseif ($data === 'topUp@@pay') {
|
|
|
- $telegram->deleteMessage([
|
|
|
- 'chat_id' => $chatId,
|
|
|
- 'message_id' => $messageId
|
|
|
- ]);
|
|
|
- $topService = new TopUpService();
|
|
|
- $res = $topService->done($chatId);
|
|
|
- $telegram->sendMessage($res);
|
|
|
- }
|
|
|
-
|
|
|
- //充值首页
|
|
|
- if ($data === "topUp@@home" || $data === "topUp@@home1") {
|
|
|
- $returnMsg = WalletService::getBalance($chatId);
|
|
|
- if ($returnMsg) {
|
|
|
- if ($data === "topUp@@home1") {
|
|
|
- $telegram->deleteMessage([
|
|
|
- 'chat_id' => $chatId,
|
|
|
- 'message_id' => $messageId
|
|
|
- ]);
|
|
|
- $this->telegram->sendMessage($returnMsg);
|
|
|
- } else {
|
|
|
- $returnMsg['message_id'] = $messageId;
|
|
|
- $telegram->editMessageText($returnMsg);
|
|
|
- }
|
|
|
-
|
|
|
- }
|
|
|
-
|
|
|
- // $res = (new TopUpService())->index($chatId, $firstName, $messageId);
|
|
|
- // if ($data === "topUp@@home1") {
|
|
|
- // $telegram->deleteMessage([
|
|
|
- // 'chat_id' => $chatId,
|
|
|
- // 'message_id' => $messageId
|
|
|
- // ]);
|
|
|
- // $telegram->sendMessage($res);
|
|
|
- // } else {
|
|
|
- // $telegram->editMessageText($res);
|
|
|
- // }
|
|
|
- }
|
|
|
-
|
|
|
-
|
|
|
- //点击提现按钮
|
|
|
- if ($data === "withdraw@@apply") {
|
|
|
- $res = (new WithdrawService())->apply($chatId, $messageId);
|
|
|
- $telegram->editMessageText($res);
|
|
|
- }
|
|
|
-
|
|
|
-
|
|
|
- //地址管理
|
|
|
- if ($data === 'withdraw@@address') {
|
|
|
- $res = WithdrawService::getAddress($chatId, $messageId);
|
|
|
- $telegram->editMessageText($res);
|
|
|
- }
|
|
|
-
|
|
|
-
|
|
|
- //关闭本条消息
|
|
|
- if ($data === 'message@@close') {
|
|
|
- $telegram->deleteMessage([
|
|
|
- 'chat_id' => $chatId,
|
|
|
- 'message_id' => $messageId
|
|
|
- ]);
|
|
|
- }
|
|
|
-
|
|
|
-
|
|
|
- if ($data === 'withdrawAddress@@add') {
|
|
|
- $res = WithdrawService::addAddress($chatId, $messageId);
|
|
|
- $telegram->editMessageText($res);
|
|
|
- }
|
|
|
-
|
|
|
- //提现管理
|
|
|
- if ($data === "withdraw@@home") {
|
|
|
- // $res = WithdrawService::index($chatId, $firstName, $messageId);
|
|
|
- // $telegram->editMessageText($res);
|
|
|
- $telegram->deleteMessage([
|
|
|
- 'chat_id' => $chatId,
|
|
|
- 'message_id' => $messageId
|
|
|
- ]);
|
|
|
- $returnMsg = WalletService::getBalance($chatId);
|
|
|
- if ($returnMsg) {
|
|
|
- $this->telegram->sendMessage($returnMsg);
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- //点击提现的账单按钮
|
|
|
- if ($data === "withdraw@@bill") {
|
|
|
- $res = (new WithdrawService())->bill($chatId, $firstName, $messageId);
|
|
|
- $telegram->editMessageText($res);
|
|
|
-// $telegram->sendMessage($res);
|
|
|
-// $text = "📅 请输入查询日期\n";
|
|
|
-// $date = date('Y-m-d');
|
|
|
-// $text .= "例如您要查询的日期 {$date}\n";
|
|
|
-// $text .= "那么请发送:【提现账单】{$date}\n";
|
|
|
-// $telegram->sendMessage([
|
|
|
-// 'chat_id' => $chatId,
|
|
|
-// 'text' => $text
|
|
|
-// ]);
|
|
|
- }
|
|
|
-
|
|
|
- if ($data === 'withdrawAddress@@done') {
|
|
|
- $res = WithdrawService::done($chatId, $messageId, $firstName);
|
|
|
- $telegram->editMessageText($res);
|
|
|
- }
|
|
|
-
|
|
|
- // 今日汇率
|
|
|
- if ($data === 'todayExchangeRate@@rate') {
|
|
|
- BetService::todayExchangeRate($chatId);
|
|
|
- // $telegram->sendMessage($res);
|
|
|
- }
|
|
|
-
|
|
|
- //查看开奖历史图片
|
|
|
- $pattern = "/^showLotteryHistory@@\d+$/";
|
|
|
- if (preg_match($pattern, $data)) {
|
|
|
- $id = preg_replace('/^showLotteryHistory@@/', '', $data);
|
|
|
- IssueService::sendLotteryImage($chatId, $id);
|
|
|
- }
|
|
|
-
|
|
|
- //选择投注记录
|
|
|
- $pattern = "/^betRecordType@@\d+$/";
|
|
|
- if (preg_match($pattern, $data)) {
|
|
|
- $type = preg_replace('/^betRecordType@@/', '', $data);
|
|
|
- Cache::put('message_id_bet_record_' . $chatId, intval($type), 600);
|
|
|
- $telegram->deleteMessage([
|
|
|
- 'chat_id' => $chatId,
|
|
|
- 'message_id' => $messageId,
|
|
|
- ]);
|
|
|
- $returnMsg = BetService::record($chatId);
|
|
|
- $telegram->sendMessage($returnMsg);
|
|
|
- }
|
|
|
-
|
|
|
-
|
|
|
- //选择提现地址
|
|
|
- $pattern = "/^withdrawAddress@@choose\d+$/";
|
|
|
- if (preg_match($pattern, $data)) {
|
|
|
- $id = preg_replace('/^withdrawAddress@@choose/', '', $data);
|
|
|
- $res = WithdrawService::chooseAddress($chatId, $firstName, $messageId, $id);
|
|
|
- $telegram->editMessageText($res);
|
|
|
- }
|
|
|
-
|
|
|
- //删除地址
|
|
|
- $pattern = "/^withdrawAddress@@del\d+$/";
|
|
|
- if (preg_match($pattern, $data)) {
|
|
|
- $id = preg_replace('/^withdrawAddress@@del/', '', $data);
|
|
|
- $res = WithdrawService::delAddress($chatId, $id, $messageId);
|
|
|
- $telegram->editMessageText($res);
|
|
|
- }
|
|
|
- //地址详情
|
|
|
- $pattern = "/^withdrawAddress@@detail\d+$/";
|
|
|
- if (preg_match($pattern, $data)) {
|
|
|
- $id = preg_replace('/^withdrawAddress@@detail/', '', $data);
|
|
|
- $res = WithdrawService::addressDetails($chatId, $messageId, $id);
|
|
|
- $telegram->editMessageText($res);
|
|
|
- }
|
|
|
-
|
|
|
- //充值账单,下一页
|
|
|
- $pattern = "/^topUpBillNextPage@@\d+$/";
|
|
|
- if (preg_match($pattern, $data)) {
|
|
|
- $page = preg_replace('/^topUpBillNextPage@@/', '', $data);
|
|
|
- $page = intval($page);
|
|
|
- $res = (new TopUpService())->bill($chatId, $firstName, $messageId, $page);
|
|
|
- $telegram->editMessageText($res);
|
|
|
- }
|
|
|
-
|
|
|
- //流水列表,下一页
|
|
|
- $pattern = "/^FlowingHistoryPage@@\d+$/";
|
|
|
- if (preg_match($pattern, $data)) {
|
|
|
- $page = preg_replace('/^FlowingHistoryPage@@/', '', $data);
|
|
|
- $page = intval($page);
|
|
|
- $returnMsg = BalanceLogService::getFlowingHistory($chatId, $messageId, $page);
|
|
|
- $telegram->editMessageText($returnMsg);
|
|
|
- }
|
|
|
-
|
|
|
-
|
|
|
- //提现账单,下一页
|
|
|
- $pattern = "/^withdrawBillNextPage@@\d+$/";
|
|
|
- if (preg_match($pattern, $data)) {
|
|
|
- $page = preg_replace('/^withdrawBillNextPage@@/', '', $data);
|
|
|
- $page = intval($page);
|
|
|
- $res = (new WithdrawService())->bill($chatId, $firstName, $messageId, $page);
|
|
|
- $telegram->editMessageText($res);
|
|
|
- }
|
|
|
-
|
|
|
- //近期注单,下一页
|
|
|
- $pattern = "/^betRecordNextPage@@\d+$/";
|
|
|
- if (preg_match($pattern, $data)) {
|
|
|
- $page = preg_replace('/^betRecordNextPage@@/', '', $data);
|
|
|
- $page = intval($page);
|
|
|
- $res = BetService::record($chatId, $messageId, $page);
|
|
|
- $telegram->editMessageText($res);
|
|
|
- }
|
|
|
DB::commit();
|
|
|
} //
|
|
|
catch (MessageException $e) {
|