Browse Source

会议显示状态调整、切换议题

q 1 year ago
parent
commit
dcba17ae5d
2 changed files with 85 additions and 10 deletions
  1. 75 9
      webmain/model/flow/meetingModel.php
  2. 10 1
      webmain/task/openapi/openmeetAction.php

+ 75 - 9
webmain/model/flow/meetingModel.php

@@ -3,11 +3,12 @@
 class flow_meetingClassModel extends flowModel
 {
 
-    public $hyarra, $hyarrb, $dbobj, $reatearr;
+    public $hyarra, $ytarra, $hyarrb, $dbobj, $reatearr;
 
     public function initModel()
     {
         $this->hyarra 	= array('正常','会议中','结束','取消');
+        $this->ytarra 	= array('待进行','待进行','进行中','已进行');
         $this->hyarrb 	= array('green','blue','#ff6600','#888888');
         $this->dbobj	= c('date');
 
@@ -25,25 +26,47 @@ class flow_meetingClassModel extends flowModel
         );
     }
 
+    //子表数据替换处理$lx=0编辑时,1展示时
+    protected function flowsubdata($rows, $lx=0){
+
+        for ($i = 0; $i < count($rows); $i++) {
+            $rows[$i]['topic_state'] = $this->ytarra[$rows[$i]['topic_state'] ?? 1];
+        }
+        return $rows;
+    }
+
+
     // 初始化单据可替换其他属性,$lx,0默认,1详情展示,2列表显示,3打印页,4外部详情页
     public function flowrsreplace($rs, $lx=0)
     {
 
+//        m('log')->addlog('会议单据', json_encode($rs, true));
+        
         $zt 		 = $rs['state'];
         $nzt 		 = $zt;
         $time 		 = time();
 
         $stime 	= strtotime($rs['meeting_time']);
+        $etime 	= strtotime($rs['end_time']);
+
 
-        if($zt < 2){
-            if($stime>$time){
+//        if($zt < 2){
+            if($etime<$time){
+                $nzt = 2;
+            }else if($stime>$time){
                 // 开始时间大于当前时间,认为会议开始
                 $nzt = 0;
-            } if ($nzt != 2 || $nzt != 3) {
-                // 状态不是取消、结束,则赋值“正常”
+            }else{
                 $nzt = 1;
             }
-        }
+//        }
+
+
+//        if ($nzt != 2 || $nzt != 3) {
+//            // 状态不是取消、结束,则赋值“正常”
+//            $nzt = 1;
+//        }
+
         // 更新数据状态
         if($zt != $nzt){
             $this->update('state='.$nzt.'', $rs['id']);
@@ -53,6 +76,7 @@ class flow_meetingClassModel extends flowModel
         // 将id转换为文字
         $rs['state'] = $this->getstatezt($zt);
 
+
         return $rs;
     }
 
@@ -64,12 +88,44 @@ class flow_meetingClassModel extends flowModel
     // $ors当前单据操作信息,$crs提交过来的信息
     public function flowoptmenu($ors, $crs)
     {
-        if ($ors['num'] == 'delnoup') {
-
+        // 切换会议议题
+        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;
+                        $id = $topics[$i+1]['id'];
+                        m('meeting_topics')->update(['topic_state'=>1], "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']}");
+            }
         }
-        return null;
     }
 
+
     //删除单据时调用
     public function flowdeletebill($sm) {
 //        m('meet_sys')->deleteMeetingRoom($this->rs);
@@ -77,6 +133,13 @@ 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']}");
+        }
+
     }
 
     //提交时调用
@@ -88,4 +151,7 @@ class flow_meetingClassModel extends flowModel
 
     }
 
+
+
+
 }

+ 10 - 1
webmain/task/openapi/openmeetAction.php

@@ -27,7 +27,7 @@ class openmeetClassAction extends openapiAction
 
         $meetData = m('meeting')->getone(" state = 1 and meeting_room = '{$rawData['room_name']}'");
 
-        $now = date('Y年m月d日('.$this->getWeek().') H:i:s');
+        $now = date('Y年m月d日('.$this->getWeek().') H:i');
 
         if ($rawData['id'] ?? 0 > 0) {
             return [
@@ -146,19 +146,28 @@ class openmeetClassAction extends openapiAction
             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}");
             }
         }