QiShangTongGoods.php 2.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889
  1. <?php
  2. namespace addons\QiShangTong\common\models;
  3. use Yii;
  4. /**
  5. * This is the model class for table "qimall_addons_qi_shang_tong_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 string $goods_name 商品名称
  16. * @property int $cate_one 一级类目
  17. * @property int $cate_two 二级类目
  18. * @property int $cate_three 三级类目
  19. * @property int $import_at 导入时间
  20. * @property int $can_sale 导入时间
  21. * @property float $gonghuojia 供货价
  22. * @property float $price 零售价
  23. * @property float $retail_price 零售价
  24. * @property array|null $ship_method 配送方式
  25. * @property string $default_image 配送方式
  26. */
  27. class QiShangTongGoods extends \common\models\base\BaseActiveRecord
  28. {
  29. /**
  30. * {@inheritdoc}
  31. */
  32. public static function tableName()
  33. {
  34. return 'qimall_addons_qi_shang_tong_goods';
  35. }
  36. /**
  37. * {@inheritdoc}
  38. */
  39. public function rules()
  40. {
  41. return [
  42. [['mall_id', 'created_at', 'updated_at', 'status', 'goods_id', 'third_goods_id', 'cate_one', 'cate_two', 'cate_three', 'import_at', 'can_sale'], 'integer'],
  43. [['content', 'ship_method'], 'safe'],
  44. [['retail_price', 'price', 'gonghuojia'], 'number'],
  45. [['goods_name'], 'string', 'max' => 255],
  46. [['default_image'], 'string', 'max' => 500],
  47. ];
  48. }
  49. /**
  50. * {@inheritdoc}
  51. */
  52. public function attributeLabels()
  53. {
  54. return [
  55. 'id' => 'ID',
  56. 'mall_id' => 'Mall ID',
  57. 'created_at' => 'Created At',
  58. 'updated_at' => 'Updated At',
  59. 'status' => 'Status',
  60. 'goods_id' => 'Goods ID',
  61. 'third_goods_id' => 'Third Goods ID',
  62. 'content' => 'Content',
  63. 'goods_name' => 'Goods Name',
  64. 'cate_one' => 'Cate One',
  65. 'cate_two' => 'Cate Two',
  66. 'cate_three' => 'Cate Three',
  67. 'import_at' => 'Import At',
  68. 'cost_price' => 'Cost Price',
  69. 'price' => 'Price',
  70. 'ship_method' => 'Ship Method',
  71. ];
  72. }
  73. public function getCateOne()
  74. {
  75. return $this->hasOne(QiShangTongCate::class, ['third_cate_id' => 'cate_one']);
  76. }
  77. public function getCateTwo()
  78. {
  79. return $this->hasOne(QiShangTongCate::class, ['third_cate_id' => 'cate_two']);
  80. }
  81. }