119 lines
3.1 KiB
PHP
119 lines
3.1 KiB
PHP
<?php
|
||
// +----------------------------------------------------------------------
|
||
// | likeadmin快速开发前后端分离管理后台(PHP版)
|
||
// +----------------------------------------------------------------------
|
||
// | 欢迎阅读学习系统程序代码,建议反馈是我们前进的动力
|
||
// | 开源版本可自由商用,可去除界面版权logo
|
||
// | gitee下载:https://gitee.com/likeshop_gitee/likeadmin
|
||
// | github下载:https://github.com/likeshop-github/likeadmin
|
||
// | 访问官网:https://www.likeadmin.cn
|
||
// | likeadmin团队 版权所有 拥有最终解释权
|
||
// +----------------------------------------------------------------------
|
||
// | author: likeadminTeam
|
||
// +----------------------------------------------------------------------
|
||
|
||
namespace app\adminapi\validate\bid;
|
||
|
||
|
||
use app\common\model\bid\BidDocumentExamination;
|
||
use app\common\validate\BaseValidate;
|
||
|
||
|
||
/**
|
||
* 投标结果验证器
|
||
* Class BidResultValidate
|
||
* @package app\adminapi\validate\bid
|
||
*/
|
||
class BidResultValidate extends BaseValidate
|
||
{
|
||
|
||
/**
|
||
* 设置校验规则
|
||
* @var string[]
|
||
*/
|
||
protected $rule = [
|
||
'id' => 'require',
|
||
'bid_document_examination_id'=> 'require|checkBidDocumentExamination',
|
||
'is_successful' => 'require|in:0,1',
|
||
'bidder_company' => 'require',
|
||
'bidder_amount' => 'require|float|egt:0',
|
||
'annex' => 'checkAnnex'
|
||
];
|
||
|
||
protected $message = [
|
||
'id.require' => '缺少必要参数',
|
||
'bid_document_examination_id.require'=> '请选择投标编号',
|
||
'is_successful.require' => '请选择是否中标',
|
||
'is_successful.in' => '是否中标选项无效',
|
||
'bidder_company.require' => '请填写中标单位',
|
||
'bidder_amount.require' => '请填写中标金额',
|
||
'bidder_amount.float' => '中标金额值必须是数字',
|
||
'bidder_amount.egt' => '中标金额值必须大于等于0',
|
||
];
|
||
|
||
|
||
/**
|
||
* @notes 添加场景
|
||
* @return BidResultValidate
|
||
* @author likeadmin
|
||
* @date 2023/12/02 14:54
|
||
*/
|
||
public function sceneAdd()
|
||
{
|
||
return $this->remove('id', true);
|
||
}
|
||
|
||
|
||
/**
|
||
* @notes 编辑场景
|
||
* @return BidResultValidate
|
||
* @author likeadmin
|
||
* @date 2023/12/02 14:54
|
||
*/
|
||
public function sceneEdit()
|
||
{}
|
||
|
||
|
||
/**
|
||
* @notes 删除场景
|
||
* @return BidResultValidate
|
||
* @author likeadmin
|
||
* @date 2023/12/02 14:54
|
||
*/
|
||
public function sceneDelete()
|
||
{
|
||
return $this->only(['id']);
|
||
}
|
||
|
||
|
||
/**
|
||
* @notes 详情场景
|
||
* @return BidResultValidate
|
||
* @author likeadmin
|
||
* @date 2023/12/02 14:54
|
||
*/
|
||
public function sceneDetail()
|
||
{
|
||
return $this->only(['id']);
|
||
}
|
||
|
||
public function checkBidDocumentExamination($value): bool|string
|
||
{
|
||
$data = BidDocumentExamination::where('id',$value)->findOrEmpty();
|
||
if($data->isEmpty()){
|
||
return '投标信息不存在';
|
||
}
|
||
return true;
|
||
}
|
||
|
||
public function checkAnnex($value): bool|string
|
||
{
|
||
if(!empty($value) && $value != ''){
|
||
if(!is_array($value)){
|
||
return '附件格式错误';
|
||
}
|
||
}
|
||
return true;
|
||
}
|
||
|
||
} |