function home() { $program_name = "天天团购"; $item_list = array( 'system_members' => array( 'name' => '用户数', 'url' => 'admin.php?mod=member&code=dosearch', ), 'tttuangou_city' => array( 'name' => '城市数', 'url' => 'admin.php?mod=tttuangou&code=city', ), 'tttuangou_seller' => array( 'name' => '商家数', 'url' => 'admin.php?mod=tttuangou&code=mainseller', ), 'tttuangou_product' => array( 'name' => '产品数', 'url' => 'admin.php?mod=product', ), 'tttuangou_order' => array( 'name' => '订单数', 'url' => 'admin.php?mod=order', ), 'tttuangou_ticket' => array( 'name' => TUANGOU_STR . '券数', 'url' => 'admin.php?mod=coupon', ), 'tttuangou_subscribe' => array( 'name' => '订阅数', 'url' => 'admin.php?mod=subscribe', ), 'tttuangou_question' => array( 'name' => '问答数', 'url' => 'admin.php?mod=tttuangou&code=mainquestion', ), 'tttuangou_usermsg' => array( 'name' => '反馈信息数', 'url' => 'admin.php?mod=tttuangou&code=usermsg', ), ); $sys_env = array(); if(false === ($statistic = cache("misc/admin_statistic", 60))) { $statistic=array(); foreach ($item_list as $item=>$items) { $table = TABLE_PREFIX . $item; $sql = " select count(*) as `total` from {$table} "; if ($item == 'tttuangou_subscribe') { $sql .= "where validated='true'"; } elseif ($item == 'tttuangou_product') { $sql .= "where saveHandler = 'normal'"; } $query = $this->DatabaseHandler->Query($sql); $row = $query->GetRow(); $items['total'] = $row['total']; $sys_env[("sys_" . ("s"==substr(($_tmp = str_replace(array('tttuangou_','system_'),'',$item)),-1) ? $_tmp : $_tmp . "s"))] = $items['total']; $statistic[$item] = $items; } cache($statistic); } elseif (isset($statistic['sessions'])) { $sql="SELECT count(1) total FROM `" . TABLE_PREFIX . "system_sessions`"; $query = $this->DatabaseHandler->Query($sql); $row=$query->GetRow(); $statistic['sessions'] = $row['total']; } if (false === ($data_length = cache("misc/data_length", 3600))) { $sql="show table status from `{$this->Config['db_name']}` like '".TABLE_PREFIX."%'"; $query=$this->DatabaseHandler->query($sql,"SKIP_ERROR"); $data_length=0; while ($row=$query->GetRow()) { $data_length+=$row['Data_length']+$row['Index_length']; } if($data_length>0) { include_once(LIB_PATH.'io.han.php'); $data_length=IoHandler::SizeConvert($data_length); } $sys_env['sys_data_length'] = $data_length; cache($data_length); } $sql = " select count(*) as `total` from ".TABLE_PREFIX."tttuangou_push_queue WHERE rund='false'"; $query = $this->DatabaseHandler->Query($sql); $row = $query->GetRow(); $statistic['cron_length'] = array('name'=>'邮件队列长度','url'=>'admin.php?mod=push&code=queue','total'=>$row['total']); $statistic['data_length'] = array('name'=>'数据库尺寸','url'=>'admin.php?mod=db&code=optimize','total'=>$data_length); $statistic['express_wait_count'] = array('name'=>'等待发货', 'url'=>'admin.php?mod=delivery&code=vlist&alsend=no','total'=>logic('order')->Count('status='.ORD_STA_Normal.' AND process="WAIT_SELLER_SEND_GOODS"')); $dateYmd = date('Y-m-d',time()); $today_start = strtotime($dateYmd.' 00:00:00'); $today_end = strtotime($dateYmd.'23:59:59'); $addwhere = ''; if(MEMBER_ROLE_TYPE == 'seller'){ $pids = logic('product')->GetUserSellerProduct(MEMBER_ID); $asql = 0; if($pids){ $asql = implode(',',$pids); } $addwhere = ' AND productid IN('.$asql.')'; } $order_nums = dbc(DBCMax)->select('order')-> in('count(*) as NUM')->where("buytime between {$today_start} and {$today_end}".$addwhere)->limit(1)->done(); $pay_ordes = dbc(DBCMax)->select('order')-> in('count(*) as NUM,sum(paymoney) as money')->where("paytime between {$today_start} and {$today_end} and paytime > 0 and pay > 0".$addwhere)->limit(1)->done(); $notpay_ordes = dbc(DBCMax)->select('order')-> in('count(*) as NUM')->where("buytime between {$today_start} and {$today_end} and paytime = 0 and pay = 0".$addwhere)->limit(1)->done(); $statistic['today_orders'] = $order_nums['NUM']; $statistic['today_pay_orders'] = $pay_ordes['NUM']; $statistic['today_unpay_orders'] = $notpay_ordes['NUM']; $statistic['today_income_orders'] = (float)$pay_ordes['money']; include(handler('template')->file('@admin/home')); exit; }
function ReadDiskSpace($drive) { $disk_space['size']['total'] = disk_total_space($drive); $disk_space['size']['free'] = disk_free_space($drive); $disk_space['size']['used'] = $disk_space['size']['total'] - $disk_space['size']['free']; $disk_space['size_converted']['used'] = IoHandler::SizeConvert($disk_space['size']['total'] - $disk_space['size']['free']); $disk_space['size_converted']['total'] = IoHandler::SizeConvert($disk_space['size']['total']); $disk_space['size_converted']['free'] = IoHandler::SizeConvert($disk_space['size']['free']); Return $disk_space; }