Browse Source

更新高级群发接口,添加了预览和查询结果方法
其url地址待官方更新

binsee 10 years ago
parent
commit
367ff058d7
3 changed files with 322 additions and 33 deletions
  1. 12 9
      README.md
  2. 155 12
      Thinkphp/Wechat.class.php
  3. 155 12
      wechat.class.php

+ 12 - 9
README.md

@@ -35,10 +35,10 @@ https://mp.weixin.qq.com/cgi-bin/readtemplate?t=business/course2_tmpl&lang=zh_CN
 - 接入验证 (初级权限)
 - 自动回复(文本、图片、语音、视频、音乐、图文)(初级权限)
 - 菜单操作(查询、创建、删除)(菜单权限)
-- 客服消息(文本、图片、语音、视频、音乐、图文)(认证权限)
-- 二维码(创建临时、永久二维码,获取二维码URL)(认证权限)
-- 长链接转短链接接口(认证权限)
-- 分组操作(查询、创建、修改、移动用户到分组)(认证权限)
+- 客服消息(文本、图片、语音、视频、音乐、图文)(服务号、认证权限)
+- 二维码(创建临时、永久二维码,获取二维码URL)(服务号、认证权限)
+- 长链接转短链接接口(服务号、认证权限)
+- 分组操作(查询、创建、修改、移动用户到分组)(服务号、认证权限)
 - 网页授权(基本授权,用户信息授权)(认证权限)
 - 用户信息(查询用户基本信息、获取关注者列表)(认证权限)
 - 多客服功能(认证权限)
@@ -48,9 +48,10 @@ https://mp.weixin.qq.com/cgi-bin/readtemplate?t=business/course2_tmpl&lang=zh_CN
 - 订单成功回调 (支付权限) 
 - 发货通知 (支付权限) 
 - 支付订单查询 (支付权限) 
-- 模板消息(支付权限) 
-- 语义理解(认证权限) 
-- 获取微信服务器IP列表(认证权限) 
+- 高级群发(服务号|订阅号、认证权限)
+- 模板消息(服务号、认证权限) 
+- 语义理解(服务号、认证权限) 
+- 获取微信服务器IP列表(初级权限) 
 
 
 ### 初始化动作 
@@ -79,8 +80,10 @@ https://mp.weixin.qq.com/cgi-bin/readtemplate?t=business/course2_tmpl&lang=zh_CN
  *  getMedia() 获取接收到的音频、视频媒体文件 
  *  uploadArticles($data) 上传图文消息素材
  *  sendMassMessage($data) 高级群发消息
- *  sendGroupMassMessage($data) 高级群发消息(分组群发)
- *  deleteMassMessage() 删除群发图文消息
+ *  sendGroupMassMessage($data) 高级群发消息(群体或分组群发)
+ *  deleteMassMessage($msg_id) 删除群发图文消息
+ *  previewMassMessage($data) 预览群发消息
+ *  queryMassMessage($msg_id) 查询群发消息发送状态
  *  getQRCode($scene_id,$type=0,$expire=1800) 获取推广二维码ticket字串 
  *  getQRUrl($ticket) 获取二维码图片地址
  *  getShortUrl($long_url) 长链接转短链接接口

+ 155 - 12
Thinkphp/Wechat.class.php

@@ -81,8 +81,11 @@ class Wechat
 	const TEMPLATE_SEND_URL = '/message/template/send?';
 	const MASS_SEND_GROUP_URL = '/message/mass/sendall?';
 	const MASS_DELETE_URL = '/message/mass/delete?';
+	const MASS_PREVIEW_URL = '/message/mass/xxxx?';
+	const MASS_QUERY_URL = '/message/mass/xxxx?';
 	const UPLOAD_MEDIA_URL = 'http://file.api.weixin.qq.com/cgi-bin';
 	const MEDIA_UPLOAD = '/media/upload?';
