seven 2 месяцев назад
Родитель
Сommit
df9925820e
2 измененных файлов с 25 добавлено и 3 удалено
  1. 10 1
      app/Http/Controllers/api/TelegramWebHook.php
  2. 15 2
      app/Services/BalanceLogService.php

+ 10 - 1
app/Http/Controllers/api/TelegramWebHook.php

@@ -303,6 +303,15 @@ class TelegramWebHook extends Controller
                     $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($res);
+                }
+
 
                 //提现账单,下一页
                 $pattern = "/^withdrawBillNextPage@@\d+$/";
@@ -979,7 +988,7 @@ class TelegramWebHook extends Controller
                     $res = $topService->done($chatId);
                     $telegram->sendMessage($res);
                 }
-
+               
                 //充值账单,下一页
                 $pattern = "/^topUpBillNextPage@@\d+$/";
                 if (preg_match($pattern, $data)) {

+ 15 - 2
app/Services/BalanceLogService.php

@@ -157,7 +157,7 @@ class BalanceLogService extends BaseService
         ];
     }
 
-    public static function getFlowingHistory($memberId ,$page = 1 ,$limit = 5)
+    public static function getFlowingHistory($memberId ,$messageId = null, $page = 1 ,$limit = 5)
     {
        $dateTime = date('Y-m-d 00:00:00');
         $list = [];
@@ -207,10 +207,23 @@ class BalanceLogService extends BaseService
             $text .= "盈利: {$item['profit']} \n";
         }
 
+        $keyboard = [];
+
+        if ($page > 1) {
+            $keyboard[] = [
+                ['text' => "👆上一页", 'callback_data' => "FlowingHistoryPage@@" . ($page - 1)]
+            ];
+        }
+
+        $keyboard[] = [
+                    ['text' => "👇下一页", 'callback_data' => "FlowingHistoryPage@@" . ($page + 1)]
+                ];
+
         $msg = [];
         $msg['chat_id'] = $memberId;
         $msg['text'] = $text;
-
+        $msg['message_id'] = $messageId;
+        $msg['reply_markup'] = json_encode(['inline_keyboard' => $keyboard]);
         return $msg;
     }