Commit 85eba836 authored by suntengda's avatar suntengda

update 保存活动配置增加日期格式验证

parent e4e0828f
......@@ -49,4 +49,19 @@ class BaseValidate extends Validate
return false;
}
}
protected function isDate($value)
{
//匹配日期格式
if (preg_match("/^([0-9]{4})-([0-9]{2})-([0-9]{2})$/", $value, $parts)) {
//检测是否为日期
if (checkdate($parts[2], $parts[3], $parts[1])) {
return true;
} else {
return false;
}
} else {
return false;
}
}
}
\ No newline at end of file
......@@ -5,12 +5,12 @@ namespace Validate;
class ColonelConfigValidate extends BaseValidate
{
protected $rule = [
'date' => 'require',
'date' => 'require|isDate',
'config' => 'require',
];
protected $message = [
'date' => 'date 参数不能为空',
'date' => 'date 参数格式错误',
'config' => 'config 参数不能为空',
'marketing_id' => 'marketing_id 参数不能为空',
];
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment