From 314b3f669f33f88bccb07049819c4f41be96d843 Mon Sep 17 00:00:00 2001 From: biao <zb182838> Date: Tue, 3 Mar 2020 23:12:20 +0800 Subject: [PATCH] 11 --- doc/DB/compass_db_schema.xlsx | Bin 124875 -> 0 bytes doc/小程序文件命名以及接口调用说明.xlsx | Bin 17913 -> 0 bytes doc/接口文档 V1.0.xls | Bin 88064 -> 0 bytes src/user/if/ajax_get_donation_event_detail.php | 66 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ src/user/if/ajax_get_donation_event_list.php | 66 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ src/user/if/ajax_set_circle_event_new.php | 137 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++------------------------ src/user/if/ajax_set_user_donation_dat.php | 81 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ src/user/if/ajax_social_user_register2.php | 2 +- 8 files changed, 327 insertions(+), 25 deletions(-) create mode 100644 src/user/if/ajax_get_donation_event_detail.php create mode 100644 src/user/if/ajax_get_donation_event_list.php create mode 100644 src/user/if/ajax_set_user_donation_dat.php diff --git a/doc/DB/compass_db_schema.xlsx b/doc/DB/compass_db_schema.xlsx index 65f7b3a..ce406e3 100644 Binary files a/doc/DB/compass_db_schema.xlsx and b/doc/DB/compass_db_schema.xlsx differ diff --git "a/doc/\345\260\217\347\250\213\345\272\217\346\226\207\344\273\266\345\221\275\345\220\215\344\273\245\345\217\212\346\216\245\345\217\243\350\260\203\347\224\250\350\257\264\346\230\216.xlsx" "b/doc/\345\260\217\347\250\213\345\272\217\346\226\207\344\273\266\345\221\275\345\220\215\344\273\245\345\217\212\346\216\245\345\217\243\350\260\203\347\224\250\350\257\264\346\230\216.xlsx" index 6a0e46c..88556e7 100644 Binary files "a/doc/\345\260\217\347\250\213\345\272\217\346\226\207\344\273\266\345\221\275\345\220\215\344\273\245\345\217\212\346\216\245\345\217\243\350\260\203\347\224\250\350\257\264\346\230\216.xlsx" and "b/doc/\345\260\217\347\250\213\345\272\217\346\226\207\344\273\266\345\221\275\345\220\215\344\273\245\345\217\212\346\216\245\345\217\243\350\260\203\347\224\250\350\257\264\346\230\216.xlsx" differ diff --git "a/doc/\346\216\245\345\217\243\346\226\207\346\241\243 V1.0.xls" "b/doc/\346\216\245\345\217\243\346\226\207\346\241\243 V1.0.xls" index 885de0a..e813f5e 100644 Binary files "a/doc/\346\216\245\345\217\243\346\226\207\346\241\243 V1.0.xls" and "b/doc/\346\216\245\345\217\243\346\226\207\346\241\243 V1.0.xls" differ diff --git a/src/user/if/ajax_get_donation_event_detail.php b/src/user/if/ajax_get_donation_event_detail.php new file mode 100644 index 0000000..2b919d9 --- /dev/null +++ b/src/user/if/ajax_get_donation_event_detail.php @@ -0,0 +1,66 @@ +<?php + +// 获取募捐详细信息 +require_once ("../user_include.inc"); + +ErrorLogger::doOutput("Compass...ajax_get_donation_event_list.php....Start.", 0); + +//获取参数 +$unionId = ParamUtil::getRequestString("unionId"); +$eventId = ParamUtil::getRequestNumber("eventId", 0); + +//判断用户是否存在 +$param = array(); +$param['unionid'] = $unionId; +$param['delete_flg'] = false; +$userList = UserMst::getList($param,'id','desc', 0, 1); +if(empty($userList)) { + $result["message"] = "用户不存在!"; + responseNG($result); +} + +//判断募捐活动是否存在 +$donationEventDat = DonationsEventDat::getById($eventId); +if(empty($donationEventDat)) { + $result["message"] = "参数错误!"; + responseNG($result); +} + +//查询捐款人员名单 +$userDonationList = array(); +$param = array(); +$param['donation_id'] = $donationEventDat->id; +$param['status'] = "SUCCESS";//只显示支付成功的记录 +$param['delete_flg'] = false; +$tmpList = UserDonationDat::getList($param,'id','desc'); +if(!empty($tmpList)) { + foreach($tmpList as $tmp) { + $userMst = UserMst::getById($tmp->id); + if(!empty($userMst)) { + $userDonationList[] = array("name"=>$userMst->name, "money"=>$tmp->money); + } + } +} + +//组装返回数据 +$result["donationEventDat"] = $donationEventDat; +$result["userDonationList"] = $userDonationList; + + +ErrorLogger::doOutput("Compass...ajax_get_donation_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 diff --git a/src/user/if/ajax_get_donation_event_list.php b/src/user/if/ajax_get_donation_event_list.php new file mode 100644 index 0000000..53e6aa8 --- /dev/null +++ b/src/user/if/ajax_get_donation_event_list.php @@ -0,0 +1,66 @@ +<?php + +// 获取募捐列表 +require_once ("../user_include.inc"); + +ErrorLogger::doOutput("Compass...ajax_get_donation_event_list.php....Start.", 0); + +//获取参数 +$unionId = ParamUtil::getRequestString("unionId"); +$page = ParamUtil::getRequestNumber("page", 0); + +//参数验证 +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"] = "用户不存在!"; + responseOK($result); +} + +//每页显示条数 +$rowCount = 10; + +$result = array(); + +$offset = $page * $rowCount; + +//检索数据库 +$param = array(); +$param['status_NOT'] = 'NEW'; +$param['status_NOT'] = 'NG'; +$param['delete_flg'] = false; +$donationEventlist = DonationsEventDat::getList($param,'id','desc', $offset, $rowCount); +$allCount = DonationsEventDat::getListCount($param); + +//接口返回数据 +$result["allCount"] = $allCount; +$result["page"] = $page; +$result["rowCount"] = $rowCount; +$result["list"] = $donationEventlist; + + +ErrorLogger::doOutput("Compass...ajax_get_donation_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 diff --git a/src/user/if/ajax_set_circle_event_new.php b/src/user/if/ajax_set_circle_event_new.php index 1619c4b..24f36fe 100644 --- a/src/user/if/ajax_set_circle_event_new.php +++ b/src/user/if/ajax_set_circle_event_new.php @@ -10,28 +10,66 @@ $unionId = ParamUtil::getRequestString("unionId"); $circleId = ParamUtil::getRequestNumber("circleId", 0);//圈子id $title = ParamUtil::getRequestString("title");//活动标题 $comment = ParamUtil::getRequestString("comment");//活动内容描述 -$start_time = ParamUtil::getRequestString("start_time");//活动开始时间 -$finish_time = ParamUtil::getRequestString("finish_time");//活动结束时间 -$enroll_time = ParamUtil::getRequestString("enroll_time");//截止报名时间 -$front_image = ParamUtil::getRequestString("front_image");//活动封面图片 +$startTime = ParamUtil::getRequestString("startTime");//活动开始时间 +$finishTime = ParamUtil::getRequestString("finishTime");//活动结束时间 +$enrollTime = ParamUtil::getRequestString("enrollTime");//截止报名时间 +$frontImage = ParamUtil::getRequestString("frontImage");//活动封面图片 $position = ParamUtil::getRequestString("position");//活动地点 -$position_longitude = ParamUtil::getRequestString("position_longitude");//活动地点经度 -$position_latitude = ParamUtil::getRequestString("position_latitude");//活动地点纬度 -$include_social_user = ParamUtil::getRequestBoolean("include_social_user");//是否允许社会人士参加 -$max_member = ParamUtil::getRequestNumber("max_member");//最大参加人数 -$time_length = ParamUtil::getRequestString("time_length");//活动时长 -$leader_name = ParamUtil::getRequestString("leader_name");//负责人姓名 -$leader_contact = ParamUtil::getRequestString("leader_contact");//负责人联系方式 +$includeSocialUser = ParamUtil::getRequestBoolean("includeSocialUser");//是否允许社会人士参加 +$maxMember = ParamUtil::getRequestNumber("maxMember");//最大参加人数 +$timeLength = ParamUtil::getRequestString("timeLength");//活动时长 +$leaderName = ParamUtil::getRequestString("leaderName");//负责人姓名 +$leaderContact = ParamUtil::getRequestString("leaderContact");//负责人联系方式 $venue = ParamUtil::getRequestString("venue");//集合地点 -$venue_time = ParamUtil::getRequestString("venue_time");//集合时间 +$venueTime = ParamUtil::getRequestString("venueTime");//集合时间 $result = array(); //参数检查 -if(empty($unionId) || empty($circleId)|| empty($title)|| empty($position)|| empty($venue)) { +if(empty($unionId) || empty($circleId)) { $result["message"] = "参数错误!"; responseNG($result); } +if(empty($title) ) { + $result["message"] = "请输入活动标题!"; + responseNG($result); +} +if(empty($position) ) { + $result["message"] = "请输入活动地点!"; + responseNG($result); +} +if($maxMember < 1) { + $result["message"] = "请正确设定参加人数!"; + responseNG($result); +} +if(empty($startTime) ) { + $result["message"] = "请输入活动开始时间!"; + responseNG($result); +} +if(empty($finishTime) ) { + $result["message"] = "请输入活动结束时间!"; + responseNG($result); +} +if(empty($frontImage) ) { + $result["message"] = "请上传封面图片!"; + responseNG($result); +} +if(empty($venue) ) { + $result["message"] = "请输入集合地点!"; + responseNG($result); +} +if(empty($timeLength) ) { + $result["message"] = "请输入活动时长!"; + responseNG($result); +} +if(empty($venueTime) ) { + $result["message"] = "请输入集合时间!"; + responseNG($result); +} +if(empty($_FILES['frontImage']['tmp_name'])){ + $result["message"] = "请选择活动封面!"; + responseNG($result); +} $result = array(); @@ -59,27 +97,78 @@ if($circleDat->owner_id != $userMst->id) { responseNG($result); } -//发布公告 -$noticeDat = new CircleNoticeDat(); -$noticeDat->circle_id = $circleDat->id; -$noticeDat->title = $title; -$noticeDat->comment = $comment; -//上传图片到阿里云oss +//判断输入的活动地点是否合法 +$addressUrl = 'https://apis.map.qq.com/ws/geocoder/v1/?address=' . $position . '&key=' . LBS_KEY; +$lbsObj = file_get_contents($addressUrl); +$jsonObj = json_decode($lbsObj); //对JSON格式的字符串进行编码 +$lbsArray = get_object_vars($jsonObj);//转换成数组 +if($lbsArray['status'] != 0) { + $result["message"] = "请输入完整的活动地点!"; + responseNG($result); +} +$resultObj = $lbsArray['result']; + +print_r($resultObj->address_components); + +$positionLongitude = $resultObj->location->lng;//活动地点经度 +$positionLatitude = $resultObj->location->lat;//活动地点纬度 +$province = $resultObj->address_components->province; +$city = $resultObj->address_components->city; +$district = $resultObj->address_components->district; + +//是否有正在审核的活动 +$param = array(); +$param['circle_id'] = $circleDat->id; +$param['status'] = "NEW"; +$param['delete_flg'] = false; +$volunteerEventList = VolunteerEventDat::getList($param, "id", "desc", 0, 1); +if(!empty($volunteerEventList)) { + $result["message"] = "已经有一条活动待审核!"; + responseNG($result); +} + +//登陆活动数据 +$volunteerEventDat = new VolunteerEventDat(); +$volunteerEventDat->title = $title; +$volunteerEventDat->comment = $comment; +$volunteerEventDat->start_time = $startTime; +$volunteerEventDat->finish_time = $finishTime; +$volunteerEventDat->enroll_time = $enrollTime; +$volunteerEventDat->position = $position; +$volunteerEventDat->position_longitude = $positionLongitude; +$volunteerEventDat->position_latitude = $positionLatitude; +$volunteerEventDat->position_latitude = $positionLatitude; +$volunteerEventDat->circle_id = $circleDat->id; +$volunteerEventDat->province = $province; +$volunteerEventDat->city = $city; +$volunteerEventDat->district = $district; +$volunteerEventDat->include_social_user = $includeSocialUser; +$volunteerEventDat->max_member = $maxMember; +$volunteerEventDat->time_length = $timeLength; +$volunteerEventDat->leader_name = $leaderName; +$volunteerEventDat->leader_contact = $leaderContact; +$volunteerEventDat->venue = $venue; +$volunteerEventDat->venue_time = $venueTime; +$volunteerEventDat->status = 'NEW'; +$volunteerEventDat->author = $userMst->name; +//处理上传图片 $aliHandler = new AliUploadHandler(); -if(!empty($_FILES['image']['tmp_name'])){ - $upload_file = FileUploadUtil::getScalarFile(@$_FILES['image']); +if(!empty($_FILES['frontImage']['tmp_name'])){ + $upload_file = FileUploadUtil::getScalarFile(@$_FILES['frontImage']); $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); ErrorLogger::doOutput($url); //这里的url就是http://compass-dev.oss-cn-beijing.aliyuncs.com/20200220_aa.jpg - $noticeDat->image = $url; + $volunteerEventDat->front_image = $url; } -$noticeDat->save(); +//$volunteerEventDat->front_image = 'testimage.jpg'; +$volunteerEventDat->save(); + ErrorLogger::doOutput("Compass...ajax_set_circle_event_new.php....End.", 0); //返回结果 -$result["message"] = "发布成功!"; +$result["message"] = "发布成功,请等待审核!"; responseOK($result); function responseNG($result) { diff --git a/src/user/if/ajax_set_user_donation_dat.php b/src/user/if/ajax_set_user_donation_dat.php new file mode 100644 index 0000000..27b53bb --- /dev/null +++ b/src/user/if/ajax_set_user_donation_dat.php @@ -0,0 +1,81 @@ +<?php + +// 用户募捐支付接口 +require_once ("../user_include.inc"); + +ErrorLogger::doOutput("Compass...ajax_set_user_donation_dat.php.php....Start.", 0); + +//获取参数 +$unionId = ParamUtil::getRequestString("unionId"); +$eventId = ParamUtil::getRequestNumber("eventId", 0); +$eventId = ParamUtil::getRequestNumber("eventId", 0); +$eventId = ParamUtil::getRequestNumber("eventId", 0); + +$result = array(); + +//参数检查 +if(empty($unionId) || empty($circleId)|| empty($title)|| empty($comment)) { + $result["message"] = "参数错误!"; + responseNG($result); +} + +$result = array(); + +//判断用户是否存在 +$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); +} + +//判断是否为圈主 +if($circleDat->owner_id != $userMst->id) { + $result["message"] = "圈主才有权限发公告!"; + responseNG($result); +} + +//发布公告 +$noticeDat = new CircleNoticeDat(); +$noticeDat->circle_id = $circleDat->id; +$noticeDat->title = $title; +$noticeDat->comment = $comment; +//上传图片到阿里云oss +$aliHandler = new AliUploadHandler(); +if(!empty($_FILES['image']['tmp_name'])){ + $upload_file = FileUploadUtil::getScalarFile(@$_FILES['image']); + $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); + ErrorLogger::doOutput($url); + //这里的url就是http://compass-dev.oss-cn-beijing.aliyuncs.com/20200220_aa.jpg + $noticeDat->image = $url; +} +$noticeDat->save(); +ErrorLogger::doOutput("Compass...ajax_set_user_donation_dat.php.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 diff --git a/src/user/if/ajax_social_user_register2.php b/src/user/if/ajax_social_user_register2.php index a892624..267bcfc 100644 --- a/src/user/if/ajax_social_user_register2.php +++ b/src/user/if/ajax_social_user_register2.php @@ -34,7 +34,7 @@ $param['openid'] = $openId; $param['unionid'] = $unionId; $param['delete_flg'] = false; $userList = UserMst::getList($param,'id','desc', 0, 1); -if(!empty($userList)) { +if(empty($userList)) { $result["message"] = "用户不存在!"; responseOK($result); } -- libgit2 0.27.0