0
0

AppIos.php 765 B

123456789101112131415161718192021222324252627282930
  1. <?php
  2. namespace app\common\validate;
  3. use think\Validate;
  4. use think\Db;
  5. class AppIos extends Validate{
  6. protected $rule = [
  7. 'ver|版本号' => 'require|length:1,30|checkVer',
  8. 'content|更新内容' => 'require|length:1,200',
  9. ];
  10. protected function checkVer($value,$rules,$data){
  11. if($data['id'] > 0){
  12. $ret = Db::name('app_ios')->where('id','<>',$data['id'])->where('ver',$data['ver'])->where('del',0)->find();
  13. if($ret){
  14. return '版本已存在';
  15. }
  16. }else{
  17. $ret = Db::name('app_ios')->where('ver',$data['ver'])->where('del',0)->find();
  18. if($ret){
  19. return '版本已存在';
  20. }
  21. }
  22. return true;
  23. }
  24. }