CartItem.php 2.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485
  1. <?php
  2. namespace addons\TinyShop\common\models\member;
  3. use common\traits\HasOneMerchant;
  4. use addons\TinyShop\common\models\product\Sku;
  5. use addons\TinyShop\common\traits\HasOneProduct;
  6. /**
  7. * This is the model class for table "{{%addon_tiny_shop_member_cart_item}}".
  8. *
  9. * @property int $id
  10. * @property int|null $merchant_id 商户id
  11. * @property int|null $member_id 用户编码
  12. * @property float|null $price 价格
  13. * @property int|null $number 商品数量
  14. * @property int|null $product_id 商品编码
  15. * @property string|null $product_picture 商品快照
  16. * @property string|null $product_name 商品名称
  17. * @property int|null $sku_id 商品sku编码
  18. * @property string|null $sku_name 商品sku信息
  19. * @property int|null $status 状态[-1:删除;0:禁用;1启用]
  20. * @property int|null $created_at
  21. * @property int|null $updated_at
  22. */
  23. class CartItem extends \common\models\base\BaseModel
  24. {
  25. use HasOneMerchant, HasOneProduct;
  26. /**
  27. * {@inheritdoc}
  28. */
  29. public static function tableName()
  30. {
  31. return '{{%addon_tiny_shop_member_cart_item}}';
  32. }
  33. /**
  34. * {@inheritdoc}
  35. */
  36. public function rules()
  37. {
  38. return [
  39. [['merchant_id', 'member_id', 'marketing_id', 'number', 'product_id', 'sku_id', 'status', 'created_at', 'updated_at'], 'integer'],
  40. [['price'], 'number'],
  41. [['product_picture'], 'string', 'max' => 200],
  42. [['marketing_type'], 'string', 'max' => 50],
  43. [['product_name', 'sku_name'], 'string', 'max' => 255],
  44. ];
  45. }
  46. /**
  47. * {@inheritdoc}
  48. */
  49. public function attributeLabels()
  50. {
  51. return [
  52. 'id' => 'ID',
  53. 'merchant_id' => '商户id',
  54. 'member_id' => '用户编码',
  55. 'marketing_id' => '营销ID',
  56. 'marketing_type' => '营销类型',
  57. 'price' => '价格',
  58. 'number' => '商品数量',
  59. 'product_id' => '商品编码',
  60. 'product_picture' => '商品快照',
  61. 'product_name' => '商品名称',
  62. 'sku_id' => '商品sku编码',
  63. 'sku_name' => '商品sku信息',
  64. 'status' => '状态[-1:删除;0:禁用;1启用]',
  65. 'created_at' => 'Created At',
  66. 'updated_at' => 'Updated At',
  67. ];
  68. }
  69. /**
  70. * 关联sku
  71. *
  72. * @return \yii\db\ActiveQuery
  73. */
  74. public function getSku()
  75. {
  76. return $this->hasOne(Sku::class, ['id' => 'sku_id']);
  77. }
  78. }
粤ICP备19079148号