diff --git a/application/admin/controller/Index.php b/application/admin/controller/Index.php index e324087..a60f954 100644 --- a/application/admin/controller/Index.php +++ b/application/admin/controller/Index.php @@ -68,7 +68,7 @@ public function getMain(){ }else{ $gd = 'GD库未开启!'; } - + return json($this->getReturn(1,"成功",array( "todayOrder"=>$todayOrder, "todaySuccessOrder"=>$todaySuccessOrder, @@ -83,7 +83,7 @@ public function getMain(){ "MySql"=>$v, "Thinkphp"=>"v".App::VERSION, "RunTime"=>$this->sys_uptime(), - "ver"=>"v1.10", + "ver"=>"v".config("ver"), "gd"=>$gd, ))); @@ -103,6 +103,19 @@ private function sys_uptime() { if ($min !== 0) $output .= $min."分钟"; return $output; } + public function checkUpdate(){ + if (!Session::has("admin")){ + return json($this->getReturn(-1,"没有登录")); + } + $ver = $this->getCurl("https://raw.githubusercontent.com/szvone/vmqphp/master/ver"); + $ver = explode("|",$ver); + + if (sizeof($ver)==2 && $ver[0]!=config("ver")){ + return json($this->getReturn(1,"[v".$ver[0]."已于".$ver[1]."发布]","https://github.com/szvone/vmqphp")); + }else{ + return json($this->getReturn(0,"程序是最新版")); + } + } public function getSettings(){ if (!Session::has("admin")){ @@ -368,7 +381,7 @@ function getCurl($url, $post = 0, $cookie = 0, $header = 0, $nobaody = 0) $klsf[] = 'Accept-Language:zh-cn'; //$klsf[] = 'Content-Type:application/json'; $klsf[] = 'User-Agent:Mozilla/5.0 (iPhone; CPU iPhone OS 11_2_1 like Mac OS X) AppleWebKit/604.4.7 (KHTML, like Gecko) Mobile/15C153 MicroMessenger/6.6.1 NetType/WIFI Language/zh_CN'; - $klsf[] = 'Referer:https://servicewechat.com/wx7c8d593b2c3a7703/5/page-frame.html'; + $klsf[] = 'Referer:'.$url; curl_setopt($ch, CURLOPT_HTTPHEADER, $klsf); if ($post) { curl_setopt($ch, CURLOPT_POST, 1); diff --git a/application/index/controller/Index.php b/application/index/controller/Index.php index f799757..16832eb 100644 --- a/application/index/controller/Index.php +++ b/application/index/controller/Index.php @@ -589,7 +589,7 @@ private function getCurl($url, $post = 0, $cookie = 0, $header = 0, $nobaody = 0 $klsf[] = 'Accept-Language:zh-cn'; //$klsf[] = 'Content-Type:application/json'; $klsf[] = 'User-Agent:Mozilla/5.0 (iPhone; CPU iPhone OS 11_2_1 like Mac OS X) AppleWebKit/604.4.7 (KHTML, like Gecko) Mobile/15C153 MicroMessenger/6.6.1 NetType/WIFI Language/zh_CN'; - $klsf[] = 'Referer:https://servicewechat.com/wx7c8d593b2c3a7703/5/page-frame.html'; + $klsf[] = 'Referer:'.$url; curl_setopt($ch, CURLOPT_HTTPHEADER, $klsf); if ($post) { curl_setopt($ch, CURLOPT_POST, 1); diff --git a/config/app.php b/config/app.php index 55bda2d..beed25e 100644 --- a/config/app.php +++ b/config/app.php @@ -142,5 +142,5 @@ 'show_error_msg' => false, // 异常处理handle类 留空使用 \think\exception\Handle 'exception_handle' => '', - + 'ver' => '1.10', ]; diff --git a/public/aaa.html b/public/aaa.html index fb51c2f..7ba8860 100644 --- a/public/aaa.html +++ b/public/aaa.html @@ -127,6 +127,22 @@ if (data == null || data == "" || data.code==-1) { window.location.href = "index.html"; } + setTimeout(function () { + $.post("admin/index/checkUpdate",function (data) { + if (data.code==1) { + + layer.confirm(data.msg, { + btn: ['去看看','算啦'], + title:"有更新啦" + }, function(){ + window.location.href = data.data; + }); + + } + }); + },2000); + + console.log(data); var out_menu = ""; for (var i = 0;i