From 0b8ff2218981cd6b8de7f1667a7a2f6dbdd65ab5 Mon Sep 17 00:00:00 2001 From: weiz <736250432@qq.com> Date: Thu, 28 Mar 2024 16:09:04 +0800 Subject: [PATCH] update --- .../validate/bid/BidSecurityApplyValidate.php | 260 +++++++++--------- 1 file changed, 130 insertions(+), 130 deletions(-) diff --git a/app/adminapi/validate/bid/BidSecurityApplyValidate.php b/app/adminapi/validate/bid/BidSecurityApplyValidate.php index 52bd6e533..6d017db68 100644 --- a/app/adminapi/validate/bid/BidSecurityApplyValidate.php +++ b/app/adminapi/validate/bid/BidSecurityApplyValidate.php @@ -11,139 +11,139 @@ // +---------------------------------------------------------------------- // | author: likeadminTeam // +---------------------------------------------------------------------- - -namespace app\adminapi\validate\bid; - - -use app\common\model\bid\BidBiddingDecision; -use app\common\model\bid\BidSecurityApply; -use app\common\model\dict\DictData; -use app\common\validate\BaseValidate; - - -/** - * BidSecurityApply验证器 - * Class BidSecurityApplyValidate - * @package app\adminapi\validate\bid - */ -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']); - } + namespace app\adminapi\validate\bid; - 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; - } + use app\common\model\bid\BidBiddingDecision; + use app\common\model\bid\BidSecurityApply; + use app\common\model\dict\DictData; + use app\common\validate\BaseValidate; - public function checkPayType($value): bool|string + + /** + * BidSecurityApply验证器 + * Class BidSecurityApplyValidate + * @package app\adminapi\validate\bid + */ + class BidSecurityApplyValidate extends BaseValidate { - $dict = DictData::where('type_value','pay_type')->column('value'); - if(!in_array($value,$dict)){ - return '付款方式无效'; + + /** + * 设置校验规则 + * @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); } - return true; - } - -} \ No newline at end of file + + + /** + * @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; + } + + } \ No newline at end of file