56 lines
1.6 KiB
PHP
56 lines
1.6 KiB
PHP
<?php
|
|
namespace app\validate;
|
|
|
|
use think\Validate;
|
|
|
|
class Achievement extends Validate
|
|
{
|
|
protected $achievementRule = [
|
|
'title' => 'require|length:1,60',
|
|
'visible' => 'require|in:0,1',
|
|
];
|
|
protected $achievementMessage = [
|
|
'title.require' => '标题不能为空',
|
|
'name.length' => '标题长度限制为60个字符以内',
|
|
'visible.require' => '历程状态必须设置',
|
|
'visible.in' => '状态参数错误',
|
|
];
|
|
|
|
protected $achievementInfoRule = [
|
|
'title' => 'require|length:1,60',
|
|
'order_company' => 'require|length:1,100',
|
|
'goods_model' => 'require|length:1,300',
|
|
'goods_amount' => 'require|length:1,500',
|
|
'visible' => 'require|in:0,1',
|
|
];
|
|
protected $achievementInfoMessage = [
|
|
'title.require' => '标题不能为空',
|
|
'name.length' => '标题长度限制为60个字符以内',
|
|
'visible.require' => '历程状态必须设置',
|
|
'visible.in' => '状态参数错误',
|
|
];
|
|
|
|
/**
|
|
* 校验业绩数据
|
|
* @param array $data
|
|
* @return bool
|
|
*/
|
|
public function checkAchievement(array $data)
|
|
{
|
|
$this->rule = $this->achievementRule;
|
|
$this->message = $this->achievementMessage;
|
|
return $this->check($data);
|
|
}
|
|
|
|
/**
|
|
* 校验业绩详情数据
|
|
* @param array $data
|
|
* @return bool
|
|
*/
|
|
public function checkAchievementInfo(array $data)
|
|
{
|
|
$this->rule = $this->achievementInfoRule;
|
|
$this->message = $this->achievementInfoMessage;
|
|
return $this->check($data);
|
|
}
|
|
} |