12345678910111213141516171819202122232425262728293031323334353637 |
- <?php
- namespace app\admin\validate\sys_manage;
- use support\Validate;
- class ConfigValidate extends Validate
- {
- protected $rule = [
- 'config_status|状态' => 'require|in:ACTIVED,DISABLED',
- 'config_category|分类' => 'require|in:SYSTEM,APP',
- 'config_key|标识' => 'require|alphaDash',
- 'config_name|名称' => 'max:255',
- 'config_alias|别名' => 'max:255',
- 'config_value_json|配置内容' => 'isJson',
- 'config_sort|排序' => 'integer',
- 'config_groupby|分组' => 'max:255',
- 'config_extend_json' => 'isJson'
- ];
- protected $message = [];
- protected $scene = [
- 'add' => ['config_status', 'config_category', 'config_key', 'config_name', 'config_alias', 'config_value_json', 'config_sort', 'config_groupby', 'config_extend_json'],
- 'update' => ['config_category', 'config_key', 'config_name', 'config_alias', 'config_value_json', 'config_sort', 'config_groupby', 'config_extend_json'],
- 'update_status' => ['config_status']
- ];
- protected function isJson($value)
- {
- if (is_json($value)) {
- return true;
- }
- return '数据格式错误~';
- }
- }
|