php调用返回成功,但是没有收到

收不到消息
标签: #<Tag:0x00007fb83cab0738>

(Linyueb) #1

返回报文

array(3) {
  ["body"]=>
  array(2) {
    ["sendno"]=>
    string(10) "1946453416"
    ["msg_id"]=>
    string(10) "1091221494"
  }
  ["http_code"]=>
  int(200)
  ["headers"]=>
  array(10) {
    [0]=>
    string(15) "HTTP/1.1 200 OK"
    ["Server"]=>
    string(5) "nginx"
    ["Date"]=>
    string(29) "Thu, 21 Dec 2017 02:43:22 GMT"
    ["Content-Type"]=>
    string(16) "application/json"
    ["Transfer-Encoding"]=>
    string(7) "chunked"
    ["Connection"]=>
    string(10) "keep-alive"
    ["X-Rate-Limit-Limit"]=>
    string(3) "600"
    ["X-Rate-Limit-Remaining"]=>
    string(3) "598"
    ["X-Rate-Limit-Reset"]=>
    string(2) "32"
    ["X-JPush-MsgId"]=>
    string(10) "1091221494"
  }
}

日志

Send POST https://api.jpush.cn/v3/push, body:{"platform":"all","audience":{"alias":["99"]},"notification":{"alert":"Hi, Jamjam"},"message":{"msg_content":"\u6d4b\u8bd5","title":"\u4f60\u6709\u65b0\u7684\u804a\u5929\u6d88\u606f","content_type":"text","extras":{"key":"value","0":"jiguang"}},"options":{"sendno":2103544434,"apns_production":false}}, times:1
Send POST https://api.jpush.cn/v3/push, body:{"platform":"all","audience":{"alias":["613"]},"notification":{"alert":"\u4f60\u6709\u4e00\u6761\u65b0\u6d88\u606f"},"message":{"msg_content":"","title":"\u4f60\u6709\u65b0\u7684\u804a\u5929\u6d88\u606f","content_type":"text","extras":{"key":"value"}},"options":{"sendno":404442818,"apns_production":false}}, times:1
Send POST https://api.jpush.cn/v3/push, body:{"platform":"all","audience":{"alias":["613"]},"notification":{"alert":"\u4f60\u6709\u4e00\u6761\u65b0\u6d88\u606f"},"message":{"msg_content":"","title":"\u4f60\u6709\u65b0\u7684\u804a\u5929\u6d88\u606f","content_type":"text","extras":{"key":"value"}},"options":{"sendno":1946453416,"apns_production":false}}, times:1

(Linyueb) #2

代码

$client = new \JPush\Client(env('JPUSH_APP_KEY'), env('JPUSH_MASTER_SECRET'));
        $res = $client->push()
            ->setPlatform('all')
            ->addAlias('613')
            ->message($content->content??"", array(
                'title' => '你有新的聊天消息',
                'content_type' => 'text',
                'extras' => array(
                    'key' => 'value',
                ),
            ))
            ->setNotificationAlert($content->content??"你有一条新消息")
            ->send();

#3

收不到消息的问题:请提供推送的消息的msgid(MessageID)和收不到这条消息的设备的registrationID(在客户端获取,无论以何种方式(别名标签或广播)做推送,该信息必须提供)

为什么要求一定要提供 registrationID 给我,因为你很有可能别名下有很多个目标,别名设置失败,推送的AppKey和设备对应的AppKey不一致等等,只有通过registrationID才能确确实实的查询到具体的设备收不到的原因!

这两个信息如何获取: 极光产品相关提问简要说明


(Linyueb) #4

msgid是1092803922,我是用alias来推的,我是用用户的id来设置alias,所以用户用别的账号登录我会重新设置一下这太设备的Alias


#5

这里说明了需要提供registrationID,请让你们客户端取获取ID并提供给我

如果你是线上用户拿不到 ID,那么请先给我 AppKey,无registrationID不保证查询结果100%正确


(Linyueb) #6

我都说了没有registrationID,只是设置别名而已,推送一定要设置registrationID?


#8

请你提供我所需要的信息,最起码提供 AppKey。


(Linyueb) #9

750a959744ba108d4623b3b7


#10

1、如果确定 别名设置成功,该别名下只有这一个App,那么查询结果是环境不一致

2、API推送消息给iOS,需要指定推送的环境!请让后台修改apns_production,false是开发,true是生产。

客户端的环境与证书有关!
关于测试两种环境的说明: 常见问题 - JPush 合集(持续更新)