CloudStockRandFeeOrder.php 2.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798
  1. <?php
  2. namespace addons\CloudStock\common\models;
  3. use common\models\common\PaymentTrade;
  4. use common\models\order\Order;
  5. use common\models\user\User;
  6. use Yii;
  7. use yii\db\ActiveRecord;
  8. /**
  9. * This is the model class for table "{{%addons_cloud_stock_rand_fee_order}}".
  10. *
  11. * @property int $id
  12. * @property int $mall_id
  13. * @property int $trade_id 支付流水ID
  14. * @property int $order_id 订单ID
  15. * @property string $order_no 订单号
  16. * @property int $user_id 会员ID
  17. * @property float $rand_fee 订单减免金额
  18. * @property float $total_rand_fee 减免金额
  19. * @property string $order_type 订单类型
  20. * @property int|null $created_at
  21. */
  22. class CloudStockRandFeeOrder extends ActiveRecord
  23. {
  24. /**
  25. * {@inheritdoc}
  26. */
  27. public static function tableName()
  28. {
  29. return '{{%addons_cloud_stock_rand_fee_order}}';
  30. }
  31. /**
  32. * {@inheritdoc}
  33. */
  34. public function rules()
  35. {
  36. return [
  37. [['mall_id', 'trade_id', 'order_id', 'user_id', 'created_at'], 'integer'],
  38. [['rand_fee', 'total_rand_fee'], 'number'],
  39. [['order_no'], 'string', 'max' => 64],
  40. [['order_type'], 'string', 'max' => 32],
  41. ];
  42. }
  43. /**
  44. * {@inheritdoc}
  45. */
  46. public function attributeLabels()
  47. {
  48. return [
  49. 'id' => 'ID',
  50. 'mall_id' => 'Mall ID',
  51. 'trade_id' => 'Trade ID',
  52. 'order_id' => 'Order ID',
  53. 'order_no' => 'Order No',
  54. 'user_id' => 'User ID',
  55. 'rand_fee' => 'Rand Fee',
  56. 'total_rand_fee' => 'Total Rand Fee',
  57. 'order_type' => 'Order Type',
  58. 'created_at' => 'Created At',
  59. ];
  60. }
  61. /**
  62. * 订单表
  63. *
  64. * @return ActiveQuery
  65. */
  66. public function getOrder()
  67. {
  68. return $this->hasOne(Order::class, ['id' => 'order_id']);
  69. }
  70. /**
  71. * 会员表
  72. *
  73. * @return ActiveQuery
  74. */
  75. public function getUser()
  76. {
  77. return $this->hasOne(User::class, ['id' => 'user_id']);
  78. }
  79. /**
  80. * 流水
  81. *
  82. * @return ActiveQuery
  83. */
  84. public function getTrade()
  85. {
  86. return $this->hasOne(PaymentTrade::class, ['id' => 'trade_id']);
  87. }
  88. }