Quellcode durchsuchen

会议审批短信留方法

q vor 1 Jahr
Ursprung
Commit
4f982e5fc6

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

@@ -88,15 +88,7 @@ class flow_meetingClassModel extends flowModel
         return $rs;
     }
 
-    public function getstatezt($zt)
-    {
-        if (isset($this->hyarrb[$zt])) {
-            $html = '<font color="'.$this->hyarrb[$zt].'">'.$this->hyarra[$zt].'</font>';
-            return $html;
-        } else {
-            return null;
-        }
-    }
+
 
     // $ors当前单据操作信息,$crs提交过来的信息
     public function flowoptmenu($ors, $crs)
@@ -170,10 +162,39 @@ class flow_meetingClassModel extends flowModel
     }
 
     //流程全部完成后调用
-    public function flowcheckfinsh($sm) {
+//    public function flowcheckfinsh($sm) {
+    protected function flowcheckfinsh($sm){
+
+        // 审批完成给负责人发短信
+        $meeting = m("meeting")->getone("id={$this->id}");
+        if (empty($meeting)) return;
+        m("log")->addlog("会议室审批", "发送短信给".$meeting['attendees']."部门负责人");
+
+        foreach (explode(',', $meeting['attendees_id']) as $val) {
+            if (substr($val, 0,1) == 'u') {
+                $users[] = substr($val, 1);
+            } else if (substr($val, 0,1) == 'd') {
+                $depts[] = substr($val, 1);
+            }
+        }
+        $users = m("admin")->getall("id in (".implode(',', $users).")");
 
-        // 会议议题状态全部设置为1
-//        m('meeting_topics')->update(['topic_state'=>'1'], 'mid='.$this->id);
+        $mobile = [];
+        foreach ($users as $val) {
+            $mobile[] = $val['mobile'];
+        }
+
+        if (!empty($depts)) {
+            $deptSql = "select distinct b.mobile from [Q]dept a left join [Q]admin b on a.headid = b.id where a.id in (".implode(',', $depts).") and a.headid is not null";
+            m("log")->addlog("会议室审批", $deptSql);
+            $depts = $this->db->getall($deptSql);
+            // 部门负责人手机号
+            foreach ($depts as $val) {
+                $mobile[] = $val['mobile'];
+            }
+        }
+
+        m("log")->addlog("会议室审批", "短信包括:".implode(' ', $mobile));
 
     }
 
@@ -188,6 +209,16 @@ class flow_meetingClassModel extends flowModel
 
 
 
+    public function getstatezt($zt)
+    {
+        if (isset($this->hyarrb[$zt])) {
+            $html = '<font color="'.$this->hyarrb[$zt].'">'.$this->hyarra[$zt].'</font>';
+            return $html;
+        } else {
+            return null;
+        }
+    }
+
 
 
 }

+ 17 - 1
webmain/model/flow/repair_faultModel.php

@@ -40,8 +40,9 @@ class flow_repair_faultClassModel extends flowModel
     //显示操作菜单判断
     protected function flowgetoptmenu($num)
     {
+        if (empty($this->id)) return false;
         $row = m("repair_fault")->getone("id={$this->id} and handle_state != 1");
-        if (empty($row)) return false;
+        if (empty($row) || empty($row['type_id'])) return false;
         $type_id = $row['type_id'];
         $can = m("repair_type")->getone("id={$type_id} and FIND_IN_SET({$this->uid},`head_id`)", 'head_id');
         if (empty($can)) {
@@ -51,6 +52,21 @@ class flow_repair_faultClassModel extends flowModel
         }
     }
 
+
+    //提交时调用
+    protected function flowsubmit($na, $sm){
+        $row = m("repair_fault")->getone("id={$this->id}");
+        if (!empty($row) && $row['handle_state'] == 0 && $row['sms_state'] == 0) {
+            $typeInfo = m("repair_type")->getone("id={$row['type_id']}");
+            m("log")->addlog("故障记录", "发送短信给{$typeInfo['head']}");
+
+            // 发送成功改变状态
+            $this->update([
+                "sms_state"=>1,
+            ], $this->id);
+        }
+    }
+
     public function getstatezt($zt)
     {
         if (isset($this->hstate[$zt])) {

+ 2 - 2
webmain/model/meetingModel.php

@@ -35,7 +35,7 @@ class meetingClassModel extends Model
                  select id, meeting_room, start_time, end_time, title 
                    from [Q]meeting_key where id <> '.$id.' and meet_state in (0, 1)';
         }
-        m('log')->addlog("验证", $sql);
+//        m('log')->addlog("验证", $sql);
 
         $rows 		= $this->db->getall($sql);
 
@@ -43,7 +43,7 @@ class meetingClassModel extends Model
             if($rs['meeting_room'] != $hyname)continue;
             $sdt = $rs['start_time'];
             $edt = $rs['end_time'];
-            m('log')->addlog("验证", json_encode($rs));
+//            m('log')->addlog("验证", json_encode($rs));
             if(
                 ($sdt<=$startdt && $edt>$startdt)
                 || ($sdt<$enddt && $edt>=$enddt)