aiden 2 месяцев назад
Родитель
Сommit
35e10c763d
2 измененных файлов с 7 добавлено и 3 удалено
  1. 5 1
      app/controller/MerchantStatis.php
  2. 2 2
      app/model/MerchantStatisModel.php

+ 5 - 1
app/controller/MerchantStatis.php

@@ -86,7 +86,11 @@ class MerchantStatis extends BaseController
             }
             
             // 格式化数据
-            $result['rtp'] = (float)bcmul(bcdiv($result['total_winning_score'], $result['bet_amount'], 4), '100', 2);
+            if (!empty($result['bet_amount'])) {
+                $result['rtp'] = (float)bcmul(bcdiv((string)$result['total_winning_score'], (string)$result['bet_amount'], 4), '100', 2);
+            } else {
+                $result['rtp'] = 0;
+            }
             $result['date_stage'] = implode(' ~ ', $filters);
             $result['game_profit'] = (float)$result['game_profit'];
             $result['bet_amount'] = (float)$result['bet_amount'];

+ 2 - 2
app/model/MerchantStatisModel.php

@@ -93,12 +93,12 @@ class MerchantStatisModel extends Model
         $getWhere = function(string $timeField) use ($where, $filters) {
             // 时间筛选
             if (!empty($filters['start_time'])) {
-                $startTime = strtotime($filters['start_time'] . " 00:00:00");
+                $startTime = strtotime($filters['start_time']);
                 $where[] = [$timeField, '>=', $startTime];
             }
             
             if (!empty($filters['end_time'])) {
-                $endTime = strtotime($filters['end_time'] . " 23:59:59");
+                $endTime = strtotime($filters['end_time'] . " +1 day");
                 $where[] = [$timeField, '<=', $endTime];
             }            
             return $where;