Screen.php 862 B

1234567891011121314151617181920212223242526272829303132333435363738
  1. <?php
  2. namespace app\common\validate;
  3. use think\Db;
  4. use think\Validate;
  5. class Screen extends Validate{
  6. protected $rule = [
  7. 'title|名称' => 'require|length:1,50',
  8. // 'tid|模板' => 'require|gt:0',
  9. 'type|类型' => 'require|in:1,2,3',
  10. ];
  11. protected $message = [
  12. 'tid.require' => '未选择模板',
  13. 'tid.gt' => '未选择模板',
  14. ];
  15. protected function checkContent($value,$rule,$data=[])
  16. {
  17. if(!$data['content']){
  18. return '模块绑定不能为空';
  19. }
  20. $content = json_decode($data['content'],true);
  21. if(empty($content)){
  22. return '模块绑定不能为空';
  23. }
  24. foreach ($content as $k=>$v){
  25. if($v['mid'] == 0){
  26. return '未选择模块';
  27. }
  28. }
  29. return true;
  30. }
  31. }