|
|
@@ -5,6 +5,7 @@ namespace App\Services;
|
|
|
|
|
|
|
|
|
use App\Constants\StepStatus;
|
|
|
+use App\Models\Address;
|
|
|
use App\Models\Bank;
|
|
|
use App\Models\Config;
|
|
|
use App\Models\Wallet;
|
|
|
@@ -48,11 +49,29 @@ class QianBaoWithdrawService
|
|
|
$telegram->editMessageText($res);
|
|
|
}
|
|
|
|
|
|
+
|
|
|
+ //银行卡详情
|
|
|
+ $pattern = "/^withdrawAddress@@bank_detail\d+$/";
|
|
|
+ if (preg_match($pattern, $data)) {
|
|
|
+ $id = preg_replace('/^withdrawAddress@@bank_detail/', '', $data);
|
|
|
+ $res = static::bankDetails($chatId, $messageId, $id);
|
|
|
+ $telegram->editMessageText($res);
|
|
|
+ }
|
|
|
+
|
|
|
+ $pattern = "/^withdraw@@bank_del_\d+$/";
|
|
|
+ if (preg_match($pattern, $data)) {
|
|
|
+ $id = preg_replace('/^withdraw@@bank_del_/', '', $data);
|
|
|
+ $res = static::bankDelete($chatId, $messageId, $id);
|
|
|
+ $telegram->editMessageText($res);
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
//添加银行卡
|
|
|
if ($data === "withdrawAddress@@bank_add") {
|
|
|
$res = QianBaoWithdrawService::addBank($chatId, $messageId);
|
|
|
$telegram->editMessageText($res);
|
|
|
}
|
|
|
+
|
|
|
$pattern = "/^withdrawAddress@@bank_choose_channel_.*$/";
|
|
|
if (preg_match($pattern, $data)) {
|
|
|
$channel = preg_replace('/^withdrawAddress@@bank_choose_channel_/', '', $data);
|
|
|
@@ -192,6 +211,53 @@ class QianBaoWithdrawService
|
|
|
];
|
|
|
}
|
|
|
|
|
|
+ static function bankDelete($chatId, $messageId, $id)
|
|
|
+ {
|
|
|
+ Bank::where('id', $id)
|
|
|
+ ->where('member_id', $chatId)->delete();
|
|
|
+
|
|
|
+ return static::banks($chatId, $messageId);
|
|
|
+ }
|
|
|
+
|
|
|
+ static function bankDetails($chatId, $messageId, $id)
|
|
|
+ {
|
|
|
+
|
|
|
+ $text = "*银行卡管理*\n\n";
|
|
|
+ $bank = Bank::where('id', $id)
|
|
|
+ ->where('member_id', $chatId)->first();
|
|
|
+
|
|
|
+ switch ($bank->channel) {
|
|
|
+ case "DF001":
|
|
|
+ $text .= "姓名:{$bank->account}\n";
|
|
|
+ $text .= "银行:{$bank->bank_name}\n";
|
|
|
+ $text .= "卡号:{$bank->card_no}\n";
|
|
|
+ break;
|
|
|
+ case "DF002":
|
|
|
+ $text .= "姓名:{$bank->account}\n";
|
|
|
+ $text .= "支付宝账号:{$bank->card_no}\n";
|
|
|
+ break;
|
|
|
+ default:
|
|
|
+ $text .= "姓名:{$bank->account}\n";
|
|
|
+ $text .= "银行:{$bank->bank_name}\n";
|
|
|
+ $text .= "卡号:{$bank->card_no}\n";
|
|
|
+ break;
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ $keyboard = [
|
|
|
+ [['text' => '❌删除该地址', 'callback_data' => "withdraw@@bank_del_{$id}"]],
|
|
|
+ [['text' => '↩️返回列表', 'callback_data' => 'withdraw@@banks']]
|
|
|
+ ];
|
|
|
+ return [
|
|
|
+ 'chat_id' => $chatId,
|
|
|
+ 'parse_mode' => 'MarkdownV2',
|
|
|
+ 'text' => $text,
|
|
|
+ 'reply_markup' => json_encode(['inline_keyboard' => $keyboard]),
|
|
|
+ 'message_id' => $messageId
|
|
|
+ ];
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
static function addBank($chatId, $messageId)
|
|
|
{
|
|
|
$text = "请选择 提现通道\n";
|