| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051 | <?phpnamespace app\admin\validate\sys_manage;use support\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_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_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;    }}
 |