12345678910111213141516171819202122232425262728293031323334353637383940414243 |
- <?php
- namespace app\admin\validate\sys_manage;
- use support\Validate;
- class SupplierValidate extends Validate
- {
- protected $rule = [
- 'supplier_id' => 'require|integer',
- 'join_supplier_category_id' => 'integer',
- 'supplier_status|状态' => 'require|in:ACTIVED,DISABLED',
- 'supplier_category|分类' => 'max:32',
- 'supplier_name|名称' => 'require|max:64',
- 'supplier_contact_json' => 'isJson',
- 'supplier_config_json' => 'isJson',
- 'supplier_extend_json' => 'isJson'
- ];
- protected $message = [];
- protected $scene = [
- 'add' => ['join_supplier_category_id', 'supplier_status', 'supplier_category', 'supplier_name', 'supplier_contact_json', 'supplier_config_json', 'supplier_extend_json'],
- 'update' => ['supplier_id', 'join_supplier_category_id', 'supplier_status', 'supplier_category', 'supplier_name', 'supplier_contact_json', 'supplier_config_json', 'supplier_extend_json'],
- ];
- /**
- * @Desc 验证json数据
- * @Author Gorden
- * @Date 2024/3/27 13:18
- *
- * @param $value
- * @return string|true
- */
- public function isJson($value)
- {
- if (is_json($value)) {
- return true;
- }
- return "数据格式错误";
- }
- }
|