版本号比对

This commit is contained in:
2025-12-15 10:06:20 +08:00
parent ca48f2682c
commit 4ca0bbd84d
7 changed files with 24 additions and 17 deletions

View File

@@ -98,27 +98,34 @@ class Version extends adminApi
* 修改
*/
public function version_edit(){
$version = input('version', '');
$type = input('type', '');
$downloadurl = input('downloadurl', '');
$content = $_POST['content'] ?? '';
$enforce = input('enforce', '');
$version_code = input('version_code', '');
$status = input('status', 1);
$version = input('version', '');//新版本好
$type = input('type', '');//1-安卓 2-IOS
$downloadurl = input('downloadurl', '');//下载地址
$content = $_POST['content'] ?? '';//更新内容
$enforce = input('enforce', '');//强制更新 1-是 0-否
$version_code = input('version_code', '');//版本号(目前安卓使用,用来判定是否升级)
$status = input('status', 1);//0-待发布1-已发布2-禁用
$id = input('id', '');
$versions = db::name($this->table)->where(['newversion'=>$version,'id'=>['neq',$id]])->find();
if($versions){
$now_version = db::name($this->table)->where(['id'=>$id])->find();
if(!$now_version){
return V(0,"数据不存在");
}
$res = version_compare($now_version['newversion'], $version);
if($res == 0){
return V(0,"版本号已存在");
}
$data = [
'newversion' => $version,
'oldversion' => $now_version['newversion'],
'type' => $type,
'downloadurl' => $downloadurl,
'content' => $content,
'enforce' => $enforce,
'code' => $version_code,
'status' => $status,
'createtime' => time()
'updatetime' => time()
];
$res = db::name($this->table)->where(['id'=>$id])->update($data);
if($res){