CloudStockPriceDifferenceOrder.php 3.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116
  1. <?php
  2. namespace addons\CloudStock\common\models;
  3. use common\components\export\CsvTool;
  4. use common\enums\DownloadEnum;
  5. use common\enums\PayTypeEnum;
  6. use common\enums\StatusEnum;
  7. use common\models\base\BaseActiveRecord;
  8. use common\models\common\Download;
  9. use common\models\common\PaymentTrade;
  10. use common\models\goods\Goods;
  11. use common\models\order\Order;
  12. use common\models\user\User;
  13. use Yii;
  14. /**
  15. * This is the model class for table "qimall_addons_cloud_stock_price_difference_order".
  16. *
  17. * @property int $id
  18. * @property int $mall_id 商城id
  19. * @property int $user_id 补货代理商用户id
  20. * @property int $trade_id 支付流水记录id
  21. * @property int $address_id 收货地址id
  22. * @property string $receiver_name 收货人
  23. * @property string $receiver_mobile 收货人手机号
  24. * @property string $address 收货地址
  25. * @property int $price_difference_gift_package_id 价差礼包id
  26. * @property float $pay_money 支付金额
  27. * @property float $shipping_money 运费
  28. * @property string $order_no 补货订单编号
  29. * @property string $trade_no 支付流水号
  30. * @property string $remark 订单备注
  31. * @property int $is_pay 是否支付
  32. * @property int $pay_time 支付时间
  33. * @property int $status 状态[-1:删除;0:禁用;1启用]
  34. * @property int $created_at
  35. * @property int $updated_at
  36. * @property int|null $payment_type 支付类型
  37. */
  38. class CloudStockPriceDifferenceOrder extends BaseActiveRecord
  39. {
  40. /**
  41. * {@inheritdoc}
  42. */
  43. public static function tableName()
  44. {
  45. return '{{%addons_cloud_stock_price_difference_order}}';
  46. }
  47. /**
  48. * {@inheritdoc}
  49. */
  50. public function rules()
  51. {
  52. return [
  53. [['mall_id', 'user_id', 'order_no'], 'required'],
  54. [['mall_id', 'user_id', 'trade_id', 'address_id', 'price_difference_gift_package_id', 'is_pay', 'pay_time', 'status', 'created_at', 'updated_at', 'payment_type'], 'integer'],
  55. [['pay_money', 'shipping_money'], 'number'],
  56. [['receiver_name', 'address', 'order_no', 'trade_no', 'remark'], 'string', 'max' => 255],
  57. [['receiver_mobile'], 'string', 'max' => 20],
  58. ];
  59. }
  60. /**
  61. * {@inheritdoc}
  62. */
  63. public function attributeLabels()
  64. {
  65. return [
  66. 'id' => 'ID',
  67. 'mall_id' => 'Mall ID',
  68. 'user_id' => 'User ID',
  69. 'trade_id' => 'Trade ID',
  70. 'address_id' => 'Address ID',
  71. 'receiver_name' => 'Receiver Name',
  72. 'receiver_mobile' => 'Receiver Mobile',
  73. 'address' => 'Address',
  74. 'price_difference_gift_package_id' => 'Price Difference Gift Package ID',
  75. 'pay_money' => 'Pay Money',
  76. 'shipping_money' => 'Shipping Money',
  77. 'order_no' => 'Order No',
  78. 'trade_no' => 'Trade No',
  79. 'remark' => 'Remark',
  80. 'is_pay' => 'Is Pay',
  81. 'pay_time' => 'Pay Time',
  82. 'status' => 'Status',
  83. 'created_at' => 'Created At',
  84. 'updated_at' => 'Updated At',
  85. 'payment_type' => 'Payment Type',
  86. ];
  87. }
  88. public function getDetail()
  89. {
  90. return $this->hasMany(CloudStockPriceDifferenceOrderDetail::class, ['price_difference_order_id' => 'id']);
  91. }
  92. public function getFillOrder()
  93. {
  94. return $this->hasMany(CloudStockFillOrder::class, ['price_difference_order_id' => 'id']);
  95. }
  96. public function getUser()
  97. {
  98. return $this->hasOne(User::class, ['id' => 'user_id'])->select(['id', 'nickname', 'avatar_url', 'mobile']);
  99. }
  100. public function getPaymentTrade()
  101. {
  102. return $this->hasOne(PaymentTrade::class, ['id' => 'trade_id']);
  103. }
  104. }