Commit d449fd17 by biao

111

parent 53dd8ac3
......@@ -391,6 +391,7 @@ CREATE TABLE IF NOT EXISTS volunteer_event_dat(
position_longitude text NOT NULL,
position_latitude text NOT NULL,
account_id int8 NOT NULL DEFAULT '0',
circle_id int8 NOT NULL DEFAULT '0',
author varchar(64) NOT NULL,
author_role int8 NOT NULL DEFAULT '0',
auditor_id int8,
......
......@@ -18,6 +18,7 @@ class VolunteerEventDat extends CompassDynamicData
var $position_longitude;
var $position_latitude;
var $account_id;
var $circle_id;
var $author;
var $author_role;
var $auditor_id;
......@@ -58,6 +59,7 @@ class VolunteerEventDat extends CompassDynamicData
$this->position_longitude = $record["position_longitude"];
$this->position_latitude = $record["position_latitude"];
$this->account_id = $record["account_id"];
$this->circle_id = $record["circle_id"];
$this->author = $record["author"];
$this->author_role = $record["author_role"];
$this->auditor_id = $record["auditor_id"];
......@@ -150,6 +152,7 @@ class VolunteerEventDat extends CompassDynamicData
ParamUtil::copyObj2Array($v_param, $this, "position_longitude");
ParamUtil::copyObj2Array($v_param, $this, "position_latitude");
ParamUtil::copyObj2Array($v_param, $this, "account_id");
ParamUtil::copyObj2Array($v_param, $this, "circle_id");
ParamUtil::copyObj2Array($v_param, $this, "author");
ParamUtil::copyObj2Array($v_param, $this, "author_role");
ParamUtil::copyObj2ArrayNullField($v_param, $this, "auditor_id");
......
<?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
$result = array();
//参数检查
if(empty($unionId) || empty($circleId)) {
$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);
}
//是否为圈主
$isOwner = false;
if($circleDat->owner_id == $userMst->id) {
$isOwner = true;
}
//查询发布的志愿者活动
$param = array();
$param['circle_id'] = $circleDat->id;
//圈主可以查看所有活动,成员只能查看审核成功的活动
if(!$isOwner) {
$param['status_NOT'] = "NEW";
$param['status_NOT'] = "NG";
}
$param['delete_flg'] = false;
$volunteerEventList = VolunteerEventDat::getList($param, "id", "desc");
if(!empty($tmpList)) {
$noticeDat = $tmpList[0];
}
ErrorLogger::doOutput("Compass...ajax_get_circle_event_list.php....End.", 0);
//返回结果
$result["isOwner"] = $isOwner;
$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;
}
?>
\ No newline at end of file
......@@ -28,6 +28,7 @@ if(empty($userList)) {
$result["message"] = "用户不存在!";
responseNG($result);
}
$userMst = $userList[0];
//判断圈子是否存在
$circleDat = CircleDat::getById($circleId);
......@@ -36,6 +37,11 @@ if(empty($circleDat)) {
responseNG($result);
}
$isOwner = false;
if($circleDat->owner_id == $userMst->id) {
$isOwner = true;
}
$noticeDat = null;
//获取圈子最新一条公告信息
$param = array();
......@@ -50,6 +56,7 @@ if(!empty($tmpList)) {
ErrorLogger::doOutput("Compass...ajax_get_circle_info.php....End.", 0);
//返回结果
$result["isOwner"] = $isOwner;
$result["circleDat"] = $circleDat;
$result["noticeDat"] = $noticeDat;
responseOK($result);
......
......@@ -53,7 +53,8 @@ if(!empty($tmpList)) {
$param = array();
$param['school_no'] = $schoolNo;
$param['original_source'] = $originalSource;
$param['status'] = "OK";
$param['status_NOT'] = "NEW";
$param['status_NOT'] = "NG";
$param['delete_flg'] = false;
$volunteerEventList = VolunteerEventDat::getList($param,'id','desc');
......
......@@ -18,7 +18,6 @@ if(empty($unionId)) {
responseNG($result);
}
//判断用户是否存在
$param = array();
$param['unionid'] = $unionId;
......@@ -31,8 +30,6 @@ if(empty($userList)) {
$userMst = $userList[0];
//接口返回数据
$result["role"] = $userMst->role;
$result["schoolOwner"] = $userMst->school_owner;
......
<?php
// 圈主发布志愿者活动
require_once ("../user_include.inc");
ErrorLogger::doOutput("Compass...ajax_set_circle_event_new.php....Start.", 0);
//获取参数
$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");//活动封面图片
$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");//负责人联系方式
$venue = ParamUtil::getRequestString("venue");//集合地点
$venue_time = ParamUtil::getRequestString("venue_time");//集合时间
$result = array();
//参数检查
if(empty($unionId) || empty($circleId)|| empty($title)|| empty($position)|| empty($venue)) {
$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_circle_event_new.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
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