WechatVideoShopCate.php 1.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980
  1. <?php
  2. namespace addons\WechatVideoShop\common\models;
  3. use Yii;
  4. /**
  5. * This is the model class for table "qimall_addons_wechat_video_shop_cate".
  6. *
  7. * @property int $id
  8. * @property int $mall_id
  9. * @property int $status 状态[1启用 0禁用 -1删除]
  10. * @property int $created_at 创建时间
  11. * @property int $updated_at 更新事件
  12. * @property string $name 类目名称
  13. * @property int $pid 上级ID
  14. * @property int $level 类目级别
  15. * @property int $shop_id 类目级别
  16. * @property array $product 类目资质信息
  17. * @property array $qua 资质信息
  18. * @property array $product_qua 商品资质信息
  19. */
  20. class WechatVideoShopCate extends \common\models\base\BaseActiveRecord
  21. {
  22. /**
  23. * {@inheritdoc}
  24. */
  25. public static function tableName()
  26. {
  27. return 'qimall_addons_wechat_video_shop_cate';
  28. }
  29. /**
  30. * {@inheritdoc}
  31. */
  32. public function rules()
  33. {
  34. return [
  35. [['mall_id', 'status', 'created_at', 'updated_at', 'pid', 'level', 'shop_id'], 'integer'],
  36. [['product', 'qua', 'product_qua'], 'required'],
  37. [['product', 'qua', 'product_qua'], 'safe'],
  38. [['name'], 'string', 'max' => 50],
  39. ];
  40. }
  41. /**
  42. * {@inheritdoc}
  43. */
  44. public function attributeLabels()
  45. {
  46. return [
  47. 'id' => 'ID',
  48. 'mall_id' => 'Mall ID',
  49. 'status' => 'Status',
  50. 'created_at' => 'Created At',
  51. 'updated_at' => 'Updated At',
  52. 'name' => 'Name',
  53. 'pid' => 'Pid',
  54. 'level' => 'Level',
  55. 'product' => 'Product',
  56. 'qua' => 'Qua',
  57. 'product_qua' => 'Product Qua',
  58. ];
  59. }
  60. /**
  61. * 获取上级
  62. * @return \yii\db\ActiveQuery
  63. */
  64. public function getParent()
  65. {
  66. return $this->hasOne(self::class, ['id' => 'pid']);
  67. }
  68. public function getChildren()
  69. {
  70. return $this->hasMany(self::class, ['pid' => 'id']);
  71. }
  72. }