PurchaseOrderDetail.php 2.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677
  1. <?php
  2. /**
  3. * 厦门云联储网络科技有限公司
  4. * https://www.baokuaiyun.com
  5. * Copyright (c) 2023 爆块云 All rights reserved.
  6. */
  7. namespace app\models;
  8. use Yii;
  9. /**
  10. * This is the model class for table "{{%purchase_order_detail}}".
  11. *
  12. * @property integer $id
  13. * @property integer $order_id
  14. * @property integer $goods_id
  15. * @property integer $num
  16. * @property string $total_price
  17. * @property integer $created_at
  18. * @property integer $is_delete
  19. * @property string $attr
  20. * @property string $pic
  21. * @property string $goods_name
  22. * @property string $goods_info
  23. * @property integer $send_type
  24. * @property integer $is_give
  25. * @property float $before_update_price
  26. */
  27. class PurchaseOrderDetail extends \yii\db\ActiveRecord
  28. {
  29. /**
  30. * @inheritdoc
  31. */
  32. public static function tableName()
  33. {
  34. return '{{%purchase_order_detail}}';
  35. }
  36. /**
  37. * @inheritdoc
  38. */
  39. public function rules()
  40. {
  41. return [
  42. [['order_id', 'goods_id', 'attr'], 'required'],
  43. [['order_id', 'goods_id', 'num', 'created_at', 'is_delete', 'send_type', 'is_give'], 'integer'],
  44. [['total_price', 'before_update_price'], 'number'],
  45. [['attr'], 'string'],
  46. [['pic', 'goods_name'], 'string', 'max' => 255],
  47. ];
  48. }
  49. /**
  50. * @inheritdoc
  51. */
  52. public function attributeLabels()
  53. {
  54. return [
  55. 'id' => 'ID',
  56. 'order_id' => 'Order ID',
  57. 'goods_id' => 'Goods ID',
  58. 'num' => '商品数量',
  59. 'total_price' => '此商品的总价',
  60. 'created_at' => 'Addtime',
  61. 'is_delete' => 'Is Delete',
  62. 'attr' => '商品规格',
  63. 'pic' => '商品规格图片',
  64. 'is_level' => '会员折扣',
  65. 'goods_name' => '商品名称',
  66. 'send_type' => '配送类型'
  67. ];
  68. }
  69. public function getOrder() {
  70. return $this->hasOne(PurchaseOrder::className(), ['id' => 'order_id']);
  71. }
  72. }