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\financial;
|
||
|
||
|
||
use app\common\model\financial\FinancialCollectionPlan;
|
||
use app\common\model\marketing\MarketingContract;
|
||
use app\common\validate\BaseValidate;
|
||
|
||
|
||
/**
|
||
* 财务管理--合同收款计划验证器
|
||
* Class FinancialCollectionPlanValidate
|
||
* @package app\adminapi\validate\financial
|
||
*/
|
||
class FinancialCollectionPlanValidate extends BaseValidate
|
||
{
|
||
|
||
/**
|
||
* 设置校验规则
|
||
* @var string[]
|
||
*/
|
||
protected $rule = [
|
||
'id' => 'require|checkData',
|
||
'contract_id' => 'require|checkContract',
|
||
'collection_amount' => 'require|float|egt:0',
|
||
'collection_date' => 'require|dateFormat:Y-m-d',
|
||
'collection_user' => 'require',
|
||
'annex' => 'checkAnnex',
|
||
];
|
||
|
||
|
||
/**
|
||
* 参数描述
|
||
* @var string[]
|
||
*/
|
||
protected $field = [
|
||
'id' => 'id',
|
||
'contract_id' => '合同id',
|
||
'collection_amount' => '计划收款金额',
|
||
'collection_date' => '计划日期',
|
||
'collection_user' => '计划人',
|
||
'remark' => '备注',
|
||
|
||
];
|
||
|
||
|
||
/**
|
||
* @notes 添加场景
|
||
* @return FinancialCollectionPlanValidate
|
||
* @author likeadmin
|
||
* @date 2024/04/13 13:46
|
||
*/
|
||
public function sceneAdd()
|
||
{
|
||
return $this->only(['contract_id', 'collection_amount', 'collection_date', 'collection_user', 'remark', 'annex']);
|
||
}
|
||
|
||
|
||
/**
|
||
* @notes 编辑场景
|
||
* @return FinancialCollectionPlanValidate
|
||
* @author likeadmin
|
||
* @date 2024/04/13 13:46
|
||
*/
|
||
public function sceneEdit()
|
||
{
|
||
return $this->only(['id', 'contract_id', 'collection_amount', 'collection_date', 'collection_user', 'remark', 'annex']);
|
||
}
|
||
|
||
|
||
/**
|
||
* @notes 删除场景
|
||
* @return FinancialCollectionPlanValidate
|
||
* @author likeadmin
|
||
* @date 2024/04/13 13:46
|
||
*/
|
||
public function sceneDelete()
|
||
{
|
||
return $this->only(['id'])->remove('id', 'checkData');
|
||
}
|
||
|
||
|
||
/**
|
||
* @notes 详情场景
|
||
* @return FinancialCollectionPlanValidate
|
||
* @author likeadmin
|
||
* @date 2024/04/13 13:46
|
||
*/
|
||
public function sceneDetail()
|
||
{
|
||
return $this->only(['id']);
|
||
}
|
||
|
||
public function checkData($value): bool|string
|
||
{
|
||
$data = FinancialCollectionPlan::where('id', $value)->findOrEmpty();
|
||
return $data->isEmpty() ? '数据不存在' : true;
|
||
}
|
||
|
||
public function checkContract($value): bool|string
|
||
{
|
||
$data = MarketingContract::where('id', $value)->findOrEmpty();
|
||
return $data->isEmpty() ? '合同数据不存在' : true;
|
||
}
|
||
|
||
} |