| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091 |
- <?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\AssetArea;
- /**
- * 资产地址管理验证
- * Class ArticleValidate
- * @package app\adminapi\validate\article
- */
- class AssetAreaValidate extends BaseValidate
- {
- protected $rule = [
- 'id' => 'require|checkAssetInfo',
- 'title' => 'require|length:1,50',
- ];
- protected $message = [
- 'id.require' => '资产地址id必传',
- 'title.require' => '地址名称不能为空',
- 'title.length' => '地址名称长度须在1-55位字符',
- ];
- /**
- * @notes 添加场景
- * @return ArticleValidate
- * @author heshihu
- * @date 2022/2/22 9:57
- */
- public function sceneAdd()
- {
- return $this->remove(['id'])
- ->remove('id','require|checkAssetInfo');
- }
- /**
- * @notes 详情场景
- * @return ArticleValidate
- * @author heshihu
- * @date 2022/2/22 10:15
- */
- public function sceneDetail()
- {
- return $this->only(['id']);
- }
- public function sceneEdit()
- {
- }
- /**
- * @notes 删除场景
- * @return ArticleValidate
- * @author heshihu
- * @date 2022/2/22 10:17
- */
- public function sceneDelete()
- {
- return $this->only(['id']);
- }
- /**
- * @notes 检查指定地址是否存在
- * @param $value
- * @return bool|string
- * @author heshihu
- * @date 2022/2/22 10:11
- */
- public function checkAssetInfo($value)
- {
- $article = AssetArea::findOrEmpty($value);
- if ($article->isEmpty()) {
- return '地址不存在';
- }
- return true;
- }
- }
|