12345678910111213141516171819202122232425262728293031323334 |
- <?php
- namespace app\common\validate;
- use think\Db;
- use think\Validate;
- class ScreenTemplate extends Validate{
- protected $rule = [
- 'title|名称' => 'require|length:1,50',
- 'name|标识' => 'require|length:1,50|unique:screen_template',
- // 'img|图片' => 'require',
- 'nums|模块数量' => 'require|gt:0',
- ];
- 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;
- }
- }
|