SpecValue.php 2.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869
  1. <?php
  2. namespace addons\TinyShop\common\models\product;
  3. use Yii;
  4. /**
  5. * This is the model class for table "{{%addon_tiny_shop_product_spec_value}}".
  6. *
  7. * @property int $id
  8. * @property int|null $merchant_id 商户id
  9. * @property int|null $product_id 商品编码
  10. * @property string|null $title 属性标题
  11. * @property int|null $common_spec_id 系统规格id
  12. * @property int|null $common_spec_value_id 系统规格值id
  13. * @property string|null $data 属性值例如颜色
  14. * @property int|null $sort 排序
  15. * @property int|null $pitch_on 选中
  16. * @property int|null $status 状态(-1:已删除,0:禁用,1:正常)
  17. * @property int|null $created_at 创建时间
  18. * @property int|null $updated_at 修改时间
  19. */
  20. class SpecValue extends \common\models\base\BaseModel
  21. {
  22. /**
  23. * {@inheritdoc}
  24. */
  25. public static function tableName()
  26. {
  27. return '{{%addon_tiny_shop_product_spec_value}}';
  28. }
  29. /**
  30. * {@inheritdoc}
  31. */
  32. public function rules()
  33. {
  34. return [
  35. [['merchant_id', 'product_id', 'common_spec_id', 'common_spec_value_id', 'sort', 'pitch_on', 'status', 'created_at', 'updated_at'], 'integer'],
  36. [['title', 'data'], 'string', 'max' => 125],
  37. ];
  38. }
  39. /**
  40. * {@inheritdoc}
  41. */
  42. public function attributeLabels()
  43. {
  44. return [
  45. 'id' => 'ID',
  46. 'merchant_id' => '商户id',
  47. 'product_id' => '商品编码',
  48. 'title' => '属性标题',
  49. 'common_spec_id' => '系统规格id',
  50. 'common_spec_value_id' => '系统规格值id',
  51. 'data' => '属性值例如颜色',
  52. 'sort' => '排序',
  53. 'pitch_on' => '选中',
  54. 'status' => '状态(-1:已删除,0:禁用,1:正常)',
  55. 'created_at' => '创建时间',
  56. 'updated_at' => '修改时间',
  57. ];
  58. }
  59. public function getSpec()
  60. {
  61. return $this->hasOne(Spec::class, ['common_spec_id' => 'common_spec_id']);
  62. }
  63. }
粤ICP备19079148号