Video.php 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182
  1. <?php
  2. /*
  3. * This file is part of the overtrue/wechat.
  4. *
  5. * (c) overtrue <i@overtrue.me>
  6. *
  7. * This source file is subject to the MIT license that is bundled
  8. * with this source code in the file LICENSE.
  9. */
  10. /**
  11. * Video.php.
  12. *
  13. * @author overtrue <i@overtrue.me>
  14. * @copyright 2015 overtrue <i@overtrue.me>
  15. *
  16. * @see https://github.com/overtrue
  17. * @see http://overtrue.me
  18. */
  19. namespace EasyWeChat\Message;
  20. /**
  21. * Class Video.
  22. *
  23. * @property string $video
  24. * @property string $title
  25. * @property string $media_id
  26. * @property string $description
  27. * @property string $thumb_media_id
  28. */
  29. class Video extends AbstractMessage
  30. {
  31. /**
  32. * Message type.
  33. *
  34. * @var string
  35. */
  36. protected $type = 'video';
  37. /**
  38. * Properties.
  39. *
  40. * @var array
  41. */
  42. protected $properties = [
  43. 'title',
  44. 'description',
  45. 'media_id',
  46. 'thumb_media_id',
  47. ];
  48. /**
  49. * 设置视频消息.
  50. *
  51. * @param string $mediaId
  52. *
  53. * @return Video
  54. */
  55. public function media($mediaId)
  56. {
  57. $this->setAttribute('media_id', $mediaId);
  58. return $this;
  59. }
  60. /**
  61. * 设置视频封面.
  62. *
  63. * @param string $mediaId
  64. *
  65. * @return Video
  66. */
  67. public function thumb($mediaId)
  68. {
  69. $this->setAttribute('thumb_media_id', $mediaId);
  70. return $this;
  71. }
  72. }