+	const MEDIA_VIDEO_UPLOAD = '/media/uploadvideo?';
 	const OAUTH_PREFIX = 'https://open.weixin.qq.com/connect/oauth2';
 	const OAUTH_AUTHORIZE_URL = '/authorize?';
 	const OAUTH_TOKEN_PREFIX = 'https://api.weixin.qq.com/sns/oauth2';
@@ -559,8 +562,9 @@ class Wechat
 	}
 	
 	/**
-	* 获取模板消息ID
+	* 获取主动推送的消息ID
 	* 经过验证,这个和普通的消息MsgId不一样
+	* 当Event为 MASSSENDJOBFINISH 或 TEMPLATESENDJOBFINISH
 	*/
 	public function getRevTplMsgID(){
 		if (isset($this->_receive['MsgID'])){
@@ -579,6 +583,32 @@ class Wechat
 			return false;
 	}
 	
+	/**
+	* 获取群发或模板消息发送结果
+	* 当Event为 MASSSENDJOBFINISH 或 TEMPLATESENDJOBFINISH,即高级群发/模板消息
+	*/
+	public function getRevResult(){
+		if (isset($this->_receive['Status'])) //发送是否成功,具体的返回值请参考 高级群发/模板消息 的事件推送说明
+			$array['Status'] = $this->_receive['Status'];
+		if (isset($this->_receive['MsgID'])) //发送的消息id
+			$array['MsgID'] = $this->_receive['MsgID'];
+		
+		//以下仅当群发消息时才会有的事件内容
+		if (isset($this->_receive['TotalCount']))     //分组或openid列表内粉丝数量
+			$array['TotalCount'] = $this->_receive['TotalCount'];
+		if (isset($this->_receive['FilterCount']))    //过滤(过滤是指特定地区、性别的过滤、用户设置拒收的过滤,用户接收已超4条的过滤)后,准备发送的粉丝数
+			$array['FilterCount'] = $this->_receive['FilterCount'];
+		if (isset($this->_receive['SentCount']))     //发送成功的粉丝数
+			$array['SentCount'] = $this->_receive['SentCount'];
+		if (isset($this->_receive['ErrorCount']))    //发送失败的粉丝数
+			$array['ErrorCount'] = $this->_receive['ErrorCount'];
+		if (isset($array) && count($array) > 0) {
+		    return $array;
+		} else {
+		    return false;
+		}
+	}
+	
 	public static function xmlSafeStr($str)
 	{   
 		return '<![CDATA['.preg_replace("/[\\x00-\\x08\\x0b-\\x0c\\x0e-\\x1f]/",'',$str).']]>';   
@@ -1008,7 +1038,7 @@ class Wechat
 	}
 
 	/**
-	 * 创建菜单
+	 * 创建菜单(认证后的订阅号可用)
 	 * @param array $data 菜单数组数据
 	 * example:
      * 	array (
@@ -1077,7 +1107,7 @@ class Wechat
 	}
 	
 	/**
-	 * 获取菜单
+	 * 获取菜单(认证后的订阅号可用)
 	 * @return array('menu'=>array(....s))
 	 */
 	public function getMenu(){
@@ -1097,7 +1127,7 @@ class Wechat
 	}
 	
 	/**
-	 * 删除菜单
+	 * 删除菜单(认证后的订阅号可用)
 	 * @return boolean
 	 */
 	public function deleteMenu(){
@@ -1117,7 +1147,7 @@ class Wechat
 	}
 
 	/**
-	 * 上传多媒体文件
+	 * 上传多媒体文件(认证后的订阅号可用)
 	 * 注意:数组的键值任意,但文件名前必须加@,使用单引号以避免本地路径斜杠被转义
 	 * @param array $data {"media":'@Path\filename.jpg'}
 	 * @param type 类型:图片:image 语音:voice 视频:video 缩略图:thumb
@@ -1140,7 +1170,7 @@ class Wechat
 	}
 	
 	/**
-	 * 根据媒体文件ID获取媒体文件
+	 * 根据媒体文件ID获取媒体文件(认证后的订阅号可用)
 	 * @param string $media_id 媒体文件id
 	 * @return raw data
 	 */
@@ -1161,7 +1191,7 @@ class Wechat
 	}
 
 	/**
-	 * 上传图文消息素材
+	 * 上传图文消息素材(认证后的订阅号可用)
 	 * @param array $data 消息结构{"articles":[{...}]}
 	 * @return boolean|array
 	 */
