[ 'member_count' => 1, 'site_count' => 2, 'visit_count' => 675, 'total_member_count' => 0, 'total_site_count' => 0, 'total_visit_count' => 6840, ], 'system' => [], 'version' => [], // 'visit_stat' => [ // 'date' => [], // 'value' => [980, 1323, 882, 762, 865, 923, 1105] // ], 'site_stat' => [ 'date' => [], 'value' => [] ], 'member_stat' => [ 'type' => [ '男', '女', '未知' ], 'value' => [] ], 'site_group_stat' => [ 'type' => [], 'value' => [] ], 'about' => [ [ 'name' => 'Niucloud官方公众号', 'image' => 'static/resource/icon/index_icon/wx_qrcode.jpg', 'desc' => '微信扫码关注' ], [ 'name' => '添加企业微信群', 'image' => 'static/resource/icon/index_icon/wework_qrcode.png', 'desc' => '更多内容请扫码加入' ] ], 'member_count_stat' => [ 'date' => [], 'value' => [] ], ]; $day_start_time = strtotime(date('Y-m-d')); //当天结束之间 $day_end_time = $day_start_time + 86400; $data[ 'today_data' ][ 'total_member_count' ] = ( new CoreMemberService() )->getCount(); $data[ 'today_data' ][ 'today_member_count' ] = ( new CoreMemberService() )->getCount([ 'create_time' => get_start_and_end_time_by_day() ]); $data[ 'today_data' ][ 'total_site_count' ] = ( new SiteService() )->getCount(); $data[ 'today_data' ][ 'today_site_count' ] = ( new SiteService() )->getCount([ 'create_time' => [ $day_start_time, $day_end_time ] ]); $data[ 'today_data' ][ 'norma_site_count' ] = ( new SiteService() )->getCount([ 'status' => [ 1 ], 'app_type' => [ 'site' ] ]); $data[ 'today_data' ][ 'expire_site_count' ] = ( new SiteService() )->getCount([ 'status' => [ 2 ] ]); $data[ 'today_data' ][ 'week_expire_site_count' ] = ( new Site() )->where([ [ 'status', '=', 1 ], [ 'expire_time', 'BETWEEN', [ time(), time() + 86400 * 7 ] ] ])->count(); $data[ 'system' ] = ( new SystemService() )->getInfo(); $data[ 'version' ] = $data[ 'system' ][ 'version' ] ?? []; $time = time(); for ($i = 1; $i <= 7; $i++) { $item_day = date('Y-m-d', strtotime('+' . $i - 7 . ' days', $time)); $data[ 'site_stat' ][ 'date' ][] = $item_day; $data[ 'site_stat' ][ 'value' ][] = ( new Site() )->where([ [ 'create_time', 'between', get_start_and_end_time_by_day($item_day) ] ])->count(); $data[ 'member_count_stat' ][ 'date' ][] = $item_day; $data[ 'member_count_stat' ][ 'value' ][] = ( new Member() )->where([ [ 'create_time', 'between', get_start_and_end_time_by_day($item_day) ] ])->count(); } $man_count = ( new CoreMemberService() )->getCount([ 'sex' => '1' ]); $woman_count = ( new CoreMemberService() )->getCount([ 'sex' => '2' ]); $data[ 'member_stat' ][ 'value' ] = [ $man_count, $woman_count, (int) ( $data[ 'today_data' ][ 'total_member_count' ] - $man_count - $woman_count ) ]; $site_group_list = ( new SiteGroupService() )->getAll(); if (!empty($site_group_list)) { foreach ($site_group_list as $v) { $data[ 'site_group_stat' ][ 'type' ][] = $v[ 'group_name' ]; $data[ 'site_group_stat' ][ 'value' ][] = ( new SiteService() )->getCount([ 'group_id' => $v[ 'group_id' ] ]); } } $app_count = ( new CoreAddonService() )->getLocalAddonCount(); $app_list = ( new CoreAddonService() )->getLocalAddonList()['list']??[]; $app_keys = array_keys($app_list); $app_installed_count = ( new CoreAddonService() )->getCount([['key','in',$app_keys]]); $app = [ 'app_count' => $app_count, 'app_no_installed_count' => $app_count - $app_installed_count, 'app_installed_count' => $app_installed_count, ]; $data[ 'app' ] = $app; return $data; } }