|
@@ -0,0 +1,51 @@
|
|
|
+<?php
|
|
|
+
|
|
|
+namespace app\admin\validate\sys_manage;
|
|
|
+
|
|
|
+use think\Validate;
|
|
|
+
|
|
|
+class AdvValidate extends Validate
|
|
|
+{
|
|
|
+ protected $rule = [
|
|
|
+ 'adv_id' => 'require|integer',
|
|
|
+ 'join_adv_category_id' => 'integer',
|
|
|
+ 'adv_status' => 'in:PENDING,ACTIVED,DISABLED',
|
|
|
+ 'adv_category' => 'max:32',
|
|
|
+ 'adv_name' => 'require|max:64',
|
|
|
+ 'adv_title' => 'require|max:64',
|
|
|
+ 'adv_carrier' => 'max:64',
|
|
|
+ 'adv_media' => 'isJson',
|
|
|
+ 'adv_href' => 'max:64',
|
|
|
+ 'adv_config_json' => 'isJson',
|
|
|
+ 'content_sort' => 'integer',
|
|
|
+ 'content_groupby' => 'max:32',
|
|
|
+ 'content_remark' => 'max:128',
|
|
|
+ 'content_extend_json' => 'isJson'
|
|
|
+ ];
|
|
|
+
|
|
|
+ protected $message = [];
|
|
|
+
|
|
|
+ protected $scene = [
|
|
|
+ 'add' => ['join_adv_category_id', 'adv_status', 'adv_category', 'adv_name', 'adv_title', 'adv_carrier', 'adv_media',
|
|
|
+ 'adv_href', 'adv_config_json', 'content_sort', 'content_groupby', 'content_remark', 'content_extend_json'],
|
|
|
+ 'update' => ['adv_id', 'join_adv_category_id', 'adv_status', 'adv_category', 'adv_name', 'adv_title', 'adv_carrier', 'adv_media',
|
|
|
+ 'adv_href', 'adv_config_json', 'content_sort', 'content_groupby', 'content_remark', 'content_extend_json'],
|
|
|
+ ];
|
|
|
+
|
|
|
+ /**
|
|
|
+ * @Desc 验证json
|
|
|
+ * @Author Gorden
|
|
|
+ * @Date 2024/3/5 10:05
|
|
|
+ *
|
|
|
+ * @param $value
|
|
|
+ * @return bool
|
|
|
+ */
|
|
|
+ protected function isJson($value)
|
|
|
+ {
|
|
|
+ if (is_json($value)) {
|
|
|
+ return true;
|
|
|
+ }
|
|
|
+
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+}
|