$openid, "template_id"=>"9cYn9IdoLE7NhCAPTIc1Ip4dV5JPrbbATxQT-v944Vw", "url" =>$ljurl, //"url" =>"http://zt-iot.com/ztxf/weixin.php/Home/Fire/water", "data"=> array( "first"=> array( "value"=> $address, "color"=>"#44b549" ), "keyword1"=>array( "value"=> $deviceid, "color"=>"#173177" ), "keyword2"=> array( "value"=> $type, "color"=>"#173177" ), "keyword3"=> array( "value"=> $time, "color"=>"#173177" ), "remark"=>array( "value"=> $remark, "color"=>"#aaaaaa" ) ) ); //{{first.DATA}} //设备号:{{keyword1.DATA}} //报警类型:{{keyword2.DATA}} //时间:{{keyword3.DATA}} //{{remark.DATA}} $data = json_encode($data); $QUEST_URL = "https://api.weixin.qq.com/cgi-bin/message/template/send?access_token=".$access_token; $res = $this->curl($QUEST_URL,$data); return json_decode($res,true); } public function SendDeviceAlarm1($access_token,$openid,$content,$type,$title,$people,$remark,$url){ $data = array( "touser"=> $openid, "template_id"=>"N4PQZ9AmO2mjWVRjfZzYgLFrNq69WcLBW1KKjP1jbDs", "url" =>$url, "data"=> array( "first"=> array( "value"=> $content, "color"=>"#44b549" ), "keyword1"=>array( "value"=> $type, "color"=>"#173177" ), "keyword2"=> array( "value"=> $title, "color"=>"#173177" ), "keyword3"=> array( "value"=> $people, "color"=>"#173177" ), "remark"=>array( "value"=> $remark, "color"=>"#173177" ) ) ); //{{first.DATA}} //设备号:{{keyword1.DATA}} //报警类型:{{keyword2.DATA}} //时间:{{keyword3.DATA}} //{{remark.DATA}} $data = json_encode($data); $QUEST_URL = "https://api.weixin.qq.com/cgi-bin/message/template/send?access_token=".$access_token; $res = $this->curl($QUEST_URL,$data); return json_decode($res,true); // return "ceshi"; } public function SendDeviceAlarm3($access_token,$openid,$address,$deviceid,$type,$time,$remark,$url){ $data = array( "touser"=> $openid, "template_id"=>"kMIOm99qgqAQ-nqsSxWlUToz4Krm-_TopRBJolXNBB8", "url" =>$url, //"url" =>"http://zt-iot.com/ztxf/weixin.php/Home/Fire/water", "data"=> array( "first"=> array( "value"=> $address, "color"=>"#44b549" ), "keyword1"=>array( "value"=> $deviceid, "color"=>"#173177" ), "keyword2"=> array( "value"=> $type, "color"=>"#173177" ), "keyword3"=> array( "value"=> $time, "color"=>"#173177" ), "remark"=>array( "value"=> $remark, "color"=>"#aaaaaa" ) ) ); //{{first.DATA}} //设备号:{{keyword1.DATA}} //报警类型:{{keyword2.DATA}} //时间:{{keyword3.DATA}} //{{remark.DATA}} $data = json_encode($data); $QUEST_URL = "https://api.weixin.qq.com/cgi-bin/message/template/send?access_token=".$access_token; $res = $this->curl($QUEST_URL,$data); return json_decode($res,true); } public function SendDeviceAlarm2($access_token,$openid,$address,$deviceid,$type,$time,$remark,$url){ $data = array( "touser"=> $openid, "template_id"=>" kMIOm99qgqAQ-nqsSxWlUToz4Krm-_TopRBJolXNBB8", "url" =>$url, //"url" =>"http://zt-iot.com/ztxf/weixin.php/Home/Fire/water", "data"=> array( "first"=> array( "value"=> $address, "color"=>"#44b549" ), "keyword1"=>array( "value"=> $deviceid, "color"=>"#173177" ), "keyword2"=> array( "value"=> $type, "color"=>"#173177" ), "keyword3"=> array( "value"=> $time, "color"=>"#173177" ), "remark"=>array( "value"=> $remark, "color"=>"#aaaaaa" ) ) ); //{{first.DATA}} //设备号:{{keyword1.DATA}} //报警类型:{{keyword2.DATA}} //时间:{{keyword3.DATA}} //{{remark.DATA}} $data = json_encode($data); $QUEST_URL = "https://api.weixin.qq.com/cgi-bin/message/template/send?access_token=".$access_token; $res = $this->curl($QUEST_URL,$data); return json_decode($res,true); } }