QiDingDongGoods.php 2.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788
  1. <?php
  2. namespace addons\QiDingDong\common\models;
  3. use Yii;
  4. /**
  5. * This is the model class for table "qimall_addons_qi_ding_dong_goods".
  6. *
  7. * @property int $id ID
  8. * @property int $mall_id 商城ID
  9. * @property int $created_at 创建时间
  10. * @property int $updated_at 更新时间
  11. * @property int $status 状态
  12. * @property int $goods_id 本地商品ID
  13. * @property int $third_goods_id 第三方商品ID
  14. * @property array|null $content 数据
  15. * @property array|null $ship_method 数据
  16. * @property string $goods_name 商品名称
  17. * @property int $cate_one 一级类目
  18. * @property int $cate_two 二级类目
  19. * @property int $cate_three 三级类目
  20. * @property int $import_at 三级类目
  21. * @property int $goods_type 三级类目
  22. * @property int $discount 三级类目
  23. * @property int $can_sale 三级类目
  24. * @property string $default_image 三级类目
  25. * @property float $retail_price 三级类目
  26. * @property float $price 三级类目
  27. * @property float $lowest_price 三级类目
  28. */
  29. class QiDingDongGoods extends \common\models\base\BaseActiveRecord
  30. {
  31. /**
  32. * {@inheritdoc}
  33. */
  34. public static function tableName()
  35. {
  36. return 'qimall_addons_qi_ding_dong_goods';
  37. }
  38. /**
  39. * {@inheritdoc}
  40. */
  41. public function rules()
  42. {
  43. return [
  44. [['mall_id', 'created_at', 'updated_at', 'status', 'goods_id', 'third_goods_id',
  45. 'cate_one', 'cate_two', 'cate_three', 'import_at', 'goods_type', 'discount', 'can_sale'], 'integer'],
  46. [['content', 'ship_method'], 'safe'],
  47. [['retail_price', 'price', 'lowest_price'], 'number'],
  48. [['goods_name'], 'string', 'max' => 255],
  49. [['default_image'], 'string', 'max' => 500],
  50. ];
  51. }
  52. /**
  53. * {@inheritdoc}
  54. */
  55. public function attributeLabels()
  56. {
  57. return [
  58. 'id' => 'ID',
  59. 'mall_id' => 'Mall ID',
  60. 'created_at' => 'Created At',
  61. 'updated_at' => 'Updated At',
  62. 'status' => 'Status',
  63. 'goods_id' => 'Goods ID',
  64. 'third_goods_id' => 'Third Goods ID',
  65. 'content' => 'Content',
  66. 'goods_name' => 'Goods Name',
  67. 'cate_one' => 'Cate One',
  68. 'cate_two' => 'Cate Two',
  69. 'cate_three' => 'Cate Three',
  70. ];
  71. }
  72. public function getCateOne()
  73. {
  74. return $this->hasOne(QiDingDongCate::class, ['third_cate_id' => 'cate_one']);
  75. }
  76. public function getCateTwo()
  77. {
  78. return $this->hasOne(QiDingDongCate::class, ['third_cate_id' => 'cate_two']);
  79. }
  80. }