1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677 |
- <?php
- namespace Home\Controller;
- use Think\Controller;
- include '../Common/function.php';
- class WorkOrderNoticeController extends PushWarnController
- {
- public function message_workordernotice()
- {
- $Data = I('post.');
- $company_code = $Data['company_code'];
- $time = $Data['time'];
- $id = $Data['id'];
- $title1 = str_replace('"]', '', $Data['title']);
- $title = str_replace('["', '', $title1);
- $company = M()->query("select owner_name from sp_owner_company where owner_id=" . $company_code);
- $op = M()->query("SELECT openid FROM sp_wx_customuser WHERE type='wx' and idphone in(select phone from(select phone from sp_owner_phone WHERE owner_code='" . $company_code . "' union select phone from sp_owner_phone WHERE owner_code in (select other_code from sp_owner_fujin where owner_code='" . $company_code . "')) t )");
- $access_token = GetAccess_Token1();
- $content = '单 位:' . $company[0]['owner_name'];
- if ($Data['types']==2){
- $type = '电子督察单(重要)';
- $url = "https://qhome.usky.cn/jdxf/wxapp2.php/Home/FireInspector/index1/id/" . $id . "/companyid/" . $company_code;
- }else if ($Data['types']==1){
- $type = '人工督察单(重要)';
- $url = "https://qhome.usky.cn/jdxf/wxapp2.php/Home/FireInspector/index/id/" . $id . "/companyid/" . $company_code;
- }else{
- $type = '人工督察单(重要)';
- $url = "https://qhome.usky.cn/jdxf/wxapp2.php/Home/FireInspector/index/id/" . $id . "/companyid/" . $company_code;
- }
- $title = $title;
- $people = '消防支队';
- $remark = '时 间:' . $time;
- if ($title=="设备离线"){
- echo '离线过滤';
- exit();
- }
- foreach ($op as $o) {
- if (!empty($o['openid'])) {
- $arr = $this->SendDeviceAlarm1($access_token, $o['openid'], $content, $type, $title, $people, $remark, $url);
- // print_r($arr);
- }
- }
- }
- public function message_notice()
- {
- $Data = I('post.');
- $company_code = $Data['company_code'];
- $time = $Data['time'];
- $id = $Data['id'];
- $title1 = str_replace('"]', '', $Data['title']);
- $title = str_replace('["', '', $title1);
- $company = M()->query("select owner_name from sp_owner_company where owner_id=" . $company_code);
- $op = M()->query("SELECT openid FROM sp_wx_customuser WHERE type='wx' and idphone in(select phone from(select phone from sp_owner_phone WHERE owner_code='" . $company_code . "' union select phone from sp_owner_phone WHERE owner_code in (select other_code from sp_owner_fujin where owner_code='" . $company_code . "')) t )");
- print_r($op);
- $access_token = GetAccess_Token1();
- $content = '单 位:' . $company[0]['owner_name'];
- $type = '人工督察单(重要)';
- $title = $title;
- $people = '消防支队';
- $remark = '时 间:' . $time;
- $url = "";
- foreach ($op as $o) {
- if (!empty($o['openid'])) {
- $this->SendDeviceAlarm1($access_token, $o['openid'], $content, $type, $title, $people, $remark, $url);
- }
- }
- }
- }
|