Skip to content

Commit

Permalink
任务取消 内容上传
Browse files Browse the repository at this point in the history
  • Loading branch information
wuwu123 committed Aug 17, 2019
1 parent 1fac843 commit 62cd1d5
Show file tree
Hide file tree
Showing 3 changed files with 101 additions and 3 deletions.
62 changes: 59 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,11 +1,67 @@
## 友盟消息推送
开发阶段

### 安装

```text
composer require wujie/youmeng
```

### demo

#### 设置配置文件
```php
<?php
$config = new \Youmeng\Config\Config([
'appKey' => '',
'masterSecret' => '',
'retryNum' => 1,//失败重试次数
'production_mode' => 'true'
]);
```

##### 功能
1. 用户单个或者批量推送
#### 推送

```php
<?php

$comMessage = (new \Youmeng\Push\CommonMessage())
->setTitle("")
->setDesc("")
->setMessageType(\Youmeng\Push\Message::TYPE_CUSTOMIZE_CAST)
->setMessageData($alidateId)
->setOtherParams([]);

$sendRequest = new \Youmeng\Request\SendRequest($config);
$data = $sendRequest->androidMessage($signId, $comMessage);

```


#### 查询推送状态

```php

<?php
(new \Youmeng\Request\StatusRequest($config))->status($taskId);

```

#### 取消定时任务

```php
<?php
(new \Youmeng\Request\CancelRequest($config))->cancel($taskId);

```


#### 上传任务

```php

<?php

(new \Youmeng\Request\UpdateRequest($config))->update($content);
```
21 changes: 21 additions & 0 deletions src/Request/CancelRequest.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
<?php


namespace Youmeng\Request;


class CancelRequest extends BaseRequest
{

/**
* 取消定时任务
* @param string $taskId
* @return array
*/
public function cancel(string $taskId)
{
$this->requestModel->post('api/cancel', ['task_id', $taskId]);
return [$this->requestModel->isOk(), $this->requestModel->getData()];
}

}
21 changes: 21 additions & 0 deletions src/Request/UpdateRequest.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
<?php


namespace Youmeng\Request;


class UpdateRequest extends BaseRequest
{

/**
* 文件上传
* @param string $content
* @return array
*/
public function update(string $content)
{
$this->requestModel->post('update', ['content' => $content]);
return [$this->requestModel->isOk(), $this->requestModel->getData()];
}

}

0 comments on commit 62cd1d5

Please sign in to comment.