update
This commit is contained in:
parent
c755ea1db7
commit
0b8ff22189
@ -12,138 +12,138 @@
|
|||||||
// | author: likeadminTeam
|
// | author: likeadminTeam
|
||||||
// +----------------------------------------------------------------------
|
// +----------------------------------------------------------------------
|
||||||
|
|
||||||
namespace app\adminapi\validate\bid;
|
namespace app\adminapi\validate\bid;
|
||||||
|
|
||||||
|
|
||||||
use app\common\model\bid\BidBiddingDecision;
|
use app\common\model\bid\BidBiddingDecision;
|
||||||
use app\common\model\bid\BidSecurityApply;
|
use app\common\model\bid\BidSecurityApply;
|
||||||
use app\common\model\dict\DictData;
|
use app\common\model\dict\DictData;
|
||||||
use app\common\validate\BaseValidate;
|
use app\common\validate\BaseValidate;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* BidSecurityApply验证器
|
* BidSecurityApply验证器
|
||||||
* Class BidSecurityApplyValidate
|
* Class BidSecurityApplyValidate
|
||||||
* @package app\adminapi\validate\bid
|
* @package app\adminapi\validate\bid
|
||||||
*/
|
*/
|
||||||
class BidSecurityApplyValidate extends BaseValidate
|
class BidSecurityApplyValidate extends BaseValidate
|
||||||
{
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 设置校验规则
|
|
||||||
* @var string[]
|
|
||||||
*/
|
|
||||||
protected $rule = [
|
|
||||||
'id' => 'require|checkData',
|
|
||||||
'bidding_decision_id' => 'require|checkBiddingDecision',
|
|
||||||
'applier' => 'require',
|
|
||||||
'pay_type' => 'require|checkPayType',
|
|
||||||
'refund_date' => 'dateFormat:Y-m-d',
|
|
||||||
'annex' => 'checkAnnex',
|
|
||||||
'deposit_bank' => 'require',
|
|
||||||
'account_name' => 'require',
|
|
||||||
'account' => 'require',
|
|
||||||
'flow_id' => 'require|checkFlow',
|
|
||||||
'path' => 'require',
|
|
||||||
];
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 参数描述
|
|
||||||
* @var string[]
|
|
||||||
*/
|
|
||||||
protected $field = [
|
|
||||||
'id' => 'id',
|
|
||||||
'bidding_decision_id' => '投标决策',
|
|
||||||
'applier' => '申请人',
|
|
||||||
'pay_type' => '付款方式',
|
|
||||||
'refund_date' => '预计退还时间',
|
|
||||||
'deposit_bank' => '开户银行',
|
|
||||||
'account_name' => '开户名称',
|
|
||||||
'account' => '账号',
|
|
||||||
];
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @notes 添加场景
|
|
||||||
* @return BidSecurityApplyValidate
|
|
||||||
* @author likeadmin
|
|
||||||
* @date 2023/12/16 10:46
|
|
||||||
*/
|
|
||||||
public function sceneAdd()
|
|
||||||
{
|
|
||||||
return $this->remove('id',true)->remove('flow_id',true)->remove('path',true);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @notes 编辑场景
|
|
||||||
* @return BidSecurityApplyValidate
|
|
||||||
* @author likeadmin
|
|
||||||
* @date 2023/12/16 10:46
|
|
||||||
*/
|
|
||||||
public function sceneEdit()
|
|
||||||
{
|
|
||||||
return $this->remove('flow_id',true)->remove('path',true);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @notes 删除场景
|
|
||||||
* @return BidSecurityApplyValidate
|
|
||||||
* @author likeadmin
|
|
||||||
* @date 2023/12/16 10:46
|
|
||||||
*/
|
|
||||||
public function sceneDelete()
|
|
||||||
{
|
|
||||||
return $this->only(['id'])->remove('id','checkData');
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @notes 详情场景
|
|
||||||
* @return BidSecurityApplyValidate
|
|
||||||
* @author likeadmin
|
|
||||||
* @date 2023/12/16 10:46
|
|
||||||
*/
|
|
||||||
public function sceneDetail()
|
|
||||||
{
|
|
||||||
return $this->only(['id']);
|
|
||||||
}
|
|
||||||
|
|
||||||
public function sceneApprove()
|
|
||||||
{
|
{
|
||||||
return $this->only(['id','flow_id','path']);
|
|
||||||
}
|
|
||||||
|
|
||||||
public function checkData($value): bool|string
|
/**
|
||||||
{
|
* 设置校验规则
|
||||||
$data = BidSecurityApply::where('id',$value)->findOrEmpty();
|
* @var string[]
|
||||||
if($data->isEmpty()){
|
*/
|
||||||
return '数据不存在';
|
protected $rule = [
|
||||||
}
|
'id' => 'require|checkData',
|
||||||
return true;
|
'bidding_decision_id' => 'require|checkBiddingDecision',
|
||||||
}
|
'applier' => 'require',
|
||||||
|
'pay_type' => 'require|checkPayType',
|
||||||
|
'refund_date' => 'dateFormat:Y-m-d',
|
||||||
|
'annex' => 'checkAnnex',
|
||||||
|
'deposit_bank' => 'require',
|
||||||
|
'account_name' => 'require',
|
||||||
|
'account' => 'require',
|
||||||
|
'flow_id' => 'require|checkFlow',
|
||||||
|
'path' => 'require',
|
||||||
|
];
|
||||||
|
|
||||||
public function checkBiddingDecision($value): bool|string
|
|
||||||
{
|
|
||||||
$data = BidBiddingDecision::where('id',$value)->findOrEmpty();
|
|
||||||
if($data->isEmpty()){
|
|
||||||
return '投标决策信息不存在';
|
|
||||||
}
|
|
||||||
if($data['is_margin'] != 1){
|
|
||||||
return '此投标信息没有保证金';
|
|
||||||
}
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
public function checkPayType($value): bool|string
|
/**
|
||||||
{
|
* 参数描述
|
||||||
$dict = DictData::where('type_value','pay_type')->column('value');
|
* @var string[]
|
||||||
if(!in_array($value,$dict)){
|
*/
|
||||||
return '付款方式无效';
|
protected $field = [
|
||||||
}
|
'id' => 'id',
|
||||||
return true;
|
'bidding_decision_id' => '投标决策',
|
||||||
}
|
'applier' => '申请人',
|
||||||
|
'pay_type' => '付款方式',
|
||||||
|
'refund_date' => '预计退还时间',
|
||||||
|
'deposit_bank' => '开户银行',
|
||||||
|
'account_name' => '开户名称',
|
||||||
|
'account' => '账号',
|
||||||
|
];
|
||||||
|
|
||||||
}
|
|
||||||
|
/**
|
||||||
|
* @notes 添加场景
|
||||||
|
* @return BidSecurityApplyValidate
|
||||||
|
* @author likeadmin
|
||||||
|
* @date 2023/12/16 10:46
|
||||||
|
*/
|
||||||
|
public function sceneAdd()
|
||||||
|
{
|
||||||
|
return $this->remove('id', true)->remove('flow_id', true)->remove('path', true);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @notes 编辑场景
|
||||||
|
* @return BidSecurityApplyValidate
|
||||||
|
* @author likeadmin
|
||||||
|
* @date 2023/12/16 10:46
|
||||||
|
*/
|
||||||
|
public function sceneEdit()
|
||||||
|
{
|
||||||
|
return $this->remove('flow_id', true)->remove('path', true);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @notes 删除场景
|
||||||
|
* @return BidSecurityApplyValidate
|
||||||
|
* @author likeadmin
|
||||||
|
* @date 2023/12/16 10:46
|
||||||
|
*/
|
||||||
|
public function sceneDelete()
|
||||||
|
{
|
||||||
|
return $this->only(['id'])->remove('id', 'checkData');
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @notes 详情场景
|
||||||
|
* @return BidSecurityApplyValidate
|
||||||
|
* @author likeadmin
|
||||||
|
* @date 2023/12/16 10:46
|
||||||
|
*/
|
||||||
|
public function sceneDetail()
|
||||||
|
{
|
||||||
|
return $this->only(['id']);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function sceneApprove()
|
||||||
|
{
|
||||||
|
return $this->only(['id', 'flow_id', 'path']);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function checkData($value): bool|string
|
||||||
|
{
|
||||||
|
$data = BidSecurityApply::where('id', $value)->findOrEmpty();
|
||||||
|
if ($data->isEmpty()) {
|
||||||
|
return '数据不存在';
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function checkBiddingDecision($value): bool|string
|
||||||
|
{
|
||||||
|
$data = BidBiddingDecision::where('id', $value)->findOrEmpty();
|
||||||
|
if ($data->isEmpty()) {
|
||||||
|
return '投标决策信息不存在';
|
||||||
|
}
|
||||||
|
// if($data['is_margin'] != 1){
|
||||||
|
// return '此投标信息没有保证金';
|
||||||
|
// }
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function checkPayType($value): bool|string
|
||||||
|
{
|
||||||
|
$dict = DictData::where('type_value', 'pay_type')->column('value');
|
||||||
|
if (!in_array($value, $dict)) {
|
||||||
|
return '付款方式无效';
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
Loading…
x
Reference in New Issue
Block a user