Przeglądaj źródła

会议室bug修改

q 1 rok temu
rodzic
commit
a62b7f767a

+ 1 - 1
webmain/flow/page/input_meeting.html

@@ -48,7 +48,7 @@
                 <tbody>
                 <tr>
                     <td width="10%">序号</td>
-                    <td>*会议议题</td>
+                    <td>会议议题</td>
                     <td>参与人员</td>
                     <td width="5%">操作</td>
                 </tr>

+ 51 - 43
webmain/model/flow/meetingModel.php

@@ -8,7 +8,7 @@ class flow_meetingClassModel extends flowModel
     public function initModel()
     {
         $this->hyarra 	= array('正常','会议中','结束','取消');
-        $this->ytarra 	= array('待进行','待进行','进行中','已进行');
+        $this->ytarra 	= array('待进行','待进行','进行中','已结束');
         $this->hyarrb 	= array('green','blue','#ff6600','#888888');
         $this->dbobj	= c('date');
 
@@ -30,7 +30,13 @@ class flow_meetingClassModel extends flowModel
     protected function flowsubdata($rows, $lx=0){
 
         for ($i = 0; $i < count($rows); $i++) {
-            $rows[$i]['topic_state'] = $this->ytarra[$rows[$i]['topic_state'] ?? 1];
+            if (isset($rows[$i]['topic_state']) && !empty($rows[$i]['topic_state'])) {
+                $index = $rows[$i]['topic_state'] ?? 1;
+                $rows[$i]['topic_state'] = $this->ytarra[$index];
+            } else {
+                $id = isset($rows[$i]['id']);
+                m('meeting_topics')->update(['topic_state'=>1], "id={$id}");
+            }
         }
         return $rows;
     }
@@ -41,8 +47,9 @@ class flow_meetingClassModel extends flowModel
     {
 
 //        m('log')->addlog('会议单据', json_encode($rs, true));
-        
+
         $zt 		 = $rs['state'];
+        $is_hand 	 = $rs['is_hand'];
         $nzt 		 = $zt;
         $time 		 = time();
 
@@ -50,22 +57,19 @@ class flow_meetingClassModel extends flowModel
         $etime 	= strtotime($rs['end_time']);
 
 
-//        if($zt < 2){
-            if($etime<$time){
+        if($is_hand != 2){
+            if($etime < $time){
                 $nzt = 2;
-            }else if($stime>$time){
-                // 开始时间大于当前时间,认为会议开始
+            } else if ($stime > $time){
                 $nzt = 0;
-            }else{
+            } else {
                 $nzt = 1;
             }
-//        }
-
+        }
 
-//        if ($nzt != 2 || $nzt != 3) {
-//            // 状态不是取消、结束,则赋值“正常”
-//            $nzt = 1;
-//        }
+        if ($stime <= $time && $nzt != 2){
+            $nzt = 1;
+        }
 
         // 更新数据状态
         if($zt != $nzt){
@@ -91,37 +95,44 @@ class flow_meetingClassModel extends flowModel
         // 切换会议议题
         if ($ors['num'] == 'changeTopic') {
             $topics = $this->db->getall("select * from `[Q]meeting_topics` where mid = {$this->id} order by sort");
-            $have_state = False;
-            // 查找状态为1的
-            for ($i = 0; $i < count($topics); $i++) {
-                $data = $topics[$i];
-                if (isset($data['id'])) {
-                    if ($data['topic_state'] == 1) {
-                        $have_state = True;
-                        m('meeting_topics')->update(['topic_state'=>$data['topic_state']+1], "id={$data['id']}");
-                    } else {
-                        continue;
-                    }
-
-                    if (isset($topics[$i - 1])) {
-                        $topics[$i-1]['topic_state'] = $data['topic_state']+2;
-                        $id = $topics[$i-1]['id'];
-                        m('meeting_topics')->update(['topic_state'=>$data['topic_state']+2], "id={$id}");
-                    }
 
-                    if (isset($topics[$i + 1])) {
-                        $topics[$i+1]['topic_state'] = 1;
+            for ($i = 0; $i < count($topics); $i++) {
+                if(isset($topics[$i]['topic_state']) && $topics[$i]['topic_state'] == 2) {
+                    $id = $topics[$i]['id'];
+                    $data = ['topic_state'=>$topics[$i]['topic_state']+1];
+                    m('meeting_topics')->update($data, "id={$id}");
+                    if (isset($topics[$i+1]['topic_state'])) {
                         $id = $topics[$i+1]['id'];
-                        m('meeting_topics')->update(['topic_state'=>1], "id={$id}");
+                        $data = ['topic_state'=>2];
+                        m('meeting_topics')->update($data, "id={$id}");
                     }
                     break;
                 }
             }
-            if (!$have_state && $topics[0]['topic_state'] < 1) {
-                m('meeting_topics')->update(['topic_state'=>1], "id={$topics[0]['id']}");
-            } else if (!$have_state && $data['topic_state'] == 2) {
-                m('meeting_topics')->update(['topic_state'=>3], "id={$data['id']}");
+
+            if (isset($topics[count($topics) - 1]) && $topics[count($topics) - 1]['topic_state'] == 2) {
+                m('meeting')->update(['is_hand'=>2,'state'=>2], "id={$this->id}");
+            }
+
+        } else if ($ors['num'] == 'enableMeeting') {
+
+            $time 		 = time();
+
+            $stime 	= strtotime($this->rs['meeting_time']);
+            $etime 	= strtotime($this->rs['end_time']);
+
+            if ($stime < $time){
+                $data = [
+                    'state'=>1,
+                    'is_hand'=>2
+                ];
+            } else if ($stime >= $time) {
+                $data = [
+                    'state'=>0,
+                    'is_hand'=>2
+                ];
             }
+            m('meeting')->update($data, "id={$this->id}");
         }
     }
 
@@ -134,11 +145,8 @@ class flow_meetingClassModel extends flowModel
     //流程全部完成后调用
     public function flowcheckfinsh($sm) {
 
-        // 获取议题信息
-        $topics = $this->db->getall("select `id`, `topic_title`, `topic_attendee`, `topic_attendee_id`, `topic_state` from `[Q]meeting_topics` where mid = {$this->id} order by sort");
-        if (isset($topics['id'])) {
-            m('meeting')->update(['topic_state'=>'1'], "id={$topics[0]['id']}");
-        }
+        // 会议议题状态全部设置为1
+        m('meeting_topic')->update(['topic_state'=>'1'], 'mid='.$this->id);
 
     }
 

+ 3 - 57
webmain/task/openapi/openmeetAction.php

@@ -25,7 +25,7 @@ class openmeetClassAction extends openapiAction
 
         $rawData = m('meeting_room')->getone(" mac like '%{$rawArr['device_id']}%'", "id, room_name");
 
-        $meetData = m('meeting')->getone(" state = 1 and meeting_room = '{$rawData['room_name']}'");
+        $meetData = m('meeting')->getone(" status = 1 and state = 1 and meeting_room = '{$rawData['room_name']}'");
 
         $now = date('Y年m月d日('.$this->getWeek().') H:i');
 
@@ -122,61 +122,7 @@ class openmeetClassAction extends openapiAction
     public function switchTopicsAction() {
         $rawArr = $this->getpostarr();
 
-        if (!isset($rawArr['meet_id']) || !isset($rawArr['topic_id'])) {
-            return [
-                "code"=>-1,
-                "message"=>"参数错误!"
-            ];
-        }
-
-        // 获取议题信息
-        $topics = $this->db->getall("select `id`, `topic_title`, `topic_attendee`, `topic_attendee_id`, `topic_state` from `[Q]meeting_topics` where mid = {$rawArr['meet_id']} order by sort");
-
-        if (!isset($topics) || !isset($rawArr['meet_id'])) {
-            return [
-                "code"=>-1,
-                "message"=>"会议不存在!"
-            ];
-        }
-
-        $topic_id = $rawArr['topic_id'];
-
-        for ($i = 0; $i < count($topics); $i++) {
-            $info = $topics[$i];
-            if ($topic_id == $info['id']) {
-                $topics[$i]['topic_state'] = $topics[$i]['topic_state'] + 1;
-                $topics[$i]['topic_state_info'] = $this->topicState($topics[$i]['topic_state']);
-                $id = $topics[$i]['id'];
-//                m('meeting')->update(['topic_state'=>$topics[$i]['topic_state']], "id={$id}");
-
-                if (isset($topics[$i - 1])) {
-                    $topics[$i-1]['topic_state'] = $topics[$i-1]['topic_state'] + 1;
-                    $topics[$i-1]['topic_state_info'] = $this->topicState($topics[$i-1]['topic_state']);
-                    $id = $topics[$i-1]['id'];
-//                    m('meeting')->update(['topic_state'=>$topics[$i-1]['topic_state']], "id={$id}");
-                }
-
-                if (isset($topics[$i + 1])) {
-                    $topics[$i+1]['topic_state'] = $topics[$i+1]['topic_state'] + 1;
-                    $topics[$i+1]['topic_state_info'] = $this->topicState($topics[$i+1]['topic_state']);
-                    $id = $topics[$i+1]['id'];
-//                    m('meeting')->update(['topic_state'=>$topics[$i+1]['topic_state']], "id={$id}");
-                }
-                // 发送短信给 topic_attendee_id
-
-            } else {
-                $topics[$i]['topic_state_info'] = $this->topicState($topics[$i]['topic_state']);
-                $id = $topics[$i]['id'];
-//                m('meeting')->update(['topic_state'=>$topics[$i]['topic_state']], "id={$id}");
-            }
-        }
-
-        return [
-            "code"=>200,
-            "message"=>"切换成功!",
-            "data"=>$topics
-        ];
-
+        $this->showreturn($rawArr,'请求成功!');
     }
 
     protected function topicState($code): string
@@ -190,7 +136,7 @@ class openmeetClassAction extends openapiAction
                 $info = '进行中';
                 break;
             case 3:
-                $info = '已进行';
+                $info = '已结束';
                 break;
 
         }