Commit abb66b3f by biao

111

parent 85e94740
......@@ -60,7 +60,7 @@ if($volunteerEventMemberDat->circle_id == 0) {
$circleId = $volunteerEventMemberDat->circle_id;
$sql = "update volunteer_event_member_dat set delete_flg=true where delete_flg=false and volunteer_event_id='{$eventId}' and circle_id='{$circleId}'";
$db = &CompassDBManager::getInstance();
$db->executeQuery($from.$sql_where);
$db->executeQuery($sql);
} else {
//成员取消参加,之取消自己的的参加
$volunteerEventMemberDat->delete_flg = true;
......
<?php
// 获取志愿者活动列表
require_once ("../user_include.inc");
ErrorLogger::doOutput("Compass...ajax_get_socia_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);
}
//查询社会实践活动是否存在
$sociaEventDat = SocialEventDat::getById($eventId);
if(empty($sociaEventDat)) {
$result["message"] = "参数错误!";
responseNG($result);
}
//todo 改为从家校系统数据库获取数据,格式一致!!
//todo 获取已完成和未完成人员名单
$finishUserList = array();
$finishUserList[] = "家校用户1";
$finishUserList[] = "家校用户2";
$unfinishUserList = array();
$unfinishUserList[] = "家校用户3";
$unfinishUserList[] = "家校用户4";
//组装返回数据
$result["sociaEventDat"] = $sociaEventDat;
$result["finishUserList"] = $finishUserList;
$result["unfinishUserList"] = $unfinishUserList;
ErrorLogger::doOutput("Compass...ajax_get_socia_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;
}
?>
\ No newline at end of file
<?php
// 获取志愿者活动列表
require_once ("../user_include.inc");
ErrorLogger::doOutput("Compass...ajax_get_socialEvent_event_list.php....Start.", 0);
//获取参数
$unionId = ParamUtil::getRequestString("unionId");
//用户所在【省市区】
$province = ParamUtil::getRequestString("province");
$city = ParamUtil::getRequestString("city");
$district = ParamUtil::getRequestString("district");
//翻页
$page = ParamUtil::getRequestNumber("page", 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);
}
//每页显示条数
$rowCount = 10;
$offset = $page * $rowCount;
$userMst = $userList[0];
//社会实践
$param = array();
$param['delete_flg'] = false;
$socialEventEventList = SocialEventDat::getList($param,'id','desc', $offset, $rowCount);
$socialEventEvenCount = SocialEventDat::getListCount($param);
//组装返回数据
$result["rowCount"] = $rowCount;
$result["page"] = $page;
$result["socialEventEvenCount"] = $socialEventEvenCount;
$result["socialEventEventList"] = $socialEventEventList;
ErrorLogger::doOutput("Compass...ajax_get_socialEvent_event_list.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;
}
?>
\ No newline at end of file
<?php
// 志愿者排名【省级】
require_once ("../user_include.inc");
ErrorLogger::doOutput("Compass...ajax_get_volunteer_rank1.php....Start.", 0);
//获取参数
$unionId = ParamUtil::getRequestString("unionId");
$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);
}
//查询志愿者排名
$rankList = array();
$sql = "select province, sum(ability_point) as ability_point from user_mst where delete_flg = false group by province order by ability_point desc";
$db = &CompassDBManager::getInstance();
$tmpList = $db->executeQuery($sql);
if(!empty($tmpList)) {
foreach($tmpList as $tmp) {
//获取该省份下辖市数量
$sql = "select distinct city from user_mst where delete_flg = false and province='{$tmp["province"]}'";
$tmpList2 = $db->executeQuery($sql);
$tmp["city_count"] = count($tmpList2);
$rankList[] = $tmp;
}
}
ErrorLogger::doOutput("Compass...ajax_get_volunteer_rank1.php....End.", 0);
//返回结果
$result["rankList"] = $rankList;
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;
}
?>
\ No newline at end of file
<?php
// 志愿者排名【省级】
require_once ("../user_include.inc");
ErrorLogger::doOutput("Compass...ajax_get_volunteer_rank2.php....Start.", 0);
//获取参数
$unionId = ParamUtil::getRequestString("unionId");
$province = ParamUtil::getRequestString("province");//省份
$result = array();
//参数检查
if(empty($unionId) || empty($province)) {
$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);
}
//查询志愿者排名
$rankList = array();
$sql = "select city, sum(ability_point) as ability_point from user_mst where delete_flg = false and province='{$province}' group by city order by ability_point desc";
$db = &CompassDBManager::getInstance();
$tmpList = $db->executeQuery($sql);
if(!empty($tmpList)) {
foreach($tmpList as $tmp) {
//获取该市区下辖区县数量
$sql = "select distinct district from user_mst where delete_flg = false and province='{$province}' and city='{$tmp["city"]}'";
$tmpList2 = $db->executeQuery($sql);
$tmp["district_count"] = count($tmpList2);
$rankList[] = $tmp;
}
}
ErrorLogger::doOutput("Compass...ajax_get_volunteer_rank2.php....End.", 0);
//返回结果
$result["rankList"] = $rankList;
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;
}
?>
\ No newline at end of file
<?php
// 志愿者排名【区县级】
require_once ("../user_include.inc");
ErrorLogger::doOutput("Compass...ajax_get_volunteer_rank2.php....Start.", 0);
//获取参数
$unionId = ParamUtil::getRequestString("unionId");
$province = ParamUtil::getRequestString("province");//省份
$city = ParamUtil::getRequestString("city");//市名称
$result = array();
//参数检查
if(empty($unionId) || empty($province) || empty($city)) {
$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);
}
//查询志愿者排名
$rankList = array();
$sql = "select district, sum(ability_point) as ability_point from user_mst where delete_flg = false and province='{$province}' and city='{$city}' group by district order by ability_point desc";
$db = &CompassDBManager::getInstance();
$tmpList = $db->executeQuery($sql);
if(!empty($tmpList)) {
foreach($tmpList as $tmp) {
//获取该区县下辖学校数量
$sql = "select distinct school_no, original_source from user_mst where delete_flg = false and province='{$province}' and city='{$city}' and district='{$tmp["district"]}'";
$tmpList2 = $db->executeQuery($sql);
$tmp["school_count"] = count($tmpList2);
$rankList[] = $tmp;
}
}
ErrorLogger::doOutput("Compass...ajax_get_volunteer_rank2.php....End.", 0);
//返回结果
$result["rankList"] = $rankList;
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;
}
?>
\ No newline at end of file
<?php
// 志愿者排名【学校】
require_once ("../user_include.inc");
ErrorLogger::doOutput("Compass...ajax_get_volunteer_rank2.php....Start.", 0);
//获取参数
$unionId = ParamUtil::getRequestString("unionId");
$province = ParamUtil::getRequestString("province");//省份
$city = ParamUtil::getRequestString("city");//市名称
$district = ParamUtil::getRequestString("district");//区县名称
$result = array();
//参数检查
if(empty($unionId) || empty($province) || empty($city)) {
$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);
}
//查询志愿者排名
$rankList = array();
$sql = "select original_source, school_no, sum(ability_point) as ability_point from user_mst where delete_flg = false and province='{$province}' and city='{$city}' and district='{$district}' group by original_source, school_no order by ability_point desc";
$db = &CompassDBManager::getInstance();
$tmpList = $db->executeQuery($sql);
if(!empty($tmpList)) {
foreach($tmpList as $tmp) {
//获取学校名称(TODO 以后从家校家园系统获取)
$tmp["school"] = "测试学校";
//获取该区县下辖学校数量
$sql = "select count(*) as user_count from user_mst where delete_flg = false and province='{$province}' and city='{$city}' and original_source='{$tmp["original_source"]}' and school_no='{$tmp["school_no"]}'";
$tmpList2 = $db->executeQuery($sql);
$tmp["user_count"] = $tmpList2[0]['user_count'];
$rankList[] = $tmp;
}
}
ErrorLogger::doOutput("Compass...ajax_get_volunteer_rank2.php....End.", 0);
//返回结果
$result["rankList"] = $rankList;
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;
}
?>
\ No newline at end of file
<?php
// 上传志愿者活动凭证
require_once ("../user_include.inc");
ErrorLogger::doOutput("Compass...ajax_set_volunteer_event_result.php....Start.", 0);
//获取参数
$unionId = ParamUtil::getRequestString("unionId");
$eventId = ParamUtil::getRequestNumber("eventId", 0);
$comment = ParamUtil::getRequestString("comment");//活动感悟
$result = array();
//参数检查
if(empty($unionId || empty($eventId) || empty($comment))) {
$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);
}
//查询志愿者活动
$volunteerDat = VolunteerEventDat::getById($eventId);
if(empty($volunteerDat)) {
$result["message"] = "参数错误!";
responseNG($result);
}
$userMst = $userList[0];
//是否已经报名参加
$param = array();
$param['volunteer_event_id'] = $eventId;
$param['user_id'] = $userMst->id;
$param['delete_flg'] = false;
$tmpVolunteerEventMemberList = VolunteerEventMemberDat::getList($param, "id", "desc", 0, 1);
if(empty($tmpVolunteerEventMemberList)) {
$result["message"] = "数据错误!";
responseNG($result);
}
$volunteerEventMemberDat = $tmpVolunteerEventMemberList[0];
//处理上传图片
$aliHandler = new AliUploadHandler();
if(!empty($_FILES['photo']['tmp_name'])){
$upload_file = FileUploadUtil::getScalarFile(@$_FILES['photo']);
$tmp_file_name = date("Ymd") . "_" . trim(basename($upload_file->name));//保存的名字自定义,这里如果图片的名字原来的是aa.jp,保存成20200220_aa.jpg
$url = $aliHandler->uploadImg($tmp_file_name, $upload_file->tmp_name);
//这里的url就是http://compass-dev.oss-cn-beijing.aliyuncs.com/20200220_aa.jpg
$volunteerEventMemberDat->images = $url;
}
$volunteerEventMemberDat->comment = $comment;
$volunteerEventMemberDat->save();
ErrorLogger::doOutput("Compass...ajax_set_volunteer_event_result.php....End.", 0);
//返回结果
$result["message"] = "上传成功!";
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;
}
?>
\ No newline at end of file
......@@ -3,16 +3,17 @@
// 上传志愿者活动凭证
require_once ("../user_include.inc");
ErrorLogger::doOutput("Compass...ajax_cancel_volunteer_event_personal.php....Start.", 0);
ErrorLogger::doOutput("Compass...ajax_set_volunteer_event_result.php....Start.", 0);
//获取参数
$unionId = ParamUtil::getRequestString("unionId");
$eventId = ParamUtil::getRequestNumber("eventId", 0);
$comment = ParamUtil::getRequestString("comment");//活动感悟
$result = array();
//参数检查
if(empty($unionId)) {
if(empty($unionId || empty($eventId) || empty($comment))) {
$result["message"] = "参数错误!";
responseNG($result);
}
......@@ -49,30 +50,23 @@ if(empty($tmpVolunteerEventMemberList)) {
$volunteerEventMemberDat = $tmpVolunteerEventMemberList[0];
//个人报名直接取消
if($volunteerEventMemberDat->circle_id == 0) {
$volunteerEventMemberDat->delete_flg = true;
$volunteerEventMemberDat->save();
} else {
//圈子报名
if($volunteerEventMemberDat->is_owner) {
//圈主取消的情况下,取消所有成员报名
$circleId = $volunteerEventMemberDat->circle_id;
$sql = "update volunteer_event_member_dat set delete_flg=true where delete_flg=false and volunteer_event_id='{$eventId}' and circle_id='{$circleId}'";
$db = &CompassDBManager::getInstance();
$db->executeQuery($from.$sql_where);
} else {
//成员取消参加,之取消自己的的参加
$volunteerEventMemberDat->delete_flg = true;
$volunteerEventMemberDat->save();
}
//处理上传图片
$aliHandler = new AliUploadHandler();
if(!empty($_FILES['photo']['tmp_name'])){
$upload_file = FileUploadUtil::getScalarFile(@$_FILES['photo']);
$tmp_file_name = date("Ymd") . "_" . trim(basename($upload_file->name));//保存的名字自定义,这里如果图片的名字原来的是aa.jp,保存成20200220_aa.jpg
$url = $aliHandler->uploadImg($tmp_file_name, $upload_file->tmp_name);
//这里的url就是http://compass-dev.oss-cn-beijing.aliyuncs.com/20200220_aa.jpg
$volunteerEventMemberDat->images = $url;
}
$volunteerEventMemberDat->comment = $comment;
$volunteerEventMemberDat->save();
ErrorLogger::doOutput("Compass...ajax_cancel_volunteer_event_personal.php....End.", 0);
ErrorLogger::doOutput("Compass...ajax_set_volunteer_event_result.php....End.", 0);
//返回结果
$result["message"] = "取消成功!";
$result["message"] = "上传成功!";
responseOK($result);
function responseNG($result) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment