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

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

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

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

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

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

这份代码是我通过友盟提供的 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']);

}

}

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

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值