engineering/app/adminapi/validate/marketing/MarketingBranchFilingValidate.php
2024-04-05 11:35:05 +08:00

143 lines
3.7 KiB
PHP
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<?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\marketing;
use app\common\model\dict\DictData;
use app\common\model\marketing\MarketingBranchFiling;
use app\common\validate\BaseValidate;
/**
* 市场经营--分支机构备案验证器
* Class MarketingBranchFilingValidate
* @package app\adminapi\validate\marketing
*/
class MarketingBranchFilingValidate extends BaseValidate
{
/**
* 设置校验规则
* @var string[]
*/
protected $rule = [
'id' => 'require|checkData',
'org_name' => 'require',
'filing_type' => 'require|checkFilingType',
'jgzcdz' => 'require',
'baksq' => 'require|dateFormat:Y-m-d',
'bajsq' => 'require|dateFormat:Y-m-d',
'basj' => 'dateFormat:Y-m-d',
'njsj' => 'dateFormat:Y-m-d',
'annex' => 'checkAnnex',
];
/**
* 参数描述
* @var string[]
*/
protected $field = [
'id' => 'id',
'org_name' => '机构名称',
'filing_type' => '备案类型',
'fddbr' => '法定代表人',
'telephone' => '联系电话',
'yyzzbh' => '营业执照编号',
'zzzsbh' => '资质证书编号',
'zzjgdmz' => '组织机构代码证',
'zgslxdh' => '总公司联系电话',
'zyxjlfw' => '主项监理范围',
'zjxjlfw' => '增项监理范围',
'bdbgdz' => '本地办公地址',
'bdgslxdh' => '本地公司联系电话',
'ryxx' => '人员信息',
'jgzcdz' => '机构注册地址',
'baksq' => '备案开始期',
'bajsq' => '备案结束期',
'basj' => '备案时间',
'jbr' => '经办人',
'njsj' => '年检时间',
'fzr' => '负责人',
'fzrsj' => '负责人手机',
'jsfzr' => '技术负责人',
'jsfzrsj' => '技术负责人手机',
'remark' => '备注',
'annex' => 'annex',
];
/**
* @notes 添加场景
* @return MarketingBranchFilingValidate
* @author likeadmin
* @date 2024/04/05 10:00
*/
public function sceneAdd()
{
return $this->remove('id', true);
}
/**
* @notes 编辑场景
* @return MarketingBranchFilingValidate
* @author likeadmin
* @date 2024/04/05 10:00
*/
public function sceneEdit()
{
}
/**
* @notes 删除场景
* @return MarketingBranchFilingValidate
* @author likeadmin
* @date 2024/04/05 10:00
*/
public function sceneDelete()
{
return $this->only(['id'])->remove('id', 'checkData');
}
/**
* @notes 详情场景
* @return MarketingBranchFilingValidate
* @author likeadmin
* @date 2024/04/05 10:00
*/
public function sceneDetail()
{
return $this->only(['id']);
}
public function checkData($value): bool|string
{
$data = MarketingBranchFiling::where('id', $value)->findOrEmpty();
return $data->isEmpty() ? '数据不存在' : true;
}
public function checkFilingType($value): bool|string
{
$dict = DictData::where('type_value', 'filing_type')->column('value');
if (!in_array($value, $dict)) {
return '备案类型数据值无效';
}
return true;
}
}