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.

88 lines
2.2 KiB

  1. <?php
  2. namespace common\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. */
  21. class OrderGoods extends \yii\db\ActiveRecord
  22. {
  23. /**
  24. * {@inheritdoc}
  25. */
  26. public static function tableName()
  27. {
  28. return 'ats_order_goods';
  29. }
  30. /**
  31. * {@inheritdoc}
  32. */
  33. public function rules()
  34. {
  35. return [
  36. [['order_id', 'goods_id'], 'required'],
  37. [['order_id', 'goods_id', 'goods_img', 'goods_count', 'price', 'market_price', 'weight'], 'integer'],
  38. [['goods_name', 'sku_value'], 'string', 'max' => 120],
  39. ];
  40. }
  41. /**
  42. * {@inheritdoc}
  43. */
  44. public function attributeLabels()
  45. {
  46. return [
  47. 'id' => 'id',
  48. 'order_id' => '订单id',
  49. 'goods_id' => '商品id',
  50. 'goods_img' => '商品图片',
  51. 'goods_name' => '商品名称',
  52. 'goods_count' => '商品数量',
  53. 'sku_value' => '商品sku',
  54. 'price' => '销售价',
  55. 'market_price' => '市场价',
  56. 'updated_at' => '更新时间',
  57. 'created_at' => '创建时间',
  58. 'weight' => '重量',
  59. ];
  60. }
  61. /**
  62. * @author linyao
  63. * @email 602604991@qq.com
  64. * @created Nov 8, 2019
  65. *
  66. * 行为存储创建时间和更新时间
  67. */
  68. public function behaviors()
  69. {
  70. return [
  71. [
  72. 'class' => TimestampBehavior::className(),
  73. 'createdAtAttribute' => 'created_at',
  74. 'updatedAtAttribute' => 'updated_at',
  75. 'value' => function() {
  76. return time();
  77. },
  78. ],
  79. ];
  80. }
  81. }