Market.php 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. <?php
  2. namespace app\api\validate;
  3. use think\Validate;
  4. class Market extends Validate
  5. {
  6. /**
  7. * 验证规则
  8. */
  9. protected $rule = [
  10. 'market_id' => 'require',
  11. 'product_id' => 'require',
  12. 'transfer_id' => 'require',
  13. 'min_price' => 'require|number|gt:0',
  14. 'stock' => 'require|number|gt:0',
  15. 'buying_id' => 'require|number|gt:0',
  16. 'order_id' => 'require|number',
  17. 'address' => 'require',
  18. 'price' => 'require|number|gt:0',
  19. ];
  20. /**
  21. * 提示消息
  22. */
  23. protected $message = [
  24. 'market_id.require' => '订单ID有误',
  25. 'product_id.require' => '产品ID有误', //
  26. 'transfer_id.require' => '参数ID有误',
  27. 'min_price' => '价格有误',
  28. 'stock' => '数量有误',
  29. 'buying_id' => '参数有误',
  30. 'order_id' => '参数有误',
  31. 'phone.mobile' => '手机号有误',
  32. 'address.require' => '请填写地址',
  33. ];
  34. /**
  35. * 验证场景
  36. */
  37. protected $scene = [
  38. 'collect' => ['market_id'],
  39. 'announcement' => ['product_id'],
  40. 'transferlock' => ['transfer_id'],
  41. 'buying' => ['product_id', 'min_price', 'stock'],
  42. 'buying_info' => ['buying_id'],
  43. 'sellbuying' => ['buying_id', 'order_id'],
  44. 'cancelbuying' => ['buying_id'],
  45. ];
  46. }