token = input('token');
if(empty($this->token)){
$this->redirect(url('index/errorPage'));
}
$this->meetingId = think_decrypt($this->token);
if($this->meetingId < 1){
$this->redirect(url('index/errorPage'));
}
}
public function index(){
$info = Db::name('meeting_room')->where('id',$this->meetingId)->find();
$status = $this->curStatus();
$this->assign('info',$info);
$this->assign('status',$status);
$this->assign('meetingId',$this->token);
return $this->fetch();
}
public function meetingList(){
$curTime = date('Y-m-d H:i:s');
$list = Db::name('meeting_apply')
->where('meeting_room_id',$this->meetingId)
->where('del',0)
->where('start_time', '>=',date('Y-m-d 00:00:00'))
->where('end_time', '<=',date('Y-m-d 23:59:59'))
->where('status',1)
->select();
foreach ($list as $k=>$v){
$statusTxt = '';
$st = 0;
if($v['start_time'] > $curTime){
$statusTxt = '未开始';
$st = 1;
} else if($v['start_time'] <= $curTime && $v['end_time'] >= $curTime){
$statusTxt = '会议中';
$st = 2;
}else if($curTime > $v['end_time']){
$statusTxt = '已结束';
$st = 3;
}
$list[$k]['statusTxt'] = $statusTxt;
$list[$k]['st'] = $st;
$list[$k]['user_name'] = Db::name('user')->where('id',$v['user_id'])->value('real_name');
}
$data = [];
foreach ($list as $k=>$v){
if($v['st'] == 2){
$data[$k][] = ''.($k+1).'';
$data[$k][] = ''.$v['user_name'].'';
$data[$k][] = ''.$v['start_time'].'';
$data[$k][] = ''.$v['end_time'].'';
$data[$k][] = ''.$v['statusTxt'].'';
}else{
$data[$k][] = ''.($k+1).'';
$data[$k][] = ''.$v['user_name'].'';
$data[$k][] = ''.$v['start_time'].'';
$data[$k][] = ''.$v['end_time'].'';
$data[$k][] = ''.$v['statusTxt'].'';
}
}
HelpHander::success($data);
}
public function meetingStatus(){
$status = $this->curStatus();
HelpHander::success($status);
}
public function curStatus(){
$curTime = date('Y-m-d H:i:s');
$list = Db::name('meeting_apply')
->where('meeting_room_id',$this->meetingId)
->where('del',0)
->where('start_time', '>=',date('Y-m-d 00:00:00'))
->where('end_time', '<=',date('Y-m-d 23:59:59'))
->where('status',1)
->select();
$status = 0;
foreach ($list as $k=>$v){
if($v['start_time'] <= $curTime && $v['end_time'] >= $curTime){
$status = 1;
}
}
return $status;
}
//二维码
public function qrcode() {
$info = Db::name('meeting_room')->where('id', $this->meetingId)->find();
if (!$info) {
exit('数据不存在');
}
$code = get_qrcode_str('meeting', $this->meetingId);
$this->success('','',$code);
}
}