123456789101112131415161718192021222324252627282930 |
- <?php
- namespace app\common\validate;
- use think\Validate;
- use think\Db;
- class AppIos extends Validate{
- protected $rule = [
- 'ver|版本号' => 'require|length:1,30|checkVer',
- 'content|更新内容' => 'require|length:1,200',
- ];
- protected function checkVer($value,$rules,$data){
- if($data['id'] > 0){
- $ret = Db::name('app_ios')->where('id','<>',$data['id'])->where('ver',$data['ver'])->where('del',0)->find();
- if($ret){
- return '版本已存在';
- }
- }else{
- $ret = Db::name('app_ios')->where('ver',$data['ver'])->where('del',0)->find();
- if($ret){
- return '版本已存在';
- }
- }
- return true;
- }
- }
|