| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145 |
- <?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\asset;
- use app\common\validate\BaseValidate;
- use app\common\model\asset\AssetInfo;
- use app\common\model\asset\AssetLeaseInfo;
- /**
- * 资产租赁管理验证
- * Class ArticleValidate
- * @package app\adminapi\validate\article
- */
- class AssetLeaseValidate extends BaseValidate
- {
- protected $rule = [
- 'id' => 'require|checkAssetInfo',
- 'a_id' => 'require|checkAssetDataInfo',
- 'tenant_name' => 'require|length:1,50',
- 'tenant_mobile' => 'require|length:1,13',
- 'lease_contract_image' => 'require',
- 'lease_money' => 'require',
- 'lease_start_time' => 'require',
- 'referee_name'=>'require',
- 'first_status' => 'in:1,2,3',
- 'second_status' => 'in:0,1,2,3',
- 'approval_status'=>'in:1,2,3,4,5,6',
- 'is_pay'=>'require|in:1,0',
- ];
- protected $message = [
- 'id.require' => '租赁资产订单信息id必传',
- 'tenant_name.require' => '租赁人姓名必传!',
- 'tenant_name.length' => '资产名称长度须在1-50位字符',
- 'tenant_mobile.require' => '租赁人联系方式必传!',
- 'tenant_mobile.length' => '租赁人联系方式长度须在1-13位字符',
- 'lease_contract_image.require' => '合同照片必传',
- 'lease_money.require' => '租赁金额必传',
- 'referee_name.require' => '提审人不能为空',
- 'approval_status.in' => '审批状态值错误',
- 'is_pay.require' => '缴费状态必传',
- ];
- /**
- * @notes 添加场景
- * @return ArticleValidate
- * @author heshihu
- * @date 2022/2/22 9:57
- */
- public function sceneAdd()
- {
- return $this->remove(['id','is_pay'])
- ->remove('id','require|checkAssetInfo')
- ->remove('is_pay','require');
- }
- /**
- * @notes 详情场景
- * @return ArticleValidate
- * @author heshihu
- * @date 2022/2/22 10:15
- */
- public function sceneDetail()
- {
- return $this->only(['id']);
- }
- /**
- * @notes 更改状态场景
- * @return ArticleValidate
- * @author heshihu
- * @date 2022/2/22 10:18
- */
- public function sceneStatus()
- {
- return $this->only(['id', 'status']);
- }
- /**
- * @notes 更改支付状态场景
- * @return ArticleValidate
- * @author heshihu
- * @date 2022/2/22 10:18
- */
- public function scenePay()
- {
- return $this->only(['id', 'is_pay']);
- }
- public function sceneEdit()
- {
- }
- /**
- * @notes 删除场景
- * @return ArticleValidate
- * @author heshihu
- * @date 2022/2/22 10:17
- */
- public function sceneDelete()
- {
- return $this->only(['id']);
- }
- public function sceneApprove(){
- return $this->only(['id', 'approval_status']);
- }
- public function sceneEnd(){
- return $this->only(['id']);
- }
- /**
- * @notes 检查指定资讯是否存在
- * @param $value
- * @return bool|string
- * @author heshihu
- * @date 2022/2/22 10:11
- */
- public function checkAssetInfo($value)
- {
- $article = AssetLeaseInfo::findOrEmpty($value);
- if ($article->isEmpty()) {
- return '租赁资产订单信息不存在';
- }
- return true;
- }
- public function checkAssetDataInfo($value){
- $article = AssetInfo::findOrEmpty($value);
- if ($article->isEmpty()) {
- return '资产不存在或已删除';
- }
- return true;
- }
- }
|