/** * 发送消息 * * @param unknown $title * @param unknown $content * @param unknown $msgid * @param unknown $RegistrationID * @param unknown $extras * @param number $type 0 安卓 1 ios * @return Ambigous <MessageResult, unknown> */ public function PushMsg($title, $content, $msgid, $RegistrationID, $extras, $type = 0) { Yii::import('application.extensions.jpush.*'); require_once 'JPushClient.php'; $this->master_secret = Yii::app()->params[11]['master_secret']; $this->app_key = Yii::app()->params[11]['app_key']; if ($type == 1) { $client = new JpushClient($this->app_key, $this->master_secret, 0, 'ios', false); $params = array("receiver_type" => 5, "receiver_value" => $RegistrationID, "sendno" => $msgid, "send_description" => "", "override_msg_id" => ""); $ret = $client->sendNotification($title, $params, $extras); } else { $client = new JPushClient($this->app_key, $this->master_secret, 0, 'android', false); $params = array("receiver_type" => 5, "receiver_value" => $RegistrationID, "sendno" => $msgid, "send_description" => "", "override_msg_id" => ""); $ret = $client->sendCustomMessage($title, $content, $params, $extras); } // // return $ret; }