ShopValidate.php 1.3 KB

1234567891011121314151617181920212223242526272829303132333435
  1. <?php
  2. namespace app\admin\validate\medical;
  3. use think\Validate;
  4. class ShopValidate extends Validate
  5. {
  6. protected $rule = [
  7. 'shop_id' => 'require|integer',
  8. 'shop_name' => 'require|chsDash',
  9. 'shop_real_name' => 'require|chsDash',
  10. 'shop_logo' => 'regex:/^[0-9a-zA-Z\/\.]+$/',
  11. 'shop_img' => 'regex:/^[0-9a-zA-Z\.\/]+$/',
  12. 'shop_label' => '/^[\x{4e00}-\x{9fa5}a-zA-Z0-9\_\-\,\s]+$/u',
  13. 'shop_category_id' => 'require|integer',
  14. 'shop_score' => 'require|float',
  15. 'shop_type' => 'require|in:1,2,3,4,5',
  16. 'shop_is_audit' => 'require|in:0,1',
  17. 'shop_lat' => 'regex:/^[0-9a-zA-Z\.]+$/',
  18. 'shop_lng' => 'regex:/^[0-9a-zA-Z\.]+$/',
  19. 'shop_phone' => 'mobile',
  20. 'shop_sort' => 'require|integer',
  21. 'shop_status' => 'require|in:0,1'
  22. ];
  23. protected $message = [];
  24. protected $scene = [
  25. 'add' => ['shop_name', 'shop_real_name', 'shop_logo', 'shop_img', 'shop_label', 'shop_category_id', 'shop_score', 'shop_type',
  26. 'shop_is_audit', 'shop_lat', 'shop_lng', 'shop_phone', 'shop_sort', 'shop_status'],
  27. 'update' => ['shop_id', 'shop_name', 'shop_real_name', 'shop_logo', 'shop_img', 'shop_label', 'shop_category_id', 'shop_score',
  28. 'shop_type', 'shop_is_audit', 'shop_lat', 'shop_lng', 'shop_phone', 'shop_sort', 'shop_status'],
  29. ];
  30. }