2019-01-29 05:56:25 +00:00
|
|
|
<?php
|
|
|
|
|
|
|
|
namespace Wechat\Work;
|
|
|
|
|
2019-02-19 07:58:00 +00:00
|
|
|
use Wechat\Work\MessageInterface;
|
2019-01-29 05:56:25 +00:00
|
|
|
|
2019-02-19 07:58:00 +00:00
|
|
|
class Message
|
|
|
|
{
|
2019-01-29 05:56:25 +00:00
|
|
|
|
2019-02-19 07:58:00 +00:00
|
|
|
/**
|
|
|
|
* @var Work
|
|
|
|
*/
|
|
|
|
protected $work;
|
2019-01-29 05:56:25 +00:00
|
|
|
|
2019-02-19 07:58:00 +00:00
|
|
|
public function __construct($work)
|
2019-01-29 05:56:25 +00:00
|
|
|
{
|
2019-02-19 07:58:00 +00:00
|
|
|
$this->work = $work;
|
2019-01-29 05:56:25 +00:00
|
|
|
}
|
|
|
|
|
2019-02-19 07:58:00 +00:00
|
|
|
public function send($msg)
|
2019-01-29 05:56:25 +00:00
|
|
|
{
|
2019-02-19 07:58:00 +00:00
|
|
|
$request = $this->work->transformForJsonRequest('message/send',
|
2019-02-19 08:14:18 +00:00
|
|
|
$msg->toArray() + ['agentid' => $this->work->getAgentId()]);
|
2019-02-19 07:58:00 +00:00
|
|
|
return $this->work->request($request);
|
2019-01-29 05:56:25 +00:00
|
|
|
}
|
|
|
|
}
|