<?php
require 'inc.php';
if(!isset($get_app)) $get_app="";
$arr_cfg_sys=$obj_tab_sys_config->get_model("sys");
$arr_cfg_company=$obj_tab_sys_config->get_model("company");
$arr_cfg_personal=$obj_tab_sys_config->get_model("personal");
switch($get_app){
	case "api":
		$str_cont=file_get_contents(XXGONET_URL."/api.php?app=adminmsg");
		echo $str_cont;exit;
		break;
	case "step2":
		//总注册数
		$obj_rs=$obj_db->get_one("select count(1) as num from ".DB_PRE."sys_user");
		$arr_count["user_total"]=$obj_rs["num"];
		//今日新增
		$lng_today=strtotime(date("Y-m-d",TIME));
		$obj_rs=$obj_db->get_one("select count(1) as num from ".DB_PRE."sys_user where user_regtime>=".$lng_today);
		$arr_count["user_today"]=$obj_rs["num"];


		//总职位数
		$obj_rs=$obj_db->get_one("select count(1) as num from ".DB_PRE."hr_job");
		$arr_count["job_total"]=$obj_rs["num"];
		//今日新增
		$lng_today=strtotime(date("Y-m-d",TIME));
		$obj_rs=$obj_db->get_one("select count(1) as num from ".DB_PRE."hr_job where job_addtime>=".$lng_today);
		$arr_count["job_today"]=$obj_rs["num"];

		//总简历
		$obj_rs=$obj_db->get_one("select count(1) as num from ".DB_PRE."hr_resume");
		$arr_count["resume_total"]=$obj_rs["num"];
		//今日新增
		$lng_today=strtotime(date("Y-m-d",TIME));
		$obj_rs=$obj_db->get_one("select count(1) as num from ".DB_PRE."hr_resume where resume_addtime>=".$lng_today);
		$arr_count["resume_today"]=$obj_rs["num"];

		//VIP企业总数
		$obj_rs=$obj_db->get_one("select count(1) as num from ".DB_PRE."hr_company where company_vip_endtime>".TIME);
		$arr_count["vip_total"]=$obj_rs["num"];
		//今日新增
		$lng_today=strtotime(date("Y-m-d",TIME));
		$obj_rs=$obj_db->get_one("select count(1) as num from ".DB_PRE."hr_company where company_vip_time>=".$lng_today);
		$arr_count["vip_today"]=$obj_rs["num"];

		//面试邀请
		$obj_rs=$obj_db->get_one("select count(1) as num from ".DB_PRE."hr_job_invite");
		$arr_count["jobinvite_total"]=$obj_rs["num"];
		//今日新增
		$lng_today=strtotime(date("Y-m-d",TIME));
		$obj_rs=$obj_db->get_one("select count(1) as num from ".DB_PRE."hr_job_invite where invite_addtime>=".$lng_today);
		$arr_count["jobinvite_today"]=$obj_rs["num"];

		//简历投递
		$obj_rs=$obj_db->get_one("select count(1) as num from ".DB_PRE."hr_job_apply");
		$arr_count["jobapply_total"]=$obj_rs["num"];
		//今日新增
		$lng_today=strtotime(date("Y-m-d",TIME));
		$obj_rs=$obj_db->get_one("select count(1) as num from ".DB_PRE."hr_job_apply where apply_addtime>=".$lng_today);
		$arr_count["jobapply_today"]=$obj_rs["num"];
		echo $obj_msg->json_encode($arr_count);
		exit;
		break;
	default:
		//未审信息
		if(!isset($arr_cfg_sys["user_state"]) || intval($arr_cfg_sys["user_state"])<1){
			//账号，需要审核的时候才去统计
			$obj_rs=$obj_db->get_one("select count(1) as num from ".DB_PRE."sys_user where user_state=".intval($arr_cfg_sys["user_state"]));
			$arr_count["user"]=$obj_rs["num"];
		}
		if(!isset($arr_cfg_personal["resume_state"]) || intval($arr_cfg_personal["resume_state"])<1){
			//简历，需要审核的时候才去统计
			$obj_rs=$obj_db->get_one("select count(1) as num from ".DB_PRE."hr_resume where resume_state=".intval($arr_cfg_personal["resume_state"]));
			$arr_count["resume"]=$obj_rs["num"];
		}
		if(!isset($arr_cfg_company["company_state"]) || intval($arr_cfg_company["company_state"])<1){
			//企业，需要审核的时候才去统计
			$obj_rs=$obj_db->get_one("select count(1) as num from ".DB_PRE."hr_company where company_state=".intval($arr_cfg_company["company_state"]));
			$arr_count["company"]=$obj_rs["num"];
		}
		if(!isset($arr_cfg_personal["photo_state"]) || intval($arr_cfg_personal["photo_state"])<1){
			//简历头像，需要审核的时候才去统计
			$obj_rs=$obj_db->get_one("select count(1) as num from ".DB_PRE."hr_resume where resume_photo!='' and resume_photo_state=".intval($arr_cfg_personal["photo_state"]));
			$arr_count["resume_headerpic"]=$obj_rs["num"];
		}
		if(!isset($arr_cfg_company["pic_state"]) || intval($arr_cfg_company["pic_state"])<1){
			//企业照片，需要审核的时候才去统计
			$obj_rs=$obj_db->get_one("select count(1) as num from ".DB_PRE."hr_photo a,".DB_PRE."sys_user b where a.photo_user_id=b.user_id and b.user_type='company' and photo_state=".intval($arr_cfg_company["pic_state"]));
			$arr_count["company_photo"]=$obj_rs["num"];
		}
		if(!isset($arr_cfg_personal["pic_state"]) || intval($arr_cfg_personal["pic_state"])<1){
			//企业照片，需要审核的时候才去统计
			$obj_rs=$obj_db->get_one("select count(1) as num from ".DB_PRE."hr_photo a,".DB_PRE."sys_user b where a.photo_user_id=b.user_id and b.user_type='personal' and photo_state=".intval($arr_cfg_personal["pic_state"]));
			$arr_count["resume_photo"]=$obj_rs["num"];
		}
		//未读留言
		$obj_rs=$obj_db->get_one("select count(1) as num from ".DB_PRE."other_msgbook where msg_state=0");
		$arr_count["msgbook"]=$obj_rs["num"];
		//友情申请
		$obj_rs=$obj_db->get_one("select count(1) as num from ".DB_PRE."other_friendlink where link_state=0");
		$arr_count["friendlink"]=$obj_rs["num"];
		//认证信息
		$arr_count["verify"]=array("id_1"=>0,"id_2"=>0,"id_4"=>0,"id_8"=>0);
		$obj_result=$obj_db->query("select verify_type,count(1) as num from ".DB_PRE."sys_verify where verify_state=0 group by verify_type");
		while($obj_rs=$obj_db->fetch_array($obj_result)){
			$arr_count["verify"]["id_".$obj_rs["verify_type"]]=$obj_rs["num"];
		}
		//招聘会
		$obj_rs=$obj_db->get_one("select count(1) as num from ".DB_PRE."hr_meet where meet_state=0");
		$arr_count["meet"]=$obj_rs["num"];

		$arr_version["version"]=$_SERVER["SERVER_SOFTWARE"];
		$arr_version["myphp"]=XXGONET_VERSION;
		include "tpl/index.tpl.php";
}
?>
