AttachmentNews.php 3.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798
  1. <?php
  2. namespace addons\Wechat\common\models;
  3. use common\behaviors\MerchantBehavior;
  4. /**
  5. * This is the model class for table "{{%addon_wechat_attachment_news}}".
  6. *
  7. * @property int $id
  8. * @property int|null $merchant_id 商户id
  9. * @property int|null $store_id 店铺ID
  10. * @property int|null $attachment_id 关联的资源id
  11. * @property string $title 标题
  12. * @property string|null $thumb_media_id 图文消息的封面图片素材id(必须是永久mediaID)
  13. * @property string|null $thumb_url 缩略图Url
  14. * @property string|null $author 作者
  15. * @property string|null $digest 简介
  16. * @property int|null $show_cover_pic 0为false,即不显示,1为true,即显示
  17. * @property string|null $content 图文消息的具体内容,支持HTML标签,必须少于2万字符
  18. * @property string|null $content_source_url 图文消息的原文地址,即点击“阅读原文”后的URL
  19. * @property string|null $media_url 资源Url
  20. * @property int|null $need_open_comment 是否打开评论 0不打开,1打开
  21. * @property int|null $only_fans_can_comment 是否粉丝才可评论 0所有人可评论,1粉丝才可评论
  22. * @property int|null $sort 排序
  23. * @property int|null $year 年份
  24. * @property int|null $month 月份
  25. * @property int|null $day 日
  26. * @property int $status 状态[-1:删除;0:禁用;1启用]
  27. * @property int|null $created_at 创建时间
  28. * @property int|null $updated_at 修改时间
  29. */
  30. class AttachmentNews extends \common\models\base\BaseModel
  31. {
  32. use MerchantBehavior;
  33. /**
  34. * {@inheritdoc}
  35. */
  36. public static function tableName()
  37. {
  38. return '{{%addon_wechat_attachment_news}}';
  39. }
  40. /**
  41. * {@inheritdoc}
  42. */
  43. public function rules()
  44. {
  45. return [
  46. [['merchant_id', 'store_id', 'attachment_id', 'show_cover_pic', 'need_open_comment', 'only_fans_can_comment', 'sort', 'year', 'month', 'day', 'status', 'created_at', 'updated_at'], 'integer'],
  47. [['content'], 'string'],
  48. [['title'], 'string', 'max' => 50],
  49. [['thumb_url', 'media_url'], 'string', 'max' => 500],
  50. [['digest', 'content_source_url', 'thumb_media_id'], 'string', 'max' => 200],
  51. [['author'], 'string', 'max' => 64],
  52. ];
  53. }
  54. /**
  55. * {@inheritdoc}
  56. */
  57. public function attributeLabels()
  58. {
  59. return [
  60. 'id' => 'ID',
  61. 'merchant_id' => '商户id',
  62. 'store_id' => '店铺ID',
  63. 'attachment_id' => '关联的资源id',
  64. 'title' => '标题',
  65. 'thumb_media_id' => '图文消息的封面图片素材id(必须是永久mediaID)',
  66. 'thumb_url' => '缩略图Url',
  67. 'author' => '作者',
  68. 'digest' => '简介',
  69. 'show_cover_pic' => '0为false,即不显示,1为true,即显示',
  70. 'content' => '图文消息的具体内容,支持HTML标签,必须少于2万字符',
  71. 'content_source_url' => '图文消息的原文地址,即点击“阅读原文”后的URL',
  72. 'media_url' => '资源Url',
  73. 'need_open_comment' => '是否打开评论', // 0 不打开,1打开
  74. 'only_fans_can_comment' => '是否粉丝才可评论', // 0 所有人可评论,1粉丝才可评论
  75. 'sort' => '排序',
  76. 'year' => '年份',
  77. 'month' => '月份',
  78. 'day' => '日',
  79. 'status' => '状态[-1:删除;0:禁用;1启用]',
  80. 'created_at' => '创建时间',
  81. 'updated_at' => '修改时间',
  82. ];
  83. }
  84. /**
  85. * 关联素材
  86. */
  87. public function getAttachment()
  88. {
  89. return $this->hasOne(Attachment::class, ['id' => 'attachment_id']);
  90. }
  91. }
粤ICP备19079148号