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