|
|
@@ -40,11 +40,8 @@ class MerchantStatisModel extends Model
|
|
|
$endTime = strtotime($filters['end_time']. " +1 day");
|
|
|
$where[] = ['create_time', '<=', $endTime];
|
|
|
}
|
|
|
- $query = self::where($where);
|
|
|
- // 统计总数
|
|
|
- $total = $query->count();
|
|
|
// 获取列表数据
|
|
|
- $list = $query->field([
|
|
|
+ $subQuery = self::field([
|
|
|
"FROM_UNIXTIME(create_time, '%Y-%m-%d') as date", // 日期
|
|
|
'COUNT(DISTINCT uname) as bet_users', // 投注用户数
|
|
|
'COUNT(id) as bet_count', // 注单数
|
|
|
@@ -54,11 +51,18 @@ class MerchantStatisModel extends Model
|
|
|
'COUNT(DISTINCT game_id) as game_count', // 游戏数量
|
|
|
'SUM(is_buy_game) as buy_free_bet_count'
|
|
|
])
|
|
|
- ->order('date', 'desc')
|
|
|
+ ->where($where)
|
|
|
->group('date')
|
|
|
+ ->buildSql();
|
|
|
+
|
|
|
+ // 统计总数
|
|
|
+ $total = self::table($subQuery . ' t')->count();
|
|
|
+ $list = self::table($subQuery . ' t')
|
|
|
+ ->order('date', 'desc')
|
|
|
->page($page, $limit)
|
|
|
->select()
|
|
|
->toArray();
|
|
|
+
|
|
|
// 获取登录用户、注册用户
|
|
|
$merchantsUserStatic = MerchantsUserModel::getPlayerStatistics($merchantId, $filters);
|
|
|
|