From 0ae9ae37fd2eb1cda6732a5094be052d500818b6 Mon Sep 17 00:00:00 2001 From: tsf <460834639@qq.com> Date: Tue, 24 Sep 2024 18:40:30 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B5=8B=E8=AF=95=E7=8E=AF=E5=A2=83=E5=86=85?= =?UTF-8?q?=E5=AE=B9=E4=B8=8A=E4=BC=A0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- application/admin/controller/Appversion.php | 88 ++- application/admin/view/appversion/index.html | 95 +-- application/app/controller/Base.php | 80 +- application/app/controller/Card.php | 4 +- application/app/controller/Cardparts.php | 130 +-- application/app/controller/Index.php | 2 +- application/app/controller/Login.php | 8 +- application/app/controller/Vitalcapacity.php | 67 +- application/route.php | 76 +- application/testapp/controller/Base.php | 470 +++++++++++ .../testapp/controller/Calculatebody.php | 643 +++++++++++++++ application/testapp/controller/Card.php | 728 +++++++++++++++++ application/testapp/controller/Cardparts.php | 462 +++++++++++ application/testapp/controller/Cardpublic.php | 643 +++++++++++++++ application/testapp/controller/Device.php | 271 +++++++ application/testapp/controller/Download.php | 50 ++ application/testapp/controller/Index.php | 640 +++++++++++++++ application/testapp/controller/Login.php | 483 ++++++++++++ .../testapp/controller/Myinformation.php | 154 ++++ .../testapp/controller/Pagingcontrast.php | 602 ++++++++++++++ application/testapp/controller/Skip.php | 364 +++++++++ .../testapp/controller/Sportstesting.php | 737 ++++++++++++++++++ .../testapp/controller/Vitalcapacity.php | 403 ++++++++++ application/testapp/view/download/demo.html | 171 ++++ application/testapp/view/download/demo2.html | 171 ++++ public/appupdatefile/新建 XLS 工作表.xls | Bin 18432 -> 0 bytes public/estimate/20240708082036_ceshi.xlsx | Bin 59253 -> 0 bytes 27 files changed, 7375 insertions(+), 167 deletions(-) create mode 100644 application/testapp/controller/Base.php create mode 100644 application/testapp/controller/Calculatebody.php create mode 100644 application/testapp/controller/Card.php create mode 100644 application/testapp/controller/Cardparts.php create mode 100644 application/testapp/controller/Cardpublic.php create mode 100644 application/testapp/controller/Device.php create mode 100644 application/testapp/controller/Download.php create mode 100644 application/testapp/controller/Index.php create mode 100644 application/testapp/controller/Login.php create mode 100644 application/testapp/controller/Myinformation.php create mode 100644 application/testapp/controller/Pagingcontrast.php create mode 100644 application/testapp/controller/Skip.php create mode 100644 application/testapp/controller/Sportstesting.php create mode 100644 application/testapp/controller/Vitalcapacity.php create mode 100644 application/testapp/view/download/demo.html create mode 100644 application/testapp/view/download/demo2.html delete mode 100644 public/appupdatefile/新建 XLS 工作表.xls delete mode 100644 public/estimate/20240708082036_ceshi.xlsx diff --git a/application/admin/controller/Appversion.php b/application/admin/controller/Appversion.php index 65bd6f6..adbf5c6 100644 --- a/application/admin/controller/Appversion.php +++ b/application/admin/controller/Appversion.php @@ -42,9 +42,9 @@ class Appversion extends Base{ $num = Db::table('app_version_log')->where($parameter)->count(); $result = Db::table('app_version_log')->where($parameter)->order('is_del,id desc')->page($page,$this->page_num)->select(); if(!$pd){ - $result['num'] = $num; - $result['data'] = $result; - return $this->msg(0,'success',$result); + $return_data['num'] = $num; + $return_data['data'] = $result; + return $this->msg($return_data); } $this->assign([ 'result' => $result, @@ -58,6 +58,17 @@ class Appversion extends Base{ return $this->fetch(); } + public function app_edit(){ + $data = input(); + $result = Db::table('app_version_log')->where(['id'=>$data['id']])->find(); + $this->assign([ + 'result' => $result, + ]); + return $this->fetch(); + } + + + public function app_add_action(){ $file = request()->file('apk'); $name = request()->param(); @@ -68,6 +79,22 @@ class Appversion extends Base{ } if($file){ // 移动到框架应用根目录/public/uploads/ 目录下 + + // 设置文件路径 + $filePath = ROOT_PATH . 'public' . DS . 'appupdatefile' . DS . $name['file_name'].'_'.$name['version_num'].'.apk'; + // 检查文件是否存在 + if (file_exists($filePath)) { + // 尝试删除文件 + if (unlink($filePath)) { + // 删除成功 + // echo "文件删除成功。"; + } else { + // 删除失败 + // echo "文件删除失败,请检查权限设置。"; + return $this->msg(10001,'更新文件失败'); + } + } + $file_name_new = $name['file_name'].'_'.$name['version_num'].'.apk'; $info = $file->validate(['size'=>$this->file_max,'ext'=>'apk'])->move(ROOT_PATH . 'public' . DS . 'appupdatefile',$file_name_new); if($info){ @@ -102,6 +129,61 @@ class Appversion extends Base{ } + + public function app_edit_action(){ + $file = request()->file('apk'); + $name = request()->param(); + + if($file){ + // 移动到框架应用根目录/public/uploads/ 目录下 + $app_yz = Db::table('app_version_log')->where(['id'=>$name['id']])->find(); + if($app_yz){ + $file_name_new = $name['file_name'].'_'.$name['version_num'].'.apk'; + if($app_yz['name'] == $name['file_name'] && $app_yz['version_num'] == $name['version_num'] && $app_yz['version_num_original'] == $name['version_num_original'] && $app_yz['content'] == $name['content']){ + $update_data = [ + 'update_time'=>date('Y-m-d H:i:s'), + ]; + }else{ + $update_data = [ + 'name'=>$name['file_name'], + 'version_num'=>$name['version_num'], + 'version_num_original'=>$name['version_num_original'], + 'content'=>$name['content'], + 'download_url'=>'http://tc.pcxbc.com/appupdatefile/'.$file_name_new, + 'update_time'=>date('Y-m-d H:i:s'), + ]; + } + // 如果修改信息不变,直接更新文件即可 + // 设置文件路径 + $filePath = ROOT_PATH . 'public' . DS . 'appupdatefile' . DS . $name['file_name'].'_'.$name['version_num'].'.apk'; + // 检查文件是否存在 + if (file_exists($filePath)) { + // 尝试删除文件 + if (unlink($filePath)) { + // 删除成功 + } else { + return $this->msg(10001,'删除原始文件失败'); + } + } + $info = $file->validate(['size'=>$this->file_max,'ext'=>'apk'])->move(ROOT_PATH . 'public' . DS . 'appupdatefile',$file_name_new); + if($info){ + $result = Db::table('app_version_log')->where(['id'=>$name['id']])->update($update_data); + if($result){ + return $this->msg([]); + }else{ + return $this->msg(10002); + } + }else{ + return $this->msg(10001, $file->getError()); + } + }else{ + return $this->msg(10001,'未找到需要更新的数据'); + } + }else{ + return $this->msg(10001, '文件缺失'); + } + } + public function app_del(){ $data = input(); if(is_array($data['id'])){ diff --git a/application/admin/view/appversion/index.html b/application/admin/view/appversion/index.html index 6b30950..d86290e 100644 --- a/application/admin/view/appversion/index.html +++ b/application/admin/view/appversion/index.html @@ -31,35 +31,8 @@