Merge branch 'feature/media_upload' into 'master'

增效图片消息

See merge request composer/php-wechat-sdk!1
This commit is contained in:
董巍 2019-07-10 17:42:30 +08:00
commit 98f05653ad
2 changed files with 23 additions and 0 deletions

View File

@ -67,6 +67,13 @@ abstract class MessageInterface
$this->type => $this->attr,
]);
break;
case self::TYPE_IMAGE:
$params = array_merge($params, [
$this->type => [
'media_id' => $this->attr['media_id'],
],
]);
break;
default:
throw new \Exception('message type ' . $this->type . ' is not allow');
}

View File

@ -0,0 +1,16 @@
<?php
namespace Wechat\Work\Message;
use Wechat\Work\Message\MessageInterface;
class TextImageMessage extends MessageInterface
{
public function __construct($content)
{
$this->type = self::TYPE_IMAGE;
$this->attr['media_id'] = $content;
}
}