ValetOrder.php 2.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485
  1. <?php
  2. namespace addons\ValetOrder\common\models;
  3. use common\models\order\Order;
  4. use common\models\user\User;
  5. use Yii;
  6. /**
  7. * This is the model class for table "qimall_addons_valet_order".
  8. *
  9. * @property int $id ID
  10. * @property int $mall_id 商城ID
  11. * @property int $status 状态[1启用 0禁用 -1删除]
  12. * @property int $created_at 创建时间
  13. * @property int $updated_at 更新事件
  14. * @property int $user_id 用户ID
  15. * @property int $buy_user_id 买家ID
  16. * @property int $order_id 订单ID
  17. * @property string $order_no 订单编号
  18. * @property string $mobile 订单编号
  19. * @property string $parent_mobile 订单编号
  20. * @property int $order_status 订单状态
  21. * @property int $order_amount 订单状态
  22. * @property string|null $order_goods_names 订单商品名称
  23. */
  24. class ValetOrder extends \common\models\base\BaseActiveRecord
  25. {
  26. /**
  27. * {@inheritdoc}
  28. */
  29. public static function tableName()
  30. {
  31. return 'qimall_addons_valet_order';
  32. }
  33. /**
  34. * {@inheritdoc}
  35. */
  36. public function rules()
  37. {
  38. return [
  39. [['mall_id', 'status', 'created_at', 'updated_at', 'user_id', 'buy_user_id', 'order_id', 'order_status', 'order_amount'], 'integer'],
  40. [['order_goods_names'], 'string'],
  41. [['mobile', 'parent_mobile'], 'string', 'max' => 15],
  42. [['order_no'], 'string', 'max' => 30],
  43. ];
  44. }
  45. /**
  46. * {@inheritdoc}
  47. */
  48. public function attributeLabels()
  49. {
  50. return [
  51. 'id' => 'ID',
  52. 'mall_id' => 'Mall ID',
  53. 'status' => 'Status',
  54. 'created_at' => 'Created At',
  55. 'updated_at' => 'Updated At',
  56. 'user_id' => 'User ID',
  57. 'buy_user_id' => 'Buy User ID',
  58. 'order_id' => 'Order ID',
  59. 'order_no' => 'Order No',
  60. 'order_status' => 'Order Status',
  61. 'order_goods_names' => 'Order Goods Names',
  62. ];
  63. }
  64. public function getUser()
  65. {
  66. return $this->hasOne(User::class, ['id' => 'user_id'])->select('id, username, nickname, avatar_url, mobile');
  67. }
  68. public function getBuyUser()
  69. {
  70. return $this->hasOne(User::class, ['id' => 'buy_user_id'])->select('id, username, nickname, avatar_url, mobile');
  71. }
  72. public function getOrder()
  73. {
  74. return $this->hasOne(Order::class, ['id' => 'order_id']);
  75. }
  76. }