seven 3 روز پیش
والد
کامیت
964edc0d84
2فایلهای تغییر یافته به همراه43 افزوده شده و 0 حذف شده
  1. 42 0
      app/Services/BalanceLogService.php
  2. 1 0
      sql/sql_prod.sql

+ 42 - 0
app/Services/BalanceLogService.php

@@ -111,4 +111,46 @@ class BalanceLogService extends BaseService
         return self::model()::create($data);
     }
 
+    /**
+     * @description: 获取今日流水
+     * @param int $memberId
+     * @param string|null $date
+     * @return {*}
+     */
+    public static function getTodayFlowing($memberId ,$date = null)
+    {
+        if (!$date) {
+            $date = date('Y-m-d');
+        }
+        $startTime = strtotime($date . ' 00:00:00');
+        $endTime = strtotime($date . ' 23:59:59');
+        
+        
+
+        $flow = self::model()::where('member_id', $memberId)
+            ->whereBetween('created_at', [$startTime, $endTime])
+            ->where('change_type', '投注')
+            ->sum('amount');
+        $refund = self::model()::where('member_id', $memberId)
+            ->whereBetween('created_at', [$startTime, $endTime])
+            ->where('change_type', '返水')
+            ->sum('amount');
+
+        $profit = self::model()::where('member_id', $memberId)
+            ->whereBetween('created_at', [$startTime, $endTime])
+            ->where('change_type', '开奖') //嬴正数 输负数
+            ->sum('amount');
+
+        $walletInfo = WalletService::model()::where('member_id', $memberId)->first();
+        $text = '';
+        $text .= "当日流水: " . $flow . "\n";
+        $text .= "当日返水: " . $refund . "\n";
+        $text .= "当日盈利: " . ($profit + $refund - $flow)  . "\n";
+        $text .= "余额: " . $$walletInfo['available_balance'] . "\n";
+        return [
+            'chat_id' => $memberId,
+            'text' => $text
+        ];
+    }
+
 }

+ 1 - 0
sql/sql_prod.sql

@@ -86,6 +86,7 @@ INSERT INTO `bot_config` VALUES (6, 'receiving_type', '2', '2025-07-07 17:48:06'
 INSERT INTO `bot_config` VALUES (7, 'channel_message', '{\"chatId\":\"oooluckychannel\",\"image\":\"https://baidu.com/logo.jpg\",\"text\":\"这是文本内容\",\"button\":[[{\"text\":\"开云注册送138\",\"url\":\"https://baidu.com\"}],[{\"text\":\"世界杯招代理\",\"url\":\"https://baidu.com\"},{\"text\":\"米兰体育官网\",\"url\":\"https://baidu.com\"}]]}', '2025-07-07 17:48:06', '2025-07-07 17:48:06', '频道消息JSON');
 
 INSERT INTO `bot_config` VALUES (8, 'betting_group', '+8jhXv9Eb-oRmZDY1', '2025-07-07 17:48:06', '2025-07-07 17:48:06', '投注群');
+INSERT INTO `bot_config` VALUES (9, 'rebate', '0', '2025-07-07 17:48:06', '2025-07-07 17:48:06', '返佣比例');
 
 
 -- ----------------------------