1234567891011121314151617181920212223242526272829303132333435363738 |
- <?php
- namespace app\common\validate;
- use think\Db;
- use think\Validate;
- class Screen extends Validate{
- protected $rule = [
- 'title|名称' => 'require|length:1,50',
- // 'tid|模板' => 'require|gt:0',
- 'type|类型' => 'require|in:1,2,3',
- ];
- protected $message = [
- 'tid.require' => '未选择模板',
- 'tid.gt' => '未选择模板',
- ];
- protected function checkContent($value,$rule,$data=[])
- {
- if(!$data['content']){
- return '模块绑定不能为空';
- }
- $content = json_decode($data['content'],true);
- if(empty($content)){
- return '模块绑定不能为空';
- }
- foreach ($content as $k=>$v){
- if($v['mid'] == 0){
- return '未选择模块';
- }
- }
- return true;
- }
- }
|