Ejemplo n.º 1
0
 /**
  * 推送消息 广播  
  *
  * @param  int   	$master_secret			//秘钥
  * @param  int   	$app_key 				//app_key
  * @param  string	$title 				//推送消息标题
  * @param  int		$msgid 				//女神消息ID
  * @param  string	$RegistrationID 		//用户手机标识
  * @param  string	$extras 				//扩展消息json
  * 						{"id":"消息ID","type":"消息类型","text":"消息文本","image":"消息图片",
  * 							"url":"链接","time":"消息事件","goddess_id":"女神ID",
  * 							"goddess_face":"女神头像","goddess_name":"女神名称"}
  * 				$type		2、指定的 tag。3、指定的 alias。4、广播:对 app_key 下的所有用户推送消息。 5 RegistrationID
  * @return array 	$ret  				//返回
  */
 public function pushAllMsg($title, $msgid, $RegistrationID)
 {
     $this->master_secret = Yii::app()->params[10]['master_secret'];
     $this->app_key = Yii::app()->params[10]['app_key'];
     $client = new JPushClient($this->app_key, $this->master_secret);
     $params = array("receiver_type" => 4, "receiver_value" => $RegistrationID, "sendno" => $msgid, "send_description" => "", "override_msg_id" => "");
     $heroine_message = Message::model()->getGoddessMessRow($msgid);
     $ret = $client->sendNotification($title, $params, $heroine_message);
     return $ret;
 }