1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
<?php
// 【区域管理】获取指定学校的志愿者活动列表
require_once ("../user_include.inc");
ErrorLogger::doOutput("Compass...ajax_get_school_detail.php....Start.", 0);
//获取参数
$schoolNo = ParamUtil::getRequestString("schoolNo");
$originalSource = ParamUtil::getRequestNumber("originalSource", 0);
//参数检查
if(empty($schoolNo) || empty($originalSource)) {
$result["message"] = "参数错误!";
responseNG($result);
}
$result = array();
//查询学校是否存在
//todo 以后改为 从家校或者家园系统查询
$param = array();
$param['school_no'] = $schoolNo;
$param['original_source'] = $originalSource;
$param['delete_flg'] = false;
$schoolList = SchoolMst::getList($param,'id','desc', 0, 1);
if(empty($schoolList)) {
$result["message"] = "参数错误!";
responseNG($result);
}
$schoolMst = $schoolList[0];
//查询该学校的志愿者人数
$memberCount = 0;
$sql = "select count(*) as member_count from user_mst where delete_flg = false and school_no='{$schoolNo}' and original_source='{$originalSource}'";
$db = &CompassDBManager::getInstance();
$tmpList = $db->executeQuery($sql);
if(!empty($tmpList)) {
$memberCount = $tmpList[0]['member_count'];
}
//查询该校能力分汇总
$abilityPoint = 0;
$sql = "select sum(ability_point) as ability_point from user_mst where delete_flg = false and school_no='{$schoolNo}' and original_source='{$originalSource}'";
$db = &CompassDBManager::getInstance();
$tmpList = $db->executeQuery($sql);
if(!empty($tmpList)) {
$abilityPoint = $tmpList[0]['ability_point'];
}
//查询该学校的志愿者活动列表
$volunteerEventList = array();
$param = array();
$param['school_no'] = $schoolNo;
$param['original_source'] = $originalSource;
$param['status_NOT'] = "NEW";
$param['status_NOT'] = "NG";
$param['delete_flg'] = false;
$tmpVolunteerEventList = VolunteerEventDat::getList($param,'id','desc');
//加工返回的数据
//设置状态和招募范围
foreach($tmpVolunteerEventList as $tmp) {
$tmp->status_title = "征集中";
$tmp->scope = "校内";
if($tmp->include_social_user) {
$tmp->scope = "校内.社会人士";
}
$volunteerEventList[] = $tmp;
}
//接口返回数据
$result["schoolTitle"] = $schoolMst->title;
$result["memberCount"] = $memberCount;
$result["abilityPoint"] = $abilityPoint;
$result["volunteerEventList"] = $volunteerEventList;
ErrorLogger::doOutput("Compass...ajax_get_school_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;
}
?>