@@ -1180,10 +1210,54 @@ class Wechat
 		}
 		return false;
 	}
+
+	/**
+	 * 上传视频素材(认证后的订阅号可用)
+	 * @param array $data 消息结构
+	 * {
+	 *     "media_id"=>"",     //通过上传媒体接口得到的MediaId
+	 *     "title"=>"TITLE",    //视频标题
+	 *     "description"=>"Description"        //视频描述
+	 * }
+	 * @return boolean|array
+	 * {
+	 *     "type":"video",
+	 *     "media_id":"mediaid",
+	 *     "created_at":1398848981
+	 *  }
+	 */
+	public function uploadMpVideo($data){
+	    if (!$this->access_token && !$this->checkAuth()) return false;
+	    $result = $this->http_post(self::UPLOAD_MEDIA_URL.self::MEDIA_VIDEO_UPLOAD.'access_token='.$this->access_token,self::json_encode($data));
+	    if ($result)
+	    {
+	        $json = json_decode($result,true);
+	        if (!$json || !empty($json['errcode'])) {
+	            $this->errCode = $json['errcode'];
+	            $this->errMsg = $json['errmsg'];
+	            return false;
+	        }
+	        return $json;
+	    }
+	    return false;
+	}
 	
 	/**
-	 * 高级群发消息, 根据OpenID列表群发图文消息
-	 * @param array $data 消息结构{ "touser":[ "OPENID1", "OPENID2" ], "mpnews":{ "media_id":"123dsdajkasd231jhksad" }, "msgtype":"mpnews" }
+	 * 高级群发消息, 根据OpenID列表群发图文消息(订阅号不可用)
+	 * 	注意:视频需要在调用uploadMedia()方法后,再使用 uploadMpVideo() 方法生成,
+	 *             然后获得的 mediaid 才能用于群发,且消息类型为 mpvideo 类型。
+	 * @param array $data 消息结构
+	 * {
+	 *     "touser"=>array(
+	 *         "OPENID1",
+	 *         "OPENID2"
+	 *     ),
+	 *      "msgtype"=>"mpvideo", 
+	 *      // 在下面5种类型中选择对应的参数内容
+	 *      // mpvideo =>array ( "media_id"=>"MediaId", "title"=>"TITLE", "description"=>"Description" )
+	 *      // mpnews | voice | image => array( "media_id"=>"MediaId")
+	 *      // text => array ( "content" => "hello")
+	 * }
 	 * @return boolean|array
 	 */
 	public function sendMassMessage($data){
@@ -1203,8 +1277,21 @@ class Wechat
 	}
 	
 	/**
-	 * 高级群发消息, 根据群组id群发图文消息
-	 * @param array $data 消息结构{ "filter":[ "group_id": "2" ], "mpnews":{ "media_id":"123dsdajkasd231jhksad" }, "msgtype":"mpnews" }
+	 * 高级群发消息, 根据群组id群发图文消息(认证后的订阅号可用)
+	 * 	注意:视频需要在调用uploadMedia()方法后,再使用 uploadMpVideo() 方法生成,
+	 *             然后获得的 mediaid 才能用于群发,且消息类型为 mpvideo 类型。
+	 * @param array $data 消息结构
+	 * {
+	 *     "filter"=>array( 
+	 *         "is_to_all"=>False,     //是否群发给所有用户.True不用分组id,False需填写分组id
+	 *         "group_id"=>"2"     //群发的分组id
+	 *     ),
+	 *      "msgtype"=>"mpvideo", 
+	 *      // 在下面5种类型中选择对应的参数内容
+	 *      // mpvideo =>array ( "media_id"=>"MediaId", "title"=>"TITLE", "description"=>"Description" )
+	 *      // mpnews | voice | image => array( "media_id"=>"MediaId")
+	 *      // text => array ( "content" => "hello")
+	 * }
 	 * @return boolean|array
 	 */
 	public function sendGroupMassMessage($data){
@@ -1224,7 +1311,7 @@ class Wechat
 	}
 	
 	/**
-	 * 高级群发消息, 删除群发图文消息
+	 * 高级群发消息, 删除群发图文消息(认证后的订阅号可用)
 	 * @param int $msg_id 消息id
 	 * @return boolean|array
 	 */
