|
|
@@ -26,20 +26,20 @@ class MerchantStatisModel extends Model
|
|
|
public static function getMerchantDailyList($merchantId, $page = 1, $limit = 20, $filters = [])
|
|
|
{
|
|
|
$where = [
|
|
|
- ['app_id', '=', $merchantId]
|
|
|
+ ['app_id', '=', $merchantId],
|
|
|
+ ['action_type', '=', 1],
|
|
|
];
|
|
|
|
|
|
// 时间筛选
|
|
|
if (!empty($filters['start_time'])) {
|
|
|
- $startTime = strtotime($filters['start_time']);
|
|
|
+ $startTime = strtotime($filters['start_time'] . " 00:00:00");
|
|
|
$where[] = ['create_time', '>=', $startTime];
|
|
|
}
|
|
|
|
|
|
if (!empty($filters['end_time'])) {
|
|
|
- $endTime = strtotime($filters['end_time']);
|
|
|
+ $endTime = strtotime($filters['end_time']. " 23:59:59");
|
|
|
$where[] = ['create_time', '<=', $endTime];
|
|
|
}
|
|
|
-
|
|
|
$query = self::where($where);
|
|
|
// 统计总数
|
|
|
$total = $query->count();
|
|
|
@@ -52,7 +52,8 @@ class MerchantStatisModel extends Model
|
|
|
'SUM(bet) as bet_amount', // 注单金额(下注分数)
|
|
|
'SUM(total_win_amount) as game_profit', // 游戏输赢(金额变化)
|
|
|
'COUNT(DISTINCT game_id) as game_count', // 游戏数量
|
|
|
- ])
|
|
|
+ 'SUM(is_buy_game) as buy_free_bet_count'
|
|
|
+ ])
|
|
|
->order('date', 'desc')
|
|
|
->group('date')
|
|
|
->page($page, $limit)
|
|
|
@@ -81,24 +82,26 @@ class MerchantStatisModel extends Model
|
|
|
public static function getMerchantHistory($merchantId, $filters = [])
|
|
|
{
|
|
|
$where = [
|
|
|
- ['app_id', '=', $merchantId]
|
|
|
+ ['app_id', '=', $merchantId],
|
|
|
];
|
|
|
|
|
|
$getWhere = function(string $timeField) use ($where, $filters) {
|
|
|
// 时间筛选
|
|
|
if (!empty($filters['start_time'])) {
|
|
|
- $startTime = strtotime($filters['start_time']);
|
|
|
+ $startTime = strtotime($filters['start_time'] . " 00:00:00");
|
|
|
$where[] = [$timeField, '>=', $startTime];
|
|
|
}
|
|
|
|
|
|
if (!empty($filters['end_time'])) {
|
|
|
- $endTime = strtotime($filters['end_time']);
|
|
|
+ $endTime = strtotime($filters['end_time'] . " 23:59:59");
|
|
|
$where[] = [$timeField, '<=', $endTime];
|
|
|
}
|
|
|
return $where;
|
|
|
};
|
|
|
-
|
|
|
- $query = self::where($getWhere('create_time'));
|
|
|
+ $tempWhere = $getWhere('create_time');
|
|
|
+ $tempWhere[] = ['action_type', '=', 1];
|
|
|
+ $query = self::where($tempWhere);
|
|
|
+
|
|
|
// 获取列表数据
|
|
|
$data = $query->field([
|
|
|
'AVG(rtp) AS rtp', // 平均RTP
|
|
|
@@ -107,7 +110,8 @@ class MerchantStatisModel extends Model
|
|
|
'SUM(bet) as bet_amount', // 注单金额(下注分数)
|
|
|
'SUM(total_win_amount) as game_profit', // 游戏输赢(金额变化)
|
|
|
'COUNT(DISTINCT game_id) as game_count', // 游戏数量
|
|
|
- ])
|
|
|
+ 'SUM(is_buy_game) as buy_free_bet_count'
|
|
|
+ ])
|
|
|
->find()
|
|
|
->toArray();
|
|
|
// 获取登录用户、注册用户
|