Commit e0a32a06 authored by pengfei's avatar pengfei

Merge branch 'colonel' of https://git.yidian-inc.com:8021/bp/goods into colonel

parents c229f1cd 85eba836
...@@ -49,4 +49,19 @@ class BaseValidate extends Validate ...@@ -49,4 +49,19 @@ class BaseValidate extends Validate
return false; 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; ...@@ -5,12 +5,12 @@ namespace Validate;
class ColonelConfigValidate extends BaseValidate class ColonelConfigValidate extends BaseValidate
{ {
protected $rule = [ protected $rule = [
'date' => 'require', 'date' => 'require|isDate',
'config' => 'require', 'config' => 'require',
]; ];
protected $message = [ protected $message = [
'date' => 'date 参数不能为空', 'date' => 'date 参数格式错误',
'config' => 'config 参数不能为空', 'config' => 'config 参数不能为空',
'marketing_id' => 'marketing_id 参数不能为空', '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