|
@@ -6,8 +6,10 @@ namespace App\Services;
|
|
|
|
|
|
|
|
use App\Constants\StepStatus;
|
|
use App\Constants\StepStatus;
|
|
|
use App\Models\Address;
|
|
use App\Models\Address;
|
|
|
|
|
+use App\Models\BalanceLog;
|
|
|
use App\Models\Bank;
|
|
use App\Models\Bank;
|
|
|
use App\Models\Config;
|
|
use App\Models\Config;
|
|
|
|
|
+use App\Models\PaymentOrder;
|
|
|
use App\Models\Wallet;
|
|
use App\Models\Wallet;
|
|
|
use Illuminate\Support\Facades\Cache;
|
|
use Illuminate\Support\Facades\Cache;
|
|
|
use Telegram\Bot\Api;
|
|
use Telegram\Bot\Api;
|
|
@@ -30,6 +32,18 @@ class QianBaoWithdrawService
|
|
|
$telegram->editMessageText($res);
|
|
$telegram->editMessageText($res);
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+
|
|
|
|
|
+ //钱宝账单
|
|
|
|
|
+ $pattern = "/^withdraw@@bank_bill_\d+$/";
|
|
|
|
|
+ if (preg_match($pattern, $data)) {
|
|
|
|
|
+ $page = preg_replace('/^withdraw@@bank_bill_/', '', $data);
|
|
|
|
|
+ if (empty($page) || $page < 1) $page = 1;
|
|
|
|
|
+ $page = intval($page);
|
|
|
|
|
+ $res = QianBaoWithdrawService::bill($chatId, $firstName, $messageId, $page);
|
|
|
|
|
+ $telegram->editMessageText($res);
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
//选择银行卡号
|
|
//选择银行卡号
|
|
|
$pattern = "/^withdrawAddress@@choose_qb_\d+$/";
|
|
$pattern = "/^withdrawAddress@@choose_qb_\d+$/";
|
|
|
if (preg_match($pattern, $data)) {
|
|
if (preg_match($pattern, $data)) {
|
|
@@ -82,6 +96,65 @@ class QianBaoWithdrawService
|
|
|
|
|
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+ static function bill($chatId, $firstName, $messageId, $page = 1, $limit = 5)
|
|
|
|
|
+ {
|
|
|
|
|
+ $list = PaymentOrder::where('member_id', $chatId)
|
|
|
|
|
+ ->where('type', 2)
|
|
|
|
|
+ ->orderByDesc('created_at')
|
|
|
|
|
+ ->forPage($page, $limit)
|
|
|
|
|
+ ->get();
|
|
|
|
|
+
|
|
|
|
|
+ $count = PaymentOrder::where('member_id', $chatId)
|
|
|
|
|
+ ->where('type', 2)
|
|
|
|
|
+ ->count();
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
|
|
+ $text = "👤 {$firstName}({$chatId}) 钱宝提现记录\n\n";
|
|
|
|
|
+ foreach ($list as $item) {
|
|
|
|
|
+ $amount = floatval($item->amount);
|
|
|
|
|
+ $amount = $amount < 0 ? ("➖ " . ($amount * -1)) : "➕ $amount";
|
|
|
|
|
+ $text .= "-------------------------------------\n";
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
|
|
+ $text .= "{$amount} \n";
|
|
|
|
|
+ $text .= "订单号:{$item->order_no}\n";
|
|
|
|
|
+
|
|
|
|
|
+ $text .= "银行:{$item->bank_name}\n";
|
|
|
|
|
+ $text .= "姓名:{$item->account}\n";
|
|
|
|
|
+ $text .= "卡号:{$item->card_no}\n";
|
|
|
|
|
+ $status = ['待处理', '处理中', '成功', '失败'];
|
|
|
|
|
+ $text .= "状态:{$status[$item->status]}\n";
|
|
|
|
|
+ if ($item->remark) {
|
|
|
|
|
+ $text .= "说明:{$item->remark}\n";
|
|
|
|
|
+ }
|
|
|
|
|
+ $text .= "日期:{$item->created_at}\n";
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ if ($page > 1) {
|
|
|
|
|
+ $keyboard[] = [
|
|
|
|
|
+ ['text' => "👆上一页", 'callback_data' => "withdraw@@bank_bill_" . ($page - 1)]
|
|
|
|
|
+ ];
|
|
|
|
|
+ }
|
|
|
|
|
+ $allPage = ceil($count / $limit);
|
|
|
|
|
+ if ($allPage > $page) {
|
|
|
|
|
+ if ($page > 1) {
|
|
|
|
|
+ $keyboard[count($keyboard) - 1][] = ['text' => "👇下一页", 'callback_data' => "withdraw@@bank_bill_" . ($page + 1)];
|
|
|
|
|
+ } else {
|
|
|
|
|
+ $keyboard[] = [
|
|
|
|
|
+ ['text' => "👇下一页", 'callback_data' => "withdraw@@bank_bill_" . ($page + 1)]
|
|
|
|
|
+ ];
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ $keyboard[] = [
|
|
|
|
|
+ ['text' => "返回", 'callback_data' => "topUp@@home"]
|
|
|
|
|
+ ];
|
|
|
|
|
+ return [
|
|
|
|
|
+ 'chat_id' => $chatId,
|
|
|
|
|
+ 'text' => $text,
|
|
|
|
|
+ 'message_id' => $messageId,
|
|
|
|
|
+ 'reply_markup' => json_encode(['inline_keyboard' => $keyboard])
|
|
|
|
|
+ ];
|
|
|
|
|
+ }
|
|
|
|
|
|
|
|
//1.钱宝提现
|
|
//1.钱宝提现
|
|
|
static function qbApply($chatId, $messageId)
|
|
static function qbApply($chatId, $messageId)
|
|
@@ -185,7 +258,6 @@ class QianBaoWithdrawService
|
|
|
];
|
|
];
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
-
|
|
|
|
|
//银行卡管理
|
|
//银行卡管理
|
|
|
static function banks($chatId, $messageId)
|
|
static function banks($chatId, $messageId)
|
|
|
{
|
|
{
|