有人用过友盟消息推送 API 吗?有个很奇怪的问题求教!

2017-07-26 17:33:24 +08:00
 ranwu

通过调用友盟消息推送 API 可以提供发送消息,查看消息状态,撤销消息等功能。在使用“查看消息状态”功能后,始终提示:

Http code:400 details:{"ret":"FAIL","data":{"error_code":"2008"}}

我知道这是 JSON 格式错误,但我可以 100%确定我的数据格式没问题。

此代码在上午的时候可以正常查询,到了下午后就显示这个错误了,我保证此期间没有更改过代码!

还有我想吐槽的是友盟的客服,不知道是不是专业的客服,总之他一口咬定就是我的错,而不是去确认此事,非常不爽!

代码库:友盟推送 SDK:https://github.com/xiaolei16fan/umeng

这份代码是我通过友盟提供的 PHP 版本的开发包来修改的。关于查询消息状态的测试代码:

<?php

namespace Notification;

use PHPUnit\Framework\TestCase;
use UmengPush\MessageStatus;

/**
 * Class MessageStatusTest 消息发送状态
 * @package Notification
 */
class MessageStatusTest extends TestCase
{
    protected $appkey = null;
    protected $appMasterSecret = null;
    protected $timestamp = null;
    protected $taskId = null;

    protected function setUp()
    {
        $this->appkey = '';
        $this->appMasterSecret = '';
        $this->taskId = '';
        $this->timestamp = strval(time());
    }

    public function testMessageStatus()
    {
        $messageStatus = new MessageStatus();
        $messageStatus->setAppMasterSecret($this->appMasterSecret);
        $messageStatus->setPredefinedKeyValue('appkey', $this->appkey);
        $messageStatus->setPredefinedKeyValue('timestamp', $this->timestamp);
        $messageStatus->setPredefinedKeyValue('task_id', $this->taskId);
        $result = json_decode($messageStatus->send(), true);
        $this->assertEquals('SUCCESS', $result['ret']);
    }
}

这个问题已经困扰我很久了,不得已才求助大家!谢谢了!

2415 次点击
所在节点    PHP
1 条回复
luulsj
2017-07-27 09:39:24 +08:00
所以你发送的消息内容到底是什么,都不贴出来别人如何给你看什么问题

这是一个专为移动设备优化的页面(即为了让你能够在 Google 搜索结果里秒开这个页面),如果你希望参与 V2EX 社区的讨论,你可以继续到 V2EX 上打开本讨论主题的完整版本。

https://www.v2ex.com/t/378151

V2EX 是创意工作者们的社区,是一个分享自己正在做的有趣事物、交流想法,可以遇见新朋友甚至新机会的地方。

V2EX is a community of developers, designers and creative people.

© 2021 V2EX