SalaryApply.php 776 B

1234567891011121314151617181920212223242526272829303132333435363738
  1. <?php
  2. namespace app\common\validate;
  3. use think\Db;
  4. use think\Validate;
  5. class SalaryApply extends Validate{
  6. protected $rule = [
  7. 'type|分类' => 'require|in:1,2,3,4,5,6,7,8,9',
  8. 'title|名称' => 'require',
  9. 'userids' => 'require|checkUser',
  10. 'cate|类型' => 'require|in:1,2,3,4,5',
  11. ];
  12. protected $message = [
  13. 'userids.require' => '未选择审核人员',
  14. ];
  15. protected $scene = [
  16. ];
  17. protected function checkUser($value,$rule,$data=[]){
  18. $users = explode(',',$value);
  19. $arr = [];
  20. foreach ($users as $v){
  21. if($v){
  22. $arr[] = $v;
  23. }
  24. }
  25. if(!$arr){
  26. return '未选择审核人员';
  27. }
  28. return true;
  29. }
  30. }