post(); if (empty($post["platform"])) { return $this->success(dataReturn(-1, '请发送APP所属平台')); } $version = Version::where('platform', $post["platform"])->orderBy('versionnum', 'desc')->first()->toArray(); $ext = pathinfo($version["download_url"], PATHINFO_EXTENSION); if ($ext == "wgt") { $version["pkgurl"] = ""; $version["wgturl"] = $version["download_url"]; } else { if ($post["platform"] == 'android') { $version["pkgurl"] = $version["download_url"]; } if ($post["platform"] == 'ios') { $version["pkgurl"] = $version["jump_url"]; } $version["wgturl"] = ""; } if ($version) { return $this->success(dataReturn(0, '成功', [ 'version' => $version, ])); } else { return $this->success(dataReturn(-1, '失败')); } } //版本下载数量加1 public function versioncount(Request $request) { $post = request()->post(); if (empty($post["platform"])) { return $this->success(dataReturn(-1, '请发送APP所属平台')); } if (empty($post["versionnum"])) { return $this->success(dataReturn(-1, '请输版本信息')); } $version = Version::where('platform', $post["platform"])->where('versionnum', $post["versionnum"])->increment('downloadnum'); if ($version) { return $this->success(dataReturn(0, '成功')); } else { return $this->success(dataReturn(-1, '失败')); } } }