OrderPospalDetail.php 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119
  1. <?php
  2. /**
  3. * 厦门云联储网络科技有限公司
  4. * https://www.baokuaiyun.com
  5. * Copyright (c) 2023 爆块云 All rights reserved.
  6. */
  7. /*
  8. * @Author: your name
  9. * @Date: 2021-03-02 09:50:20
  10. * @LastEditTime: 2021-04-29 15:29:26
  11. * @LastEditors: Please set LastEditors
  12. * @Description: In User Settings Edit
  13. * @FilePath: \admin_php\models\OrderDetail.php
  14. */
  15. namespace app\models;
  16. use Yii;
  17. /**
  18. * This is the model class for table "{{%order_detail}}".
  19. *
  20. * @property integer $id
  21. * @property integer $order_id
  22. * @property integer $goods_id
  23. * @property integer $num
  24. * @property string $total_price
  25. * @property integer $created_at
  26. * @property integer $is_delete
  27. * @property string $attr
  28. * @property string $pic
  29. * @property string $integral
  30. * @property integer $is_level
  31. * @property string $goods_name
  32. * @property string $goods_info
  33. * @property string $delivery_type
  34. * @property string $shop_id
  35. * @property integer $profit
  36. */
  37. class OrderPospalDetail extends \yii\db\ActiveRecord
  38. {
  39. /**
  40. * 类型枚举
  41. * 快递
  42. */
  43. const GOODS_DELIVERY_EXPRESS = 0;
  44. /**
  45. * 类型枚举
  46. * 自提
  47. */
  48. const GOODS_DELIVERY_SHOP = 1;
  49. /**
  50. * 类型枚举
  51. * 同城
  52. */
  53. const GOODS_DELIVERY_IM = 2;
  54. /**
  55. * @inheritdoc
  56. */
  57. public static function tableName()
  58. {
  59. return '{{%order_pospal_detail}}';
  60. }
  61. /**
  62. * @inheritdoc
  63. */
  64. public function rules()
  65. {
  66. return [
  67. [['order_id', 'goods_id', 'attr', 'pic'], 'required'],
  68. [['order_id', 'goods_id', 'num', 'created_at', 'is_delete', 'integral', 'is_level', 'delivery_type', 'shop_id','order_transit_id','integral_price'], 'integer'],
  69. [['total_price', 'supplier_price', 'profit','integral_difference_price'], 'number'],
  70. [['attr', 'goods_info'], 'string'],
  71. [['pic','batch_price_tips', 'goods_name'], 'string', 'max' => 255],
  72. ];
  73. }
  74. /**
  75. * @inheritdoc
  76. */
  77. public function attributeLabels()
  78. {
  79. return [
  80. 'id' => 'ID',
  81. 'order_id' => 'Order ID',
  82. 'goods_id' => 'Goods ID',
  83. 'num' => '商品数量',
  84. 'total_price' => '此商品的总价',
  85. 'integral_price' => '销售积分',
  86. 'integral_difference_price' => '积分差额',
  87. 'created_at' => 'Addtime',
  88. 'is_delete' => 'Is Delete',
  89. 'attr' => '商品规格',
  90. 'pic' => '商品规格图片',
  91. 'integral' => '获取积分',
  92. 'is_level' => '会员折扣',
  93. 'batch_price_tips' => '满减价格提示',
  94. 'supplier_price' => '供货商进价',
  95. 'goods_name' => '商品名称',
  96. 'goods_info' => '商品快照',
  97. 'delivery_type' => '配送方式,0:快递,1:自提',
  98. 'shop_id' => '自提点id,默认:0',
  99. 'order_transit_id' => '云仓转单id'
  100. ];
  101. }
  102. public function getGoods()
  103. {
  104. return $this->hasOne(Goods::className(), ['id'=>'goods_id']);
  105. }
  106. public function getOrder() {
  107. return $this->hasOne(OrderPospal::className(), ['id' => 'order_id']);
  108. }
  109. }