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.

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