diff --git a/application/adminapi/controller/Statistical.php b/application/adminapi/controller/Statistical.php index 35356d3d..52c72b94 100644 --- a/application/adminapi/controller/Statistical.php +++ b/application/adminapi/controller/Statistical.php @@ -261,13 +261,21 @@ class Statistical extends adminApi if(!empty($begin_time) && !empty($end_time)){ $where['createtime'] = ['between',[strtotime($begin_time),strtotime($end_time)]]; } + $tables = GiftTableManager::getTablesByTimeRange( + strtotime($begin_time), + strtotime($end_time) + ); + if(empty($tables)){ + $tables[0] = "fa_vs_give_gift"; + } + $table_name = substr($tables[0], 3);//截取可查询的表名 //不为空 $where['from'] = 2; - $count = db::name('vs_give_gift') + $count = db::name($table_name) ->where($where) ->group('from_id') ->count(); - $lists = db::name('vs_give_gift') + $lists = db::name($table_name) ->field('id,createtime,user_id,gift_user,sum(total_price) as total_price,sum(number) as number,from_id') ->where($where) ->group('from_id')