PreOrder.php 1.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. <?php
  2. namespace app\common\validate;
  3. use think\Validate;
  4. class PreOrder extends Validate
  5. {
  6. // 验证规则
  7. protected $rule = [
  8. 'id' => 'require|number',
  9. 'company_id' => 'number',
  10. 'name' => 'require|max:32',
  11. 'mobile' => 'require|max:32',
  12. 'address' => 'max:256',
  13. 'car_id' => 'require|number',
  14. 'servicetype_id' => 'require|number',
  15. 'pre_time' => 'require',
  16. 'remark' => 'max:256',
  17. 'cancel_reason' => 'max:128',
  18. ];
  19. // 验证提示
  20. protected $message = [
  21. 'id.require' => '请输入预约单ID',
  22. 'id.number' => '您输入的预约单ID,必须是数字类型',
  23. 'company_id.number' => '您输入的门店,必须是数字类型',
  24. 'name.require' => '请输入联系人',
  25. 'name.max' => '您输入的联系人,必须小于32字符',
  26. 'mobile.require' => '请输入联系电话',
  27. 'mobile.max' => '您输入的联系电话,必须小于32字符',
  28. 'address.require' => '请输入联系地址',
  29. 'address.max' => '您输入的联系地址,必须小于256字符',
  30. 'car_id.require' => '请输入车辆',
  31. 'car_id.number' => '您输入的车辆,必须是数字类型',
  32. 'servicetype_id.require' => '请输入服务类型',
  33. 'servicetype_id.number' => '您输入的服务类型,必须是数字类型',
  34. 'pre_time.require' => '请输入预约时间',
  35. 'remark.max' => '您输入的备注,必须小于256字符',
  36. 'cancel_reason.max' => '您输入的备注,必须小于128字符',
  37. ];
  38. // 应用场景
  39. protected $scene = [
  40. 'add' => ['company_id','name','mobile','address','car_id','servicetype_id','pre_time','remark','cancel_reason'],
  41. 'edit' => ['id','company_id','name','mobile','address','car_id','servicetype_id','pre_time','remark','cancel_reason'],
  42. ];
  43. }