通过调用友盟消息推送 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']); } }
这个问题已经困扰我很久了,不得已才求助大家!谢谢了!
![]() | 1 luulsj 2017-07-27 09:39:24 +08:00 所以你发送的消息内容到底是什么,都不贴出来别人如何给你看什么问题 |