...
|
...
|
@@ -314,5 +314,94 @@ class IndexController extends RestBaseController |
|
|
$this->success('获取成功!',$activity);
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* @title 签到
|
|
|
* @description 活动签到
|
|
|
* @author Xiaogang Wang
|
|
|
* @url /index/index/sginIn
|
|
|
* @method GET
|
|
|
*
|
|
|
* @header name:XX-Token require:1 default: desc:token
|
|
|
*
|
|
|
* @param name:id type:int require:1 other: desc:活动id
|
|
|
*
|
|
|
*/
|
|
|
public function sginIn(){
|
|
|
$userId=$this->getUserId();
|
|
|
$activity_id=input('activity_id');
|
|
|
$Join=new JoinModel();
|
|
|
$where['user_id']=$userId;
|
|
|
$where['activity_id']=$activity_id;
|
|
|
$join=$Join->findData($where);
|
|
|
if (empty($join)){
|
|
|
$this->error('您还未报名此活动');
|
|
|
}
|
|
|
if ($join['status']==3){
|
|
|
$this->error('您已经签到过了');
|
|
|
}
|
|
|
if ($join['status']==2||$join['status']==0){
|
|
|
$this->error('还没有通过审核');
|
|
|
}
|
|
|
if ($join['status']==1){
|
|
|
$data['sgin_time']=time();
|
|
|
$data['status']=3;
|
|
|
$result=$Join->update($data,$where);
|
|
|
if ($result==0){
|
|
|
$this->error('签到失败');
|
|
|
}
|
|
|
}
|
|
|
$this->success('签到成功!');
|
|
|
}
|
|
|
|
|
|
|
|
|
/**
|
|
|
* @title 申请活动
|
|
|
* @description 活动申请
|
|
|
* @author Xiaogang Wang
|
|
|
* @url /index/index/applyJoin
|
|
|
* @method GET
|
|
|
*
|
|
|
* @header name:XX-Token require:1 default: desc:token
|
|
|
*
|
|
|
* @param name:id type:int require:1 other: desc:活动id
|
|
|
* @param name:type type:int require:1 other: desc:活动类型1:线上2:线下3:线上+线下
|
|
|
* @param name:start_time type:int require:1 other: desc:开始时间
|
|
|
* @param name:end_time type:int require:1 other: desc:结束时间
|
|
|
*
|
|
|
*/
|
|
|
public function applyJoin(){
|
|
|
$userId=$this->getUserId();
|
|
|
$activity_id=input('id');
|
|
|
$type=input('type');
|
|
|
$start_time=input('start_time');
|
|
|
$end_time=input('end_time');
|
|
|
$activity_id=input('id');
|
|
|
/*判断是否未志愿者*/
|
|
|
$Volunteer=new VolunteerModel();
|
|
|
$where['user_id']=$userId;
|
|
|
$volunter=$Volunteer->findData($where);
|
|
|
if (empty($volunter)){
|
|
|
$this->error('请先成为志愿者!');
|
|
|
}
|
|
|
/*判断是否参加了活动*/
|
|
|
$Join=new JoinModel();
|
|
|
$map['user_id']=$userId;
|
|
|
$map['activity_id']=$activity_id;
|
|
|
$join=$Join->findData($map);
|
|
|
if ($join){
|
|
|
$this->error('已经报名参加过该活动!');
|
|
|
}
|
|
|
$data['user_id']=$userId;
|
|
|
$data['activity_id']=$activity_id;
|
|
|
$data['type']=$type;
|
|
|
$data['start_time']=$start_time;
|
|
|
$data['end_time']=$end_time;
|
|
|
$result=$Join->insert($data);
|
|
|
if ($result>0){
|
|
|
$this->success('报名成功,请等待审核!');
|
|
|
}
|
|
|
$this->error('报名失败');
|
|
|
}
|
|
|
|
|
|
|
|
|
} |
|
|
\ No newline at end of file |
...
|
...
|
|