MexAdminOperation.php 1.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  1. <?php
  2. namespace App\Module\Mex\Models;
  3. use App\Module\Mex\Enums\AdminOperationType;
  4. use UCore\ModelCore;
  5. /**
  6. * 农贸市场管理员操作记录模型
  7. *
  8. * field start
  9. * @property int $id 操作记录ID,主键
  10. * @property int $admin_user_id 管理员用户ID
  11. * @property \App\Module\Mex\Enums\AdminOperationType $operation_type 操作类型:INJECT注入,RECYCLE回收
  12. * @property int $item_id 商品ID,关联物品表
  13. * @property int $quantity 操作数量
  14. * @property float $price 操作价格
  15. * @property float $total_amount 操作总金额
  16. * @property int $before_warehouse_quantity 操作前仓库数量
  17. * @property int $after_warehouse_quantity 操作后仓库数量
  18. * @property int $transaction_id 关联的成交记录ID
  19. * @property string $remark 操作备注
  20. * @property \Carbon\Carbon $created_at 操作时间
  21. * field end
  22. */
  23. class MexAdminOperation extends ModelCore
  24. {
  25. protected $table = 'mex_admin_operations';
  26. // 禁用updated_at字段的自动管理,因为表中只有created_at字段
  27. public const UPDATED_AT = null;
  28. protected $fillable = [
  29. 'admin_user_id',
  30. 'operation_type',
  31. 'item_id',
  32. 'quantity',
  33. 'price',
  34. 'total_amount',
  35. 'before_warehouse_quantity',
  36. 'after_warehouse_quantity',
  37. 'transaction_id',
  38. 'remark',
  39. ];
  40. protected $casts = [
  41. 'admin_user_id' => 'integer',
  42. 'operation_type' => AdminOperationType::class,
  43. 'item_id' => 'integer',
  44. 'quantity' => 'integer',
  45. 'price' => 'decimal:5',
  46. 'total_amount' => 'decimal:5',
  47. 'before_warehouse_quantity' => 'integer',
  48. 'after_warehouse_quantity' => 'integer',
  49. 'transaction_id' => 'integer',
  50. ];
  51. }