作者 sgj
1 个管道 的构建 通过 耗费 2 秒

修改自动部署内容

... ... @@ -211,6 +211,10 @@ class IndexController extends RestBaseController
* @return thumbnail:缩略图
* @return time:时间
* @return content:内容
* @return button_title:按钮标题
* @return join:参加用户@
* @begin photo:照片 name:名称 level:星级
* @return content_status:按钮状态6.用户是志愿者,但是未报名参加活动5.已结束(活动过期)4.已签到(用户是志愿者,已报名活动,已通过审核,已签到)3.签到(用户是志愿者,已报名活动,选择线下或线上+线下,已通过审核,按钮变为签到但不可点击,活动有效时间内,变为可点击状态)2.待审核(用户是志愿者,已报名活动,但是未通过审核)1.报名 (用户是志愿者,但是未报名参加活动)
*/
public function activity_info(){
$id = $this->request->param('id');
... ... @@ -219,15 +223,96 @@ class IndexController extends RestBaseController
$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;
$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;
}elseif($join['status']=='2'){
$is_book=0;
$is_pass=0;
}
$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);
foreach ($people as $k=>$v){
$join[$k]['photo']=$v['photo'];
$join[$k]['name']=$v['name'];
$join[$k]['level']=$v['level'];
}
$activity['join']=$join;
$this->success('获取成功!',$activity);
}
}
\ No newline at end of file
... ...
... ... @@ -17,4 +17,32 @@ class JoinModel extends Model
$data=$this->where($where)->find();
return $data;
}
/**
* 查询多条
* @param $where
* @return array
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\ModelNotFoundException
* @throws \think\exception\DbException
*/
public function selectData($where){
$data=$this->where($where)->select()->toArray();
return $data;
}
public function getJoinData($activity_id){
$where['j.activity_id']=$activity_id;
$where['j.delete_time']=0;
$info=$this->alias('j')
->join('cmf_volunteer v','v.user_id=j.user_id')
->where($where)
//->fetchSql()
->select()
->toArray();
//->toArray();
//dump($info);
return $info;
}
}
\ No newline at end of file
... ...