MexOrder.php 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. <?php
  2. namespace App\Module\Mex\Models;
  3. use App\Module\Mex\Enums\OrderStatus;
  4. use App\Module\Mex\Enums\OrderType;
  5. use UCore\ModelCore;
  6. /**
  7. * 农贸市场订单模型
  8. * field start
  9. * @property int $id 订单ID,主键
  10. * @property int $user_id 用户ID
  11. * @property int $item_id 商品ID,关联物品表
  12. * @property \App\Module\Mex\Enums\OrderType $order_type 订单类型:BUY买入,SELL卖出
  13. * @property int $quantity 订单数量
  14. * @property float $price 订单价格,支持5位小数
  15. * @property float $total_amount 订单总金额
  16. * @property \App\Module\Mex\Enums\OrderStatus $status 订单状态:PENDING等待,COMPLETED完成,CANCELLED取消,FAILED失败
  17. * @property float $frozen_amount 冻结金额(买单使用)
  18. * @property int $completed_quantity 已成交数量
  19. * @property float $completed_amount 已成交金额
  20. * @property \Carbon\Carbon $created_at 创建时间
  21. * @property \Carbon\Carbon $updated_at 更新时间
  22. * @property \Carbon\Carbon $completed_at 完成时间
  23. * field end
  24. */
  25. class MexOrder extends ModelCore
  26. {
  27. protected $table = 'mex_orders';
  28. protected $casts = [
  29. 'user_id' => 'integer',
  30. 'item_id' => 'integer',
  31. 'order_type' => OrderType::class,
  32. 'quantity' => 'integer',
  33. 'price' => 'decimal:5',
  34. 'total_amount' => 'decimal:5',
  35. 'status' => OrderStatus::class,
  36. 'frozen_amount' => 'decimal:5',
  37. 'completed_quantity' => 'integer',
  38. 'completed_amount' => 'decimal:5',
  39. 'completed_at' => 'datetime',
  40. ];
  41. }