| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566 |
- <?php
- namespace App\Module\Mex\Models;
- use App\Module\Mex\Enums\OrderStatus;
- use App\Module\Mex\Enums\OrderType;
- use UCore\ModelCore;
- /**
- * 农贸市场订单模型
- * field start
- * @property int $id 订单ID,主键
- * @property int $user_id 用户ID
- * @property int $item_id 商品ID,关联物品表
- * @property \App\Module\Mex\Enums\OrderType $order_type 订单类型:BUY买入,SELL卖出
- * @property int $quantity 订单数量
- * @property float $price 订单价格,支持5位小数
- * @property float $total_amount 订单总金额
- * @property \App\Module\Mex\Enums\OrderStatus $status 订单状态:PENDING等待,COMPLETED完成,CANCELLED取消,FAILED失败
- * @property float $frozen_amount 冻结金额(买单使用)
- * @property int $completed_quantity 已成交数量
- * @property float $completed_amount 已成交金额
- * @property \Carbon\Carbon $created_at 创建时间
- * @property \Carbon\Carbon $updated_at 更新时间
- * @property \Carbon\Carbon $completed_at 完成时间
- * @property string $failed_reason 失败原因
- * field end
- */
- class MexOrder extends ModelCore
- {
- protected $table = 'mex_orders';
- // attrlist start
- protected $fillable = [
- 'user_id',
- 'item_id',
- 'order_type',
- 'quantity',
- 'price',
- 'total_amount',
- 'status',
- 'frozen_amount',
- 'completed_quantity',
- 'completed_amount',
- 'completed_at',
- 'failed_reason',
- ];
- // attrlist end
- protected $casts = [
- 'user_id' => 'integer',
- 'item_id' => 'integer',
- 'order_type' => OrderType::class,
- 'quantity' => 'integer',
- 'price' => 'decimal:5',
- 'total_amount' => 'decimal:5',
- 'status' => OrderStatus::class,
- 'frozen_amount' => 'decimal:5',
- 'completed_quantity' => 'integer',
- 'completed_amount' => 'decimal:5',
- 'completed_at' => 'datetime',
- 'failed_reason' => 'string',
- ];
- }
|