Exchange.php 550 B

123456789101112131415161718192021222324252627282930313233343536
  1. <?php
  2. namespace app\api\validate;
  3. use think\Validate;
  4. class Exchange extends Validate
  5. {
  6. /**
  7. * 验证规则
  8. */
  9. protected $rule = [
  10. 'product_id' => 'require',
  11. 'stock' => 'require|number|gt:0'
  12. ];
  13. /**
  14. * 提示消息
  15. */
  16. protected $message = [
  17. 'product_id.require' => '产品ID有误',
  18. 'stock' => '数量有误'
  19. ];
  20. /**
  21. * 验证场景
  22. */
  23. protected $scene = [
  24. 'order' => ['product_id', 'stock'],
  25. ];
  26. }