@@ -1245,6 +1332,62 @@ class Wechat
 	}
 	
 	/**
+	 * 高级群发消息, 预览群发消息(认证后的订阅号可用)
+	 * 	注意:视频需要在调用uploadMedia()方法后,再使用 uploadMpVideo() 方法生成,
+	 *             然后获得的 mediaid 才能用于群发,且消息类型为 mpvideo 类型。
+	 * @param array $data 消息结构
+	 * {
+	 *     "touser"=>"OPENID",
+	 *      "msgtype"=>"mpvideo",
+	 *      // 在下面5种类型中选择对应的参数内容
+	 *      // mpvideo =>array ( "media_id"=>"MediaId", "title"=>"TITLE", "description"=>"Description" )
+	 *      // mpnews | voice | image => array( "media_id"=>"MediaId")
+	 *      // text => array ( "content" => "hello")
+	 * }
+	 * @return boolean|array
+	 */
+	public function previewMassMessage($data){
+	    if (!$this->access_token && !$this->checkAuth()) return false;
+	    $result = $this->http_post(self::API_URL_PREFIX.self::MASS_PREVIEW_URL.'access_token='.$this->access_token,self::json_encode($data));
+	    if ($result)
+	    {
+	        $json = json_decode($result,true);
+	        if (!$json || !empty($json['errcode'])) {
+	            $this->errCode = $json['errcode'];
+	            $this->errMsg = $json['errmsg'];
+	            return false;
+	        }
+	        return $json;
+	    }
+	    return false;
+	}
+	
+	/**
+	 * 高级群发消息, 查询群发消息发送状态(认证后的订阅号可用)
+	 * @param int $msg_id 消息id
+	 * @return boolean|array
+	 * {
+	 *     "msg_id":201053012,     //群发消息后返回的消息id
+	 *     "msg_status":"SEND_SUCCESS" //消息发送后的状态,SEND_SUCCESS表示发送成功
+	 * }
+	 */
+	public function queryMassMessage($msg_id){
+		if (!$this->access_token && !$this->checkAuth()) return false;
+		$result = $this->http_post(self::API_URL_PREFIX.self::MASS_QUERY_URL.'access_token='.$this->access_token,self::json_encode(array('msg_id'=>$msg_id)));
+		if ($result)
+		{
+			$json = json_decode($result,true);
+			if (!$json || !empty($json['errcode'])) {
+				$this->errCode = $json['errcode'];
+				$this->errMsg = $json['errmsg'];
+				return false;
+			}
+			return true;
+		}
+		return false;n
+	}
+	
+	/**
 	 * 创建二维码ticket
 	 * @param int $scene_id 自定义追踪id
 	 * @param int $type 0:临时二维码;1:永久二维码(此时expire参数无效)

+ 155 - 12
wechat.class.php

@@ -81,8 +81,11 @@ class Wechat
 	const TEMPLATE_SEND_URL = '/message/template/send?';
 	const MASS_SEND_GROUP_URL = '/message/mass/sendall?';
 	const MASS_DELETE_URL = '/message/mass/delete?';
+	const MASS_PREVIEW_URL = '/message/mass/xxxx?';
+	const MASS_QUERY_URL = '/message/mass/xxxx?';
 	const UPLOAD_MEDIA_URL = 'http://file.api.weixin.qq.com/cgi-bin';
 	const MEDIA_UPLOAD = '/media/upload?';
+	const MEDIA_VIDEO_UPLOAD = '/media/uploadvideo?';
 	const OAUTH_PREFIX = 'https://open.weixin.qq.com/connect/oauth2';
 	const OAUTH_AUTHORIZE_URL = '/authorize?';
 	const OAUTH_TOKEN_PREFIX = 'https://api.weixin.qq.com/sns/oauth2';
@@ -554,8 +557,9 @@ class Wechat
 	}
 	
 	/**
-	* 获取模板消息ID
+	* 获取主动推送的消息ID
 	* 经过验证,这个和普通的消息MsgId不一样
+	* 当Event为 MASSSENDJOBFINISH 或 TEMPLATESENDJOBFINISH
 	*/
 	public function getRevTplMsgID(){
 		if (isset($this->_receive['MsgID'])){
@@ -574,6 +578,32 @@ class Wechat
 			return false;
 	}
 	
+	/**
+	* 获取群发或模板消息发送结果
+	* 当Event为 MASSSENDJOBFINISH 或 TEMPLATESENDJOBFINISH,即高级群发/模板消息
+	*/
+	public function getRevResult(){
+		if (isset($this->_receive['Status'])) //发送是否成功,具体的返回值请参考 高级群发/模板消息 的事件推送说明
+			$array['Status'] = $this->_receive['Status'];
+		if (isset($this->_receive['MsgID'])) //发送的消息id
+			$array['MsgID'] = $this->_receive['MsgID'];
+		
+		//以下仅当群发消息时才会有的事件内容
+		if (isset($this->_receive['TotalCount']))     //分组或openid列表内粉丝数量
+			$array['TotalCount'] = $this->_receive['TotalCount'];
+		if (isset($this->_receive['FilterCount']))    //过滤(过滤是指特定地区、性别的过滤、用户设置拒收的过滤,用户接收已超4条的过滤)后,准备发送的粉丝数
+			$array['FilterCount'] = $this->_receive['FilterCount'];
+		if (isset($this->_receive['SentCount']))     //发送成功的粉丝数
+			$array['SentCount'] = $this->_receive['SentCount'];
+		if (isset($this->_receive['ErrorCount']))    //发送失败的粉丝数
+			$array['ErrorCount'] = $this->_receive['ErrorCount'];
+		if (isset($array) && count($array) > 0) {
+		    return $array;
+		} else {
+		    return false;
+		}
+	}
+	
 	public static function xmlSafeStr($str)
 	{   
 		return '<![CDATA['.preg_replace("/[\\x00-\\x08\\x0b-\\x0c\\x0e-\\x1f]/",'',$str).']]>';   
@@ -998,7 +1028,7 @@ class Wechat
 	}
 
 	/**
-	 * 创建菜单
+	 * 创建菜单(认证后的订阅号可用)
 	 * @param array $data 菜单数组数据
 	 * example:
      * 	array (
@@ -1067,7 +1097,7 @@ class Wechat
 	}
 	
 	/**
-	 * 获取菜单
+	 * 获取菜单(认证后的订阅号可用)
 	 * @return array('menu'=>array(....s))
 	 */
 	public function getMenu(){
@@ -1087,7 +1117,7 @@ class Wechat
 	}
 	
 	/**
-	 * 删除菜单
+	 * 删除菜单(认证后的订阅号可用)
 	 * @return boolean
 	 */
 	public function deleteMenu(){
@@ -1107,7 +1137,7 @@ class Wechat
 	}
 
 	/**
-	 * 上传多媒体文件
+	 * 上传多媒体文件(认证后的订阅号可用)
 	 * 注意:数组的键值任意,但文件名前必须加@,使用单引号以避免本地路径斜杠被转义
 	 * @param array $data {"media":'@Path\filename.jpg'}
 	 * @param type 类型:图片:image 语音:voice 视频:video 缩略图:thumb
@@ -1130,7 +1160,7 @@ class Wechat
 	}
 	
 	/**
-	 * 根据媒体文件ID获取媒体文件
+	 * 根据媒体文件ID获取媒体文件(认证后的订阅号可用)
 	 * @param string $media_id 媒体文件id
 	 * @return raw data
 	 */
@@ -1151,7 +1181,7 @@ class Wechat
 	}
 
 	/**
-	 * 上传图文消息素材
+	 * 上传图文消息素材(认证后的订阅号可用)
 	 * @param array $data 消息结构{"articles":[{...}]}
 	 * @return boolean|array
 	 */
