智慧教务系统
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

49 lines
1.9 KiB

<?php
// +----------------------------------------------------------------------
// | Niucloud-admin 企业快速开发的多应用管理平台
// +----------------------------------------------------------------------
// | 官方网址:https://www.niucloud.com
// +----------------------------------------------------------------------
// | niucloud团队 版权所有 开源版本可自由商用
// +----------------------------------------------------------------------
// | Author: Niucloud Team
// +----------------------------------------------------------------------
namespace app\validate\document;
use core\base\BaseValidate;
/**
* 文档生成验证器
* Class DocumentGenerate
* @package app\validate\document
*/
class DocumentGenerate extends BaseValidate
{
protected $rule = [
'template_id' => 'require|integer|gt:0',
'user_type' => 'require|in:1,2',
'user_id' => 'require|integer|gt:0',
'fill_data' => 'require|array',
'output_filename' => 'max:255'
];
protected $message = [
'template_id.require' => '模板ID不能为空',
'template_id.integer' => '模板ID必须为整数',
'template_id.gt' => '模板ID必须大于0',
'user_type.require' => '用户类型不能为空',
'user_type.in' => '用户类型必须为1(内部员工)或2(外部会员)',
'user_id.require' => '用户ID不能为空',
'user_id.integer' => '用户ID必须为整数',
'user_id.gt' => '用户ID必须大于0',
'fill_data.require' => '填充数据不能为空',
'fill_data.array' => '填充数据必须为数组格式',
'output_filename.max' => '输出文件名长度不能超过255个字符'
];
protected $scene = [
'generate' => ['template_id', 'user_type', 'user_id', 'fill_data', 'output_filename'],
'preview' => ['template_id', 'fill_data']
];
}