提交 efa4b106 编写于 作者: D DCloud_LXH

fix: is_silently Can be null

上级 41dd2a57
......@@ -18,7 +18,7 @@ export type UniUpgradeCenterResult = {
uni_platform : string // "android" | "ios" // 版本号 1.0.0
stable_publish : boolean // 是否是稳定版
is_mandatory : boolean // 是否强制更新
is_silently : boolean // 是否静默更新
is_silently : boolean | null // 是否静默更新
create_env : string // "upgrade-center"
create_date : number
message : string
......@@ -33,8 +33,8 @@ export default function () : Promise<UniUpgradeCenterResult> {
// #ifdef APP
return new Promise<UniUpgradeCenterResult>((resolve, reject) => {
const systemInfo = uni.getSystemInfoSync()
const appId = systemInfo.appId
const appVersion = systemInfo.appVersion //systemInfo.appVersion
const appId = '__UNI__3584C99'
const appVersion = '1.0.17' //systemInfo.appVersion
// #ifndef UNI-APP-X
if (typeof appId === 'string' && typeof appVersion === 'string' && appId.length > 0 && appVersion.length > 0) {
plus.runtime.getProperty(appId, function (widgetInfo) {
......@@ -77,6 +77,7 @@ export default function () : Promise<UniUpgradeCenterResult> {
name: 'uni-upgrade-center',
data: data
}).then(res => {
console.log('res: ',res);
const code = res.result['code']
const codeIsNumber = ['Int', 'Long', 'number'].includes(typeof code)
if (codeIsNumber) {
......@@ -85,7 +86,7 @@ export default function () : Promise<UniUpgradeCenterResult> {
code: res.result['code'],
message: res.result['message']
})
} else if (code < 0) {
} else if ((code as number) < 0) {
reject({
code: res.result['code'],
message: res.result['message']
......@@ -96,6 +97,7 @@ export default function () : Promise<UniUpgradeCenterResult> {
}
}
}).catch<void>((err : any | null) => {
console.log('err: ',err);
const error = err as UniCloudError
if (error.errMsg == '未匹配到云函数[uni-upgrade-center]')
error.errMsg = '【uni-upgrade-center-app】未配置uni-upgrade-center,无法升级。参考: https://uniapp.dcloud.net.cn/uniCloud/upgrade-center.html'
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册