@@ -1170,10 +1200,54 @@ class Wechat
 		}
 		return false;
 	}
+
+	/**
+	 * 上传视频素材(认证后的订阅号可用)
+	 * @param array $data 消息结构
+	 * {
+	 *     "media_id"=>"",     //通过上传媒体接口得到的MediaId
+	 *     "title"=>"TITLE",    //视频标题
+	 *     "description"=>"Description"        //视频描述
+	 * }
+	 * @return boolean|array
+	 * {
+	 *     "type":"video",
+	 *     "media_id":"mediaid",
+	 *     "created_at":1398848981
+	 *  }
+	 */
+	public function uploadMpVideo($data){
+	    if (!$this->access_token && !$this->checkAuth()) return false;
+	    $result = $this->http_post(self::UPLOAD_MEDIA_URL.self::MEDIA_VIDEO_UPLOAD.'access_token='.$this->access_token,self::json_encode($data));
+	    if ($result)
+	    {
+	        $json = json_decode($result,true);
+	        if (!$json || !empty($json['errcode'])) {
+	            $this->errCode = $json['errcode'];
+	            $this->errMsg = $json['errmsg'];
+	            return false;
+	        }
+	        return $json;
+	    }
+	    return false;
+	}
 	
 	/**
-	 * 高级群发消息, 根据OpenID列表群发图文消息
-	 * @param array $data 消息结构{ "touser":[ "OPENID1", "OPENID2" ], "mpnews":{ "media_id":"123dsdajkasd231jhksad" }, "msgtype":"mpnews" }
+	 * 高级群发消息, 根据OpenID列表群发图文消息(订阅号不可用)
+	 * 	注意:视频需要在调用uploadMedia()方法后,再使用 uploadMpVideo() 方法生成,
+	 *             然后获得的 mediaid 才能用于群发,且消息类型为 mpvideo 类型。
+	 * @param array $data 消息结构
+	 * {
+	 *     "touser"=>array(
+	 *         "OPENID1",
+	 *         "OPENID2"
+	 *     ),
+	 *      "msgtype"=>"mpvideo", 
+	 *      // 在下面5种类型中选择对应的参数内容
+	 *      // mpvideo =>array ( "media_id"=>"MediaId", "title"=>"TITLE", "description"=>"Description" )
+	 *      // mpnews | voice | image => array( "media_id"=>"MediaId")
+	 *      // text => array ( "content" => "hello")
+	 * }
 	 * @return boolean|array
 	 */
 	public function sendMassMessage($data){
@@ -1193,8 +1267,21 @@ class Wechat
 	}
 	
 	/**
-	 * 高级群发消息, 根据群组id群发图文消息
-	 * @param array $data 消息结构{ "filter":[ "group_id": "2" ], "mpnews":{ "media_id":"123dsdajkasd231jhksad" }, "msgtype":"mpnews" }
+	 * 高级群发消息, 根据群组id群发图文消息(认证后的订阅号可用)
+	 * 	注意:视频需要在调用uploadMedia()方法后,再使用 uploadMpVideo() 方法生成,
+	 *             然后获得的 mediaid 才能用于群发,且消息类型为 mpvideo 类型。
+	 * @param array $data 消息结构
+	 * {
+	 *     "filter"=>array( 
+	 *         "is_to_all"=>False,     //是否群发给所有用户.True不用分组id,False需填写分组id
+	 *         "group_id"=>"2"     //群发的分组id
+	 *     ),
+	 *      "msgtype"=>"mpvideo", 
+	 *      // 在下面5种类型中选择对应的参数内容
+	 *      // mpvideo =>array ( "media_id"=>"MediaId", "title"=>"TITLE", "description"=>"Description" )
+	 *      // mpnews | voice | image => array( "media_id"=>"MediaId")
+	 *      // text => array ( "content" => "hello")
+	 * }
 	 * @return boolean|array
 	 */
 	public function sendGroupMassMessage($data){
@@ -1214,7 +1301,7 @@ class Wechat
 	}
 	
 	/**
-	 * 高级群发消息, 删除群发图文消息
+	 * 高级群发消息, 删除群发图文消息(认证后的订阅号可用)
 	 * @param int $msg_id 消息id
 	 * @return boolean|array
 	 */
