const { warn } = require("./utils/util") const { logWeapp } = require("./utils/htyWeappLog.js") //app.js const updateCheck = () => { const updateManager = wx.getUpdateManager() if (!updateManager) { return; } updateManager.onCheckForUpdate(function (res) { // console.log(res.hasUpdate) }) updateManager.onUpdateReady(function () { wx.showModal({ title: '更新提示', content: '新版本已经准备好,是否重启小程序以更新?', success: function (res) { if (res.confirm) { // 新的版本已经下载好,调用 applyUpdate 应用新版本并重启 updateManager.applyUpdate() } } }) }) updateManager.onUpdateFailed(function () { wx.showModal({ title: '更新提示', content: '新版本下载失败', showCancel: false }) }) } const Configs = { moicen: { server: "https://music-room.moicen.com", api: "https://admin.moicen.com", domain: "music-room.moicen.com", appid: "wx612c8fc526341c0d", }, huiwing: { server: "https://music-room.huiwings.cn", api: "https://admin.huiwings.cn", domain: "music-room.huiwings.cn", appid: "wx3b02c886bb554012", }, local: { server: "http://192.168.1.11:8000", api: "http://192.168.1.11:8088", domain: "music-room.localhost", appid: "wx3b02c886bb554012", } } App({ onLaunch(options) { updateCheck(); this.globalData.timestamp = new Date().valueOf(); this.globalData.scene = options.scene; logWeapp('onLaunch', { scene: options.scene, path: options.path || '', queryKeys: options.query ? Object.keys(options.query).join(',') : '' }) }, onError(msg) { warn('error...' + msg) console.log('error...' + msg) }, globalData: { ...Configs.moicen, cdn: "https://upyun.moicen.com/music-room", upyun: { operator: "moicen", host: "https://upyun.moicen.com", bucket: 'huiwing' }, user: null, timestamp: 0, scene: 1000 } })