You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

92 lines
2.3 KiB

  1. <?php
  2. namespace backend\modules\shop\models\ars;
  3. use Yii;
  4. use yii\behaviors\TimestampBehavior;
  5. /**
  6. * This is the model class for table "ats_order_goods".
  7. *
  8. * @property int $id
  9. * @property int $order_id 订单id
  10. * @property int $goods_id 商品id
  11. * @property int $goods_img 商品图片
  12. * @property string $goods_name 商品名称
  13. * @property int $goods_count 商品数量
  14. * @property string $sku_value 商品sku
  15. * @property int $price 销售价
  16. * @property int $market_price 市场价
  17. * @property int $updated_at 更新时间
  18. * @property int $created_at 创建时间
  19. * @property int $weight 重量
  20. * @property int $sku_id sku_id
  21. */
  22. class OrderGoods extends \yii\db\ActiveRecord
  23. {
  24. public $lack_number;
  25. /**
  26. * {@inheritdoc}
  27. */
  28. public static function tableName()
  29. {
  30. return 'ats_order_goods';
  31. }
  32. /**
  33. * {@inheritdoc}
  34. */
  35. public function rules()
  36. {
  37. return [
  38. [['order_id', 'goods_id'], 'required'],
  39. [['order_id', 'goods_id', 'goods_img', 'goods_count', 'price', 'market_price', 'weight', 'sku_id'], 'integer'],
  40. [['goods_name', 'sku_value'], 'string', 'max' => 120],
  41. ];
  42. }
  43. /**
  44. * {@inheritdoc}
  45. */
  46. public function attributeLabels()
  47. {
  48. return [
  49. 'id' => 'id',
  50. 'order_id' => '订单id',
  51. 'goods_id' => '商品id',
  52. 'goods_img' => '商品图片',
  53. 'goods_name' => '商品名称',
  54. 'goods_count' => '商品数量',
  55. 'sku_value' => '商品sku',
  56. 'price' => '销售价',
  57. 'market_price' => '市场价',
  58. 'updated_at' => '更新时间',
  59. 'created_at' => '创建时间',
  60. 'weight' => '重量',
  61. 'sku_id' => 'sku_id',
  62. ];
  63. }
  64. /**
  65. * @author linyao
  66. * @email 602604991@qq.com
  67. * @created Nov 8, 2019
  68. *
  69. * 行为存储创建时间和更新时间
  70. */
  71. public function behaviors()
  72. {
  73. return [
  74. [
  75. 'class' => TimestampBehavior::className(),
  76. 'createdAtAttribute' => 'created_at',
  77. 'updatedAtAttribute' => 'updated_at',
  78. 'value' => function() {
  79. return time();
  80. },
  81. ],
  82. ];
  83. }
  84. }