@@ -1235,6 +1322,62 @@ class Wechat
 	}
 	
 	/**
+	 * 高级群发消息, 预览群发消息(认证后的订阅号可用)
+	 * 	注意:视频需要在调用uploadMedia()方法后,再使用 uploadMpVideo() 方法生成,
+	 *             然后获得的 mediaid 才能用于群发,且消息类型为 mpvideo 类型。
+	 * @param array $data 消息结构
+	 * {
+	 *     "touser"=>"OPENID",
+	 *      "msgtype"=>"mpvideo",
+	 *      // 在下面5种类型中选择对应的参数内容
+	 *      // mpvideo =>array ( "media_id"=>"MediaId", "title"=>"TITLE", "description"=>"Description" )
+	 *      // mpnews | voice | image => array( "media_id"=>"MediaId")
+	 *      // text => array ( "content" => "hello")
+	 * }
+	 * @return boolean|array
+	 */
+	public function previewMassMessage($data){
+	    if (!$this->access_token && !$this->checkAuth()) return false;
+	    $result = $this->http_post(self::API_URL_PREFIX.self::MASS_PREVIEW_URL.'access_token='.$this->access_token,self::json_encode($data));
+	    if ($result)
+	    {
+	        $json = json_decode($result,true);
+	        if (!$json || !empty($json['errcode'])) {
+	            $this->errCode = $json['errcode'];
+	            $this->errMsg = $json['errmsg'];
+	            return false;
+	        }
+	        return $json;
+	    }
+	    return false;
+	}
+	
+	/**
+	 * 高级群发消息, 查询群发消息发送状态(认证后的订阅号可用)
+	 * @param int $msg_id 消息id
+	 * @return boolean|array
+	 * {
+	 *     "msg_id":201053012,     //群发消息后返回的消息id
+	 *     "msg_status":"SEND_SUCCESS" //消息发送后的状态,SEND_SUCCESS表示发送成功
+	 * }
+	 */
+	public function queryMassMessage($msg_id){
+		if (!$this->access_token && !$this->checkAuth()) return false;
+		$result = $this->http_post(self::API_URL_PREFIX.self::MASS_QUERY_URL.'access_token='.$this->access_token,self::json_encode(array('msg_id'=>$msg_id)));
+		if ($result)
+		{
+			$json = json_decode($result,true);
+			if (!$json || !empty($json['errcode'])) {
+				$this->errCode = $json['errcode'];
+				$this->errMsg = $json['errmsg'];
+				return false;
+			}
+			return true;
+		}
+		return false;n
+	}
+	
+	/**
 	 * 创建二维码ticket
 	 * @param int $scene_id 自定义追踪id
 	 * @param int $type 0:临时二维码;1:永久二维码(此时expire参数无效)