123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124 |
- <?php
- namespace app\h5\controller;
- use app\hander\HelpHander;
- use think\Controller;
- use think\Db;
- use think\Exception;
- class MeetingScreen extends Controller
- {
- private $meetingId;
- private $token;
- public function __construct()
- {
- parent::__construct();
- $this->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][] = '<span style="color:#FFDA0A;font-size: 20px">'.($k+1).'</span>';
- $data[$k][] = '<span style="color:#FFDA0A;font-size: 20px">'.$v['user_name'].'</span>';
- $data[$k][] = '<span style="color:#FFDA0A;font-size: 20px">'.$v['start_time'].'</span>';
- $data[$k][] = '<span style="color:#FFDA0A;font-size: 20px">'.$v['end_time'].'</span>';
- $data[$k][] = '<span style="color:#FFDA0A;font-size: 20px">'.$v['statusTxt'].'</span>';
- }else{
- $data[$k][] = '<span style="font-size: 20px">'.($k+1).'</span>';
- $data[$k][] = '<span style="font-size: 20px">'.$v['user_name'].'</span>';
- $data[$k][] = '<span style="font-size: 20px">'.$v['start_time'].'</span>';
- $data[$k][] = '<span style="font-size: 20px">'.$v['end_time'].'</span>';
- $data[$k][] = '<span style="font-size: 20px">'.$v['statusTxt'].'</span>';
- }
- }
- 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);
- }
- }
|