| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768 |
- <?php
- namespace App\Module\Mex\Models;
- use App\Module\Mex\Enums\MatchType;
- use App\Module\GameItems\Models\Item;
- use Illuminate\Database\Eloquent\Relations\BelongsTo;
- use UCore\ModelCore;
- /**
- * 农贸市场撮合日志模型
- *
- * field start
- * @property int $id 撮合日志ID,主键
- * @property \App\Module\Mex\Enums\MatchType $match_type 撮合类型:USER_BUY用户买入撮合,USER_SELL用户卖出撮合
- * @property int $item_id 商品ID,关联物品表
- * @property int $batch_size 批处理大小
- * @property int $matched_orders 成功撮合的订单数
- * @property float $total_amount 撮合总金额
- * @property bool $success 撮合是否成功:0失败,1成功
- * @property string $message 撮合结果消息
- * @property int $execution_time_ms 执行时间(毫秒)
- * @property string $error_message 错误消息(失败时记录)
- * @property \Carbon\Carbon $created_at 撮合时间
- * field end
- */
- class MexMatchLog extends ModelCore
- {
- protected $table = 'mex_match_logs';
- // 禁用updated_at字段的自动管理,因为表中只有created_at字段
- public const UPDATED_AT = null;
- // attrlist start
- protected $fillable = [
- 'id',
- 'match_type',
- 'item_id',
- 'batch_size',
- 'matched_orders',
- 'total_amount',
- 'success',
- 'message',
- 'execution_time_ms',
- 'error_message',
- ];
- // attrlist end
- protected $casts = [
- 'match_type' => MatchType::class,
- 'item_id' => 'integer',
- 'batch_size' => 'integer',
- 'matched_orders' => 'integer',
- 'total_amount' => 'decimal:5',
- 'success' => 'boolean',
- 'execution_time_ms' => 'integer',
- ];
- /**
- * 获取关联的商品信息
- *
- * @return BelongsTo
- */
- public function item(): BelongsTo
- {
- return $this->belongsTo(Item::class, 'item_id');
- }
- }
|