ShopValidate.php 1.4 KB

1234567891011121314151617181920212223242526272829303132333435
  1. <?php
  2. namespace app\admin\validate\medical;
  3. use support\Validate;
  4. class ShopValidate extends Validate
  5. {
  6. protected $rule = [
  7. 'shop_id' => 'require|integer',
  8. 'shop_name|店铺名称' => 'require',
  9. 'shop_real_name|负责人' => 'require',
  10. 'shop_logo|LOGO' => 'url',
  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. }