Chabao.php 1.3 KB

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