jpush/jpush-api-php-client

大量API 404错误,推送各种失败

Closed this issue · 21 comments

image

除了

https://api.jpush.cn/v3/schedules/
https://device.jpush.cn/v3/devices/
https://bjapi.push.jiguang.cn/v3/device/
其他都挂了,范湖404错误

都怪我,手贱打了php composer update

那个变量名确实是我这边疏忽写错了,不过 404 的话,请问能举个例子吗,我运行是没有问题的
image

加你们群没人回。

使用的是laravel 5.4

php 7.0.4
执行php composer update 后出现这些问题的
上一个版本是3.5.12

config.php 配置

<?php
namespace JPush;

class Config {
    const DISABLE_SOUND = "_disable_Sound";
    const DISABLE_BADGE = 0x10000;
    const USER_AGENT = 'JPush-API-PHP-Client';
    const CONNECT_TIMEOUT = 20;
    const READ_TIMEOUT = 120;
    const DEFAULT_MAX_RETRY_TIMES = 3;
    const DEFAULT_LOG_FILE = "./jpush.log";
    const HTTP_GET = 'GET';
    const HTTP_POST = 'POST';
    const HTTP_DELETE = 'DELETE';
    const HTTP_PUT = 'PUT';
    const ZONES = [
        'URL' => [
            'push' => 'https://api.jpush.cn/v3/',
            'report' => 'https://report.jpush.cn/v3/',
            'device' => 'https://device.jpush.cn/v3/devices/',
            //'alias' => 'https://device.jpush.cn/v3/alias/',
            'alias' => 'https://device.jpush.cn/v3/aliases/',
            'tag' => 'https://device.jpush.cn/v3/tag/',
            'schedule' => 'https://api.jpush.cn/v3/schedules/',
            'admin' => 'https://admin.jpush.cn/v1/'
        ],
        'BJ' => [
            'push' => 'https://bjapi.push.jiguang.cn/v3/',
            'report' => 'https://bjapi.push.jiguang.cn/v3/report/',
            'device' => 'https://bjapi.push.jiguang.cn/v3/device/',
            //'alias' => 'https://bjapi.push.jiguang.cn/v3/alias/',
            'alias' => 'https://device.jpush.cn/v3/aliases/',
            'tag' => 'https://bjapi.push.jiguang.cn/v3/tag/',
            'schedules' => 'https://bjapi.push.jiguang.cn/v3/push/schedules/',
            'admin' => 'https://admin.jpush.cn/v1/'
        ]
    ];
}

alias 地址改为旧版就正常,但是又报了 {"status":-1,"message":"Unknown: build_id"} 错误

业务代码

public function pushMes($apiKey, $secret, $alias, $info)
    {
        $log = '/data/www/xxx.com/xxx.com/storage/logs/jpush.log';
        $client = new JPush($apiKey, $secret, $log);

        // 获取指定Alias下的设备
        $result = $client->device()->getAliasDevices($alias);
        $registration_ids = $result['body']['registration_ids'];
        if (!empty($registration_ids)) {
            $push = $client->push()
                ->setPlatform(['ios', 'android'])
                ->addAlias($alias)
                ->androidNotification('请及时处理!', [
                        'title'    => '你好, ' . $info['store_name'] . '有新的订单!',
                        'build_id' => 2,
                        'extras'   => [
                            'key' => $info
                        ]
                    ]
                )
                ->iosNotification('你好, ' . $info['store_name'] . '有新的订单,请及时处理!', [
                    'sound'  => 'waimai.w4a',
                    'badge'  => '+1',
                    'extras' => [
                        'key' => $info
                    ]
                ])->send();
        }
    }

@helperhaps 大佬,帮帮忙啊,项目没法上线了啊。

是我别名的 url 写错了 😭

还有其他的问题吗,还是就 alias

@helperhaps 改了名字之后就报了 {"status":-1,"message":"Unknown: build_id"} 错误
我完全是懵逼的。那些api地址要不要都看下哪些错了?

@helperhaps 因为好几个访问都是404,就是我上图截图的那些红快的那些api您最好都试一遍,就三个正方返回json,其他全都404

@helperhaps 目前暂时下架所有消息推送。。。我sun

我被老板怼了

抱歉,给你造成困扰

你可以升级到 3.5.29 试下

@helperhaps 提示{"status":-1,"message":"Unknown: build_id"}

[2018-01-18 16:02:11] local.INFO: Unknown: build_id /data/www/xxx.com/xx.xxx.com/vendor/jpush/jpush/src/JPush/Http.php 130 #0 /data/www/xxx.com/xxx.xxx.com/vendor/jpush/jpush/src/JPush/Http.php(15): JPush\Http::processResp(Array)
#1 /data/www/xxx.com/xxx.com/vendor/jpush/jpush/src/JPush/PushPayload.php(321): JPush\Http::post(Object(JPush\Client), 'https://api.jpu...', Array)
#2 /data/www/xxx.com/xxx.com/app/Http/Controllers/Controller.php(184): JPush\PushPayload->send()

没有 build_id 这个东西,是 builder_id

另外没有大版本变动,代码都是向下兼容的

@helperhaps 我知道啊。求改求发版本,我不想动本地的vendor,你改完打一个released,我直接compose update,我怕本地改了什么,下次再update一样覆盖

打了啊上面说了 3.5.29 现在是疯狂发版本,你升级便是

@helperhaps 尴尬了,哈哈哈嗝

ok 了吗

@helperhaps 不OK啊,还是那个 {"status":-1,"message":"Unknown: build_id"}

这个错误的格式不是极光推送返回的