31 lines
742 B
PHP
31 lines
742 B
PHP
![]() |
<?php
|
||
|
|
||
|
namespace app\common\validate;
|
||
|
|
||
|
use think\Validate;
|
||
|
|
||
|
class PhotoServiceValidate extends Validate
|
||
|
{
|
||
|
protected $rule = [
|
||
|
'service_type' => 'require',
|
||
|
'service_standard' => 'require',
|
||
|
'detail' => 'require',
|
||
|
'price' => 'checkPrice',
|
||
|
];
|
||
|
|
||
|
protected $message = [
|
||
|
'service_type' => '请选择服务类别',
|
||
|
'service_standard' => '请选择服务标准',
|
||
|
'detail' => '请填写服务内容',
|
||
|
'price' => '请填写服务价格',
|
||
|
];
|
||
|
|
||
|
public function checkPrice($value, $rule, $data = [], $field = '')
|
||
|
{
|
||
|
if (empty($value) || !is_numeric($value) || $value < 0) {
|
||
|
return '请填写正确服务价格';
|
||
|
}
|
||
|
return true;
|
||
|
}
|
||
|
|
||
|
}
|