jdmm/noticepush

专门针对iot推送

1.0.10.x-dev 2021-06-03 01:16 UTC

This package is auto-updated.

Last update: 2024-03-29 04:45:48 UTC


README

介绍

jdmm/noticepush是一个基于saber的组件,目前仅支持post

安装

composer require jdmm/noticepush

注意

添加配置文件(以下为测试数据)

url: 39.96.31.118:8000
appkey: APP000005
masterSecret: 3333333333333333
pushUrl: /jdiot/api/push/push  //可以在这里定义也可以在代码里写

使用

发布消息

发布消息

<?php

$path = config('iot_api.pushUrl');
$mac = '98:98:93:00:00:08';
$appkey = config('iot_api.appkey');
$masterSecret = config('iot_api.masterSecret');
//如要iot其他参数放到 $message
$message = [
  'content' => 'teadgfdafdas'
];
$push = new NoticePush();
$res = $push->iotPost(config('iot_api.url').$path,$mac,$message,$appkey,$masterSecret);

返回格式

$res = [
	'statusCode' => 200, // http状态码
   'body' => []  //从接口返回的内容
];