<?php

// 获取亲子活动详情
require_once ("../user_include.inc");

ErrorLogger::doOutput("Compass...ajax_get_family_event_detail.php....Start.", 0);

//获取参数
$unionId = ParamUtil::getRequestString("unionId");
$eventId = ParamUtil::getRequestNumber("eventId", 0);

$result = array();

//参数检查
if(empty($unionId)) {
	$result["message"] = "参数错误!";
	responseNG($result);
}

//判断用户是否存在
$param = array();
$param['unionid'] = $unionId;
$param['delete_flg'] = false;
$userList = UserMst::getList($param,'id','desc', 0, 1);
if(empty($userList)) {
	$result["message"] = "用户不存在!";
	responseNG($result);
}

//查询亲子活动
$familyEventDat = FamilyEventDat::getById($eventId);
if(empty($familyEventDat)) {
	$result["message"] = "参数错误!";
	responseNG($result);
}

//todo 改为从家园系统数据库获取数据,格式一致!!

//todo 获取已完成和未完成人员名单
$finishUserList = array();
$finishUserList[] = "家校用户1";
$finishUserList[] = "家校用户2";

$unfinishUserList = array();
$unfinishUserList[] = "家校用户3";
$unfinishUserList[] = "家校用户4";


//组装返回数据
$result["familyEventDat"] = $familyEventDat;
$result["finishUserList"] = $finishUserList;
$result["unfinishUserList"] = $unfinishUserList;


ErrorLogger::doOutput("Compass...ajax_get_family_event_detail.php....End.", 0);

//返回结果
responseOK($result);

function responseNG($result) {
	$result = array("status"=>"NG", "result"=>$result);
	print json_encode($result);
	exit;
}
function responseOK($result) {
	$result = array("status"=>"OK", "result"=>$result);
	print json_encode($result);
	exit;
}
?>