提交 efa4b106 编写于 作者: D DCloud_LXH

fix: is_silently Can be null

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