update
This commit is contained in:
parent
ad0dad9a89
commit
a84a1c003e
@ -12,23 +12,23 @@
|
||||
// | author: likeadminTeam
|
||||
// +----------------------------------------------------------------------
|
||||
|
||||
namespace app\adminapi\validate\finance;
|
||||
namespace app\adminapi\validate\finance;
|
||||
|
||||
|
||||
use app\common\model\auth\Admin;
|
||||
use app\common\model\contract\Contract;
|
||||
use app\common\model\dict\DictData;
|
||||
use app\common\model\finance\FinanceReturnedMoney;
|
||||
use app\common\validate\BaseValidate;
|
||||
use app\common\model\auth\Admin;
|
||||
use app\common\model\contract\Contract;
|
||||
use app\common\model\dict\DictData;
|
||||
use app\common\model\finance\FinanceReturnedMoney;
|
||||
use app\common\validate\BaseValidate;
|
||||
|
||||
|
||||
/**
|
||||
/**
|
||||
* FinanceReturnedMoney验证器
|
||||
* Class FinanceReturnedMoneyValidate
|
||||
* @package app\adminapi\validate\finance
|
||||
*/
|
||||
class FinanceReturnedMoneyValidate extends BaseValidate
|
||||
{
|
||||
class FinanceReturnedMoneyValidate extends BaseValidate
|
||||
{
|
||||
|
||||
/**
|
||||
* 设置校验规则
|
||||
@ -40,7 +40,6 @@ class FinanceReturnedMoneyValidate extends BaseValidate
|
||||
'return_date' => 'require|dateFormat:Y-m-d',
|
||||
'period' => 'require|checkPeriod',
|
||||
'amount' => 'require|float|gt:0',
|
||||
'return_status' => 'require|checkReturnStatus',
|
||||
'return_duty_id' => 'require|checkReturnDuty',
|
||||
'annex' => 'checkAnnex',
|
||||
'flow_id' => 'require|checkFlow',
|
||||
@ -58,7 +57,6 @@ class FinanceReturnedMoneyValidate extends BaseValidate
|
||||
'return_date' => '计划回款日期',
|
||||
'period' => '期次',
|
||||
'amount' => '金额',
|
||||
'return_status' => '回款状态',
|
||||
'return_duty_id' => '回款责任人',
|
||||
];
|
||||
|
||||
@ -71,7 +69,7 @@ class FinanceReturnedMoneyValidate extends BaseValidate
|
||||
*/
|
||||
public function sceneAdd()
|
||||
{
|
||||
return $this->remove('id', true)->remove('flow_id',true)->remove('path',true);
|
||||
return $this->remove('id', true)->remove('flow_id', true)->remove('path', true);
|
||||
}
|
||||
|
||||
|
||||
@ -83,7 +81,7 @@ class FinanceReturnedMoneyValidate extends BaseValidate
|
||||
*/
|
||||
public function sceneEdit()
|
||||
{
|
||||
return $this->remove('flow_id',true)->remove('path',true);
|
||||
return $this->remove('flow_id', true)->remove('path', true);
|
||||
}
|
||||
|
||||
|
||||
@ -95,7 +93,7 @@ class FinanceReturnedMoneyValidate extends BaseValidate
|
||||
*/
|
||||
public function sceneDelete()
|
||||
{
|
||||
return $this->only(['id'])->remove('id','checkData');
|
||||
return $this->only(['id'])->remove('id', 'checkData');
|
||||
}
|
||||
|
||||
|
||||
@ -112,13 +110,13 @@ class FinanceReturnedMoneyValidate extends BaseValidate
|
||||
|
||||
public function sceneApprove()
|
||||
{
|
||||
return $this->only(['id','flow_id','path']);
|
||||
return $this->only(['id', 'flow_id', 'path']);
|
||||
}
|
||||
|
||||
public function checkData($value): bool|string
|
||||
{
|
||||
$data = FinanceReturnedMoney::where('id',$value)->findOrEmpty();
|
||||
if($data->isEmpty()){
|
||||
$data = FinanceReturnedMoney::where('id', $value)->findOrEmpty();
|
||||
if ($data->isEmpty()) {
|
||||
return '数据不存在';
|
||||
}
|
||||
return true;
|
||||
@ -126,8 +124,8 @@ class FinanceReturnedMoneyValidate extends BaseValidate
|
||||
|
||||
public function checkContract($value): bool|string
|
||||
{
|
||||
$data = Contract::where('id',$value)->findOrEmpty();
|
||||
if($data->isEmpty()){
|
||||
$data = Contract::where('id', $value)->findOrEmpty();
|
||||
if ($data->isEmpty()) {
|
||||
return '项目合同不存在';
|
||||
}
|
||||
return true;
|
||||
@ -135,8 +133,8 @@ class FinanceReturnedMoneyValidate extends BaseValidate
|
||||
|
||||
public function checkPeriod($value): bool|string
|
||||
{
|
||||
$dict = DictData::where('type_value','pay_period')->column('value');
|
||||
if(!in_array($value,$dict)){
|
||||
$dict = DictData::where('type_value', 'pay_period')->column('value');
|
||||
if (!in_array($value, $dict)) {
|
||||
return '期次无效';
|
||||
}
|
||||
return true;
|
||||
@ -144,8 +142,8 @@ class FinanceReturnedMoneyValidate extends BaseValidate
|
||||
|
||||
public function checkReturnStatus($value): bool|string
|
||||
{
|
||||
$dict = DictData::where('type_value','return_status')->column('value');
|
||||
if(!in_array($value,$dict)){
|
||||
$dict = DictData::where('type_value', 'return_status')->column('value');
|
||||
if (!in_array($value, $dict)) {
|
||||
return '回款状态无效';
|
||||
}
|
||||
return true;
|
||||
@ -153,11 +151,11 @@ class FinanceReturnedMoneyValidate extends BaseValidate
|
||||
|
||||
public function checkReturnDuty($value): bool|string
|
||||
{
|
||||
$data = Admin::where('id',$value)->findOrEmpty();
|
||||
if($data->isEmpty()){
|
||||
$data = Admin::where('id', $value)->findOrEmpty();
|
||||
if ($data->isEmpty()) {
|
||||
return '回款责任人不存在';
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user