作者 sgj
1 个管道 的构建 失败 耗费 1 秒

添加新闻详情页面

... ... @@ -321,6 +321,128 @@ class IndexController extends RestBaseController
$activity['join']=$join1;
$this->success('获取成功!',$activity);
}
/**
* @title 新闻详情
* @description 新闻详情
* @author Xiaogang Wang
* @url /index/index/news_info
* @method GET
*
* @header name:XX-Token require:1 default: desc:token
*
* @param name:id type:int require:1 other: desc:活动id
*
* @return id:id
* @return activity_name:活动名称
* @return abstract:摘要
* @return thumbnail:缩略图
* @return time:时间
* @return content:内容
* @return button_title:按钮标题
* @return join:参加用户@
* @join photo:照片 name:名称 level:星级
* @return button_status:按钮状态6.用户是志愿者,但是未报名参加活动5.已结束(活动过期)4.已签到(用户是志愿者,已报名活动,已通过审核,已签到)3.签到(用户是志愿者,已报名活动,选择线下或线上+线下,已通过审核,按钮变为签到但不可点击,活动有效时间内,变为可点击状态)2.待审核(用户是志愿者,已报名活动,但是未通过审核)1.报名 (用户是志愿者,但是未报名参加活动)
*/
public function news_info(){
$id = $this->request->param('id');
//活动
$activityModel = new ActivityNewsModel();
$userId=$this->getUserId();
$activity = $activityModel->findData(array('id'=>$id));
/*获取状态*/
/*是否为志愿者*/
$Volunteer=new VolunteerModel();
$volunteerMap['user_id']=$userId;
$volunteerMap['status']=2;
$volunteerMap['delete_time']=0;
$volunteer=$Volunteer->findData($volunteerMap);
if (empty($volunteer)){
$is_volunteer=0;
}else{
$is_volunteer=1;
}
/*是否活动结束*/
$Activity=new ActivityModel();
$activityMap['id']=$id;
$activity=$Activity->findData($activityMap);
if($activity['end_time']>time()){
$is_end=1;
}else{
$is_end=0;
}
/*是否报名活动*/
$Join=new JoinModel();
$where['activity_id']=$id;
$where['user_id']=$userId;
$where['delete_time']=0;
$join=$Join->findData($where);
if (empty($join)){
$is_join=0;
}else{
$is_join=1;
}
/*是否报名通过*/
if (empty($join['status']) || $join['status']==2){
$is_pass=0;
$is_book=0;
}elseif($join['status']=='3'){
$is_book=1;
$is_pass=1;
}elseif($join['status']=='1'){
$is_book=0;
$is_pass=1;
}
$check=0;
if ($is_volunteer==0 && $check==0) {
$status=6;
$check=1;
$title='成为志愿者';
}
if ($is_end==1 && $check==0){
$status=5;
$title='已结束';
$check=1;
}
if ($is_volunteer==1 && $check==0 && $is_pass==1 && $is_book==1){
$status=4;
$title='已签到';
$check=1;
}
if ($is_volunteer==1 && $check==0 && $is_join==1 && $is_pass==1 && $is_book==0){
$status=3;
$title='签到';
$check=1;
}
if ($is_volunteer==1 && $check==0 && $is_join==1 && $is_pass==0){
$status=2;
$title='待审核';
$check=0;
}
if ($is_volunteer==1 && $check==0 && $is_join==0){
$status=1;
$title='报名';
$check=0;
}
$activity['button_title']=$title;
$activity['button_status']=$status;
$people=$Join->getJoinData($id);
$join1=[];
foreach ($people as $k=>$v){
$join1[$k]['photo']=$v['photo'];
$join1[$k]['name']=$v['name'];
$join1[$k]['level']=$v['level'];
}
$activity['join']=$join1;
$this->success('获取成功!',$activity);
}
/**
* @title 签到
... ...