123456789101112131415161718192021222324252627282930313233343536373839404142434445464748 |
- <?php
- namespace app\admin\validate\marketing;
- use support\Validate;
- class PremisesValidate extends Validate
- {
- protected $rule = [
- 'premises_id' => 'require|integer',
- 'join_premises_category_id' => 'require|integer',
- 'premises_status' => 'require|in:ACTIVED,DISABLED',
- 'premises_category' => 'alphaDash|max:32',
- 'premises_code' => 'max:32',
- 'premises_name' => 'max:64',
- 'premises_city' => 'max:64',
- 'premises_contact_json' => 'isJson',
- 'premises_config_json' => 'isJson',
- 'premises_remark' => 'max:128',
- 'premises_extend_json' => 'isJson'
- ];
- protected $message = [];
- protected $scene = [
- 'add' => ['join_premises_category_id', 'premises_status', 'premises_category', 'premises_code', 'premises_name',
- 'premises_city', 'premises_contact_json', 'premises_config_json', 'premises_remark', 'premises_extend_json'],
- 'update' => ['premises_id', 'join_premises_category_id', 'premises_status', 'premises_category', 'premises_code', 'premises_name',
- 'premises_city', 'premises_contact_json', 'premises_config_json', 'premises_remark', 'premises_extend_json'],
- 'updateStatus' => ['premises_id', 'premises_status'],
- ];
- /**
- * @Desc 验证json
- * @Author Gorden
- * @Date 2024/3/6 15:23
- *
- * @param $value
- * @return string|true
- */
- public function isJson($value)
- {
- if (is_json($value)) {
- return true;
- }
- return "数据格式错误~";
- }
- }
|