0
0

AppMgr.php 873 B

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