WeChatSharerLive.php 1.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182
  1. <?php
  2. /**
  3. * 厦门云联储网络科技有限公司
  4. * https://www.baokuaiyun.com
  5. * Copyright (c) 2023 爆块云 All rights reserved.
  6. */
  7. namespace app\models;
  8. /**
  9. * Class WeChatSharerLive
  10. * @package app\models
  11. * @property integer $id
  12. * @property string $wechat_appid
  13. * @property string $talent_appid
  14. * @property string $export_id
  15. * @property string $description
  16. * @property integer $store_id
  17. * @property integer $type
  18. * @property integer $start_time
  19. * @property integer $sort
  20. * @property integer $is_show
  21. * @property integer $is_from
  22. * @property string $promoter_share_link
  23. **/
  24. class WeChatSharerLive extends \yii\db\ActiveRecord
  25. {
  26. /**
  27. * @var mixed|null
  28. */
  29. public $mini_info;
  30. const TYPE_LIVE = 1;
  31. const TYPE_NOTICE = 0;
  32. const IS_LIVE_FROM_TALENT = 1;
  33. const IS_LIVE_FROM_PROMOTER = 2;
  34. /**
  35. * @inheritdoc
  36. */
  37. public static function tableName()
  38. {
  39. return '{{%wechat_sharer_live}}';
  40. }
  41. /**
  42. * @inheritdoc
  43. */
  44. public function rules()
  45. {
  46. return [
  47. [['id', 'store_id', 'type', 'start_time', 'sort', 'is_show', 'is_from'], 'integer'],
  48. [["wechat_appid", "talent_appid", "export_id", "description", "promoter_share_link"], 'string'],
  49. ];
  50. }
  51. /**
  52. * @inheritdoc
  53. */
  54. public function attributeLabels()
  55. {
  56. return [
  57. 'id' => "ID",
  58. 'store_id' => "商城ID",
  59. ];
  60. }
  61. public function getPromotions()
  62. {
  63. return $this->hasMany(WeChatSharer::class, ['sharer_appid' => 'sharer_appid'])
  64. ->viaTable(WeChatSharerLiveQrCode::tableName(), ['export_id' => 'export_id']);
  65. }
  66. public function getProducts()
  67. {
  68. return $this->hasMany(WeChatSharerProduct::class, ['talent_appid' => 'talent_appid']);
  69. }
  70. public function getTalent()
  71. {
  72. return $this->hasOne(PromoterTalent::class, ['talent_appid' => 'talent_appid']);
  73. }
  74. }