加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
install.patch.js 2.24 KB
一键复制 编辑 原始数据 按行查看 历史
goodook 提交于 2021-12-05 02:23 . 1.1.18
const VERSION = "07504484b50";;
const {Request} = './request.js'
var utils = require('./install.utils.js');
const APP_NAME = 'robot-center-script';
const version_manager_url = "http://rpa.shen-x.com/app-store/patch.php?";
const version_manager_install = "http://rpa.shen-x.com/app-store/install.php?";
function reinstall(callback) {
//checkDiff(version).then((res) => {
checkInstall().then((res) => {
if (res.err != undefined) {
console.log(res.err);
callback('ignore');
return;
}
utils.installZipUrl(res.download, (status) => {
if (status == 'ok') {
uni.setStorageSync('version', res.version);
// alert(status);
plus.nativeUI.alert("升级完成,重启!", function() {
plus.runtime.restart();
});
} else {
uni.showToast({
title: '完成,无更新',
icon: 'none',
duration: 3000
});
}
callback(status);
});
});
}
function upgrade(callback) {
var version = uni.getStorageSync('version');
//if (!version) version = VERSION;
//checkDiff(version).then((res) => {
checkfull().then((res) => {
if (res.err != undefined) {
console.log(res.err);
callback('ignore');
} else {
utils.installZipUrl(res.diffFile, (status) => {
if (status == 'ok') {
uni.setStorageSync('version', res.hostVer);
// alert(status);
plus.nativeUI.alert("升级完成,重启!", function() {
plus.runtime.restart();
});
} else {
//err
}
callback(status);
});
}
});
}
function checkInstall() {
var url = version_manager_install + "app=" + APP_NAME;
console.log(url);
return Request("", url, "GET");
};
function checkfull() {
var url = version_manager_url +
"clientVer=000&action=fullpackage&app=" + APP_NAME;
console.log(url);
return Request("", url, "GET");
};
function checkDiff(version) {
var url = version_manager_url +
"clientVer=" + version + "&action=diffpackage&app=" + APP_NAME;
console.log(url);
return Request("", url, "GET");
};
function remoteVersion() {
var url = version_manager_url +
"clientVer=000&action=appversion&app=" + APP_NAME;
console.log(url);
return Request("", url, "GET");
};
module.exports = {
upgrade,
remoteVersion
}
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化