OrderDetail.php 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101
  1. <?php
  2. /**
  3. * 重庆赤晓店信息科技有限公司
  4. * https://www.chixiaodian.com
  5. * Copyright (c) 2023 赤店商城 All rights reserved.
  6. */
  7. namespace app\plugins\scanCodePay\models;
  8. use Yii;
  9. /**
  10. * This is the model class for table "{{%scan_code_pay_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 $integral
  22. * @property integer $is_level
  23. * @property string $goods_name
  24. * @property string $goods_info
  25. * @property string $delivery_type
  26. * @property string $shop_id
  27. */
  28. class OrderDetail extends \yii\db\ActiveRecord
  29. {
  30. /**
  31. * 类型枚举
  32. * 快递
  33. */
  34. const GOODS_DELIVERY_EXPRESS = 0;
  35. /**
  36. * 类型枚举
  37. * 自提
  38. */
  39. const GOODS_DELIVERY_SHOP = 1;
  40. /**
  41. * @inheritdoc
  42. */
  43. public static function tableName()
  44. {
  45. return '{{%scan_code_pay_order_detail}}';
  46. }
  47. /**
  48. * @inheritdoc
  49. */
  50. public function rules()
  51. {
  52. return [
  53. [['order_id', 'goods_id', 'attr', 'pic'], 'required'],
  54. [['order_id', 'goods_id', 'num', 'created_at', 'is_delete', 'integral', 'is_level', 'delivery_type', 'shop_id'], 'integer'],
  55. [['total_price', 'supplier_price'], 'number'],
  56. [['attr', 'goods_info'], 'string'],
  57. [['pic','batch_price_tips', 'goods_name'], 'string', 'max' => 255],
  58. ];
  59. }
  60. /**
  61. * @inheritdoc
  62. */
  63. public function attributeLabels()
  64. {
  65. return [
  66. 'id' => 'ID',
  67. 'order_id' => 'Order ID',
  68. 'goods_id' => 'Goods ID',
  69. 'num' => '商品数量',
  70. 'total_price' => '此商品的总价',
  71. 'created_at' => 'Addtime',
  72. 'is_delete' => 'Is Delete',
  73. 'attr' => '商品规格',
  74. 'pic' => '商品规格图片',
  75. 'integral' => '获取积分',
  76. 'is_level' => '会员折扣',
  77. 'batch_price_tips' => '满减价格提示',
  78. 'supplier_price' => '供货商进价',
  79. 'goods_name' => '商品名称',
  80. 'goods_info' => '商品快照',
  81. 'delivery_type' => '配送方式,0:快递,1:自提',
  82. 'shop_id' => '自提点id,默认:0'
  83. ];
  84. }
  85. public function getGoods()
  86. {
  87. return $this->hasOne(Goods::className(), ['id'=>'goods_id']);
  88. }
  89. public function getOrder() {
  90. return $this->hasOne(Order::className(), ['id' => 'order_id']);
  91. }
  92. }