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_circle_event_list.php....Start.", 0);
//获取参数
$unionId = ParamUtil::getRequestString("unionId");
$circleId = ParamUtil::getRequestNumber("circleId", 0);//圈子id
$page = ParamUtil::getRequestNumber("page", 0);//圈子id
$result = array();
//参数检查
if(empty($unionId) || empty($circleId)) {
$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);
}
$userMst = $userList[0];
//判断圈子是否存在
$circleDat = CircleDat::getById($circleId);
if(empty($circleDat)) {
$result["message"] = "圈子不存在!";
responseNG($result);
}
//每页显示条数
$rowCount = 10;
$offset = $page * $rowCount;
$result = array();
//是否为圈主
$isOwner = false;
if($circleDat->owner_id == $userMst->id) {
$isOwner = true;
}
//查询发布的志愿者活动
$volunteerEventList = array();
$param = array();
$param['circle_id'] = $circleDat->id;
//圈主可以查看所有活动,成员只能查看审核成功的活动
if(!$isOwner) {
$param['status_NOT'] = "NEW";
$param['status_NOT'] = "NG";
}
$param['delete_flg'] = false;
$tmpVolunteerEventList = VolunteerEventDat::getList($param, "id", "desc", $offset, $rowCount);
$volunteerEvenCount = VolunteerEventDat::getListCount($param);
$pageCount = ceil($volunteerEvenCount/$rowCount);
if(!empty($tmpVolunteerEventList)) {
//设置状态和招募范围
foreach($tmpVolunteerEventList as $tmp) {
$tmp->status_title = EventStatus::getTitleByName($tmp->status);
$tmp->scope = "校内";
if($tmp->include_social_user) {
$tmp->scope = "校内.社会人士";
}
$volunteerEventList[] = $tmp;
}
}
ErrorLogger::doOutput("Compass...ajax_get_circle_event_list.php....End.", 0);
//返回结果
$result["isOwner"] = $isOwner;
$result["rowCount"] = $rowCount;
$result["page"] = $page;
$result["pageCount"] = $pageCount;
$result["volunteerEventList"] = $volunteerEventList;
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;
}
?>