Goods.php 486 B

1234567891011121314151617181920212223242526272829
  1. <?php
  2. namespace app\api\validate;
  3. use think\Validate;
  4. class Goods extends Validate
  5. {
  6. /**
  7. * 验证规则
  8. */
  9. protected $rule = [
  10. 'orderby' => 'in:weigh,sales,price,views,comments',
  11. ];
  12. /**
  13. * 提示消息
  14. */
  15. protected $message = [
  16. 'orderby.in' => '排序字段只能是权重、销量、价格、浏览数或评论数',
  17. ];
  18. /**
  19. * 验证场景
  20. */
  21. protected $scene = [
  22. 'lists' => ['orderby'],
  23. ];
  24. }