q пре 1 година
родитељ
комит
1574a11c00
1 измењених фајлова са 32 додато и 32 уклоњено
  1. 32 32
      webmain/task/openapi/openmeetAction.php

+ 32 - 32
webmain/task/openapi/openmeetAction.php

@@ -124,17 +124,19 @@ class openmeetClassAction extends openapiAction
             if ($nowMeet['type'] == 2) {
 
                 $topics = $this->db->getall("select `id`, `topic_title`, `topic_attendee`, `topic_state`, `topic_info` from `[Q]meeting_topics` where mid = {$nowMeet['id']} order by sort");
-                $j = count($topics);
-                $meetingTopic = array_fill(0, count($topics), null);
+
+                $meetingTopic = array_fill(0, count($topics) - 1, null);
                 // 会议议题处理
-                for ($i = 0; $i < count($topics); $i++) {
+
+                for ($i = 0,$j = 0; $i < count($topics); $i++) {
                     $info = $topics[$i];
                     // 用于排序(已结束放最后)
                     if ($info['topic_state'] == 3) {
-                        $index = $j - $i - 1;
+                        $index = count($topics) - 1 - $j++;
                     } else {
-                        $index = $i - 2;
+                        $index = $i-$j;
                     }
+
                     $meetingTopic[$index]['state'] = $info['topic_state'];
                     $meetingTopic[$index]['tip'] = m("meeting")->ytarra[$info['topic_state']];
                     $meetingTopic[$index]['text'] = $info['topic_title'];
@@ -202,12 +204,12 @@ class openmeetClassAction extends openapiAction
                     SELECT 1 FROM `[Q]meeting`
                      WHERE `status` = 1
                        and `start_time` < now()
-                       and `end_time` > now()
+                       and `meet_state` != 2
                        and `room_id` = '".$data['id']."'
                     UNION ALL
                     SELECT 1 FROM `[Q]meeting_key`
                      WHERE `start_time` < now()
-                       and `end_time` > now()
+                       and `meet_state` != 2
                        and `room_id` = '".$data['id']."'
                 ) t";
             $meetingHave = $this->db->getall($sqlStr);
@@ -216,11 +218,13 @@ class openmeetClassAction extends openapiAction
                 "SELECT count(1) con FROM (
                     SELECT 1 FROM `[Q]meeting`
                      WHERE `status` = 1
+                       AND `meet_state` != 2
                        AND `start_time` REGEXP '".$dataDate."'
                        AND `room_id` = '".$data['id']."'
                     UNION ALL
                     SELECT 1 FROM `[Q]meeting_key`
                      WHERE `start_time` REGEXP '".$dataDate."'
+                       AND `meet_state` != 2
                        AND `room_id` = '".$data['id']."'
                 ) t";
             $meetCon = $this->db->getall($sqlStr);
@@ -251,18 +255,25 @@ class openmeetClassAction extends openapiAction
             return returnerror('会议室不存在!');
         }
 
-        $dataDate =  substr($rawArr['date'], 0, 10) ?? date("Y-m-d");
+        if (isset($rawArr['date'])) {
+            $dataDate = substr($rawArr['date'], 0, 10);
+        } else {
+            $dataDate = date("Y-m-d");
+        }
+
 
         $sqlStr = /** @lang text */
             "SELECT 1 as type, id, title, start_time, end_time, null compere, '办公会议' as meeting_type 
                FROM `[Q]meeting`
               WHERE `status` = 1
                 and `start_time` regexp '".$dataDate."'
+                and `meet_state` != 2
                 and `room_id` = '".$roomId."'
              UNION ALL
              SELECT 2 as type, id, title, start_time, end_time, compere, '党委会议' as meeting_type 
                FROM `[Q]meeting_key`
               WHERE `start_time` regexp '".$dataDate."'
+                and `meet_state` != 2
                 and `room_id` = '".$roomId."'
             ";
         $meetingArr = $this->db->getall($sqlStr);
@@ -332,6 +343,7 @@ class openmeetClassAction extends openapiAction
         }
         $meetId = $rawArr['meet_id'];
         $meetType = $rawArr['meet_type'];
+        // 普通会议
         if ($meetType == 1) {
             $meetInfo = $this->db->getone("[Q]meeting", "`id` = '".$meetId."'");
             if (!empty($meetInfo)) {
@@ -357,6 +369,7 @@ class openmeetClassAction extends openapiAction
                 $this->showreturn($info, 'success');
             }
         } else {
+            // 党委会议
             $meetInfo = $this->db->getone("[Q]meeting_key", "`id` = '".$meetId."'");
             if (!empty($meetInfo)) {
                 $info['basic_information'] = [
@@ -378,38 +391,25 @@ class openmeetClassAction extends openapiAction
                     ]
                 ];
 
+                // 会议议题
                 $topics = m("meeting_topics")->getall("`mid` = '".$meetId."'", "*", "sort");
-                $j = count($topics);
+
                 $meetingTopic = array_fill(0, count($topics), null);
                 // 会议议题处理
-                for ($i = 0; $i < count($topics); $i++) {
-                    $info = $topics[$i];
+                for ($i = 0,$j = 0; $i < count($topics); $i++) {
+                    $topiic = $topics[$i];
                     // 用于排序(已结束放最后)
-                    if ($info['topic_state'] == 3) {
-                        $index = $j - $i - 1;
+                    if ($topiic['topic_state'] == 3) {
+                        $index = count($topics) - 1 - $j++;
                     } else {
-                        $index = $i - 2;
+                        $index = $i-$j;
                     }
 
-                    $meetingTopic[$index]['state'] = $info['topic_state'];
-                    $meetingTopic[$index]['tip'] = m("meeting")->ytarra[$info['topic_state']];
-                    $meetingTopic[$index]['text'] = $info['topic_title'];
-                    $meetingTopic[$index]['personnel_list'] = str_replace("\n", "<br />", $info['topic_info']);
+                    $meetingTopic[$index]['state'] = $topiic['topic_state'];
+                    $meetingTopic[$index]['tip'] = m("meeting")->ytarra[$topiic['topic_state']];
+                    $meetingTopic[$index]['text'] = $topiic['topic_title'];
+                    $meetingTopic[$index]['personnel_list'] = str_replace("\n", "<br />", $topiic['topic_info']);
 
-//                    if ($info['topic_state'] == 2) {
-//                        // 当前议题 + 参会人员
-//                        $data['participants'][] = [
-//                            "topics" => $info['topic_title'],
-//                            "personnel_list" => str_replace("\n", "<br />", $info['topic_info']),
-//                        ];
-//                        // 下一议题 + 参会人员
-//                        if (isset($topics[$i + 1])) {
-//                            $data['participants'][] = [
-//                                "topics" => $topics[$i + 1]['topic_title'],
-//                                "personnel_list" => str_replace("\n", "<br />", $topics[$i + 1]['topic_info']),
-//                            ];
-//                        }
-//                    }
                 }
                 $info['meetingTopic'] = $meetingTopic;