Teac.php 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. <?php
  2. namespace app\api\validate;
  3. use think\Validate;
  4. class Teac extends Validate
  5. {
  6. /**
  7. * 验证规则
  8. */
  9. protected $rule = [
  10. 'market_id' => 'require',
  11. 'product_id' => 'require',
  12. 'transfer_id' => 'require',
  13. '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. 'price' => '价格有误',
  28. 'stock' => '数量有误',
  29. 'buying_id' => '参数有误',
  30. 'order_id' => '参数有误',
  31. 'phone.mobile' => '手机号有误',
  32. 'address.require' => '请填写地址',
  33. ];
  34. /**
  35. * 验证场景
  36. */
  37. protected $scene = [
  38. 'buying' => ['price', 'stock'],
  39. 'sell' => ['price', 'stock'],
  40. 'sellbuying' => ['buying_id', 'order_id'],
  41. 'cancelbuying' => ['buying_id'],
  42. ];
  43. }