同步操作将从 松阳/世树wtrees-applet小程序模板,云开发,国风化,快速部署 强制同步,此操作会覆盖自 Fork 仓库以来所做的任何修改,且无法恢复!!!
确定后同步将在后台操作,完成时将刷新页面,请耐心等待。
//app.jsvar util = require('/utils/time.js');App({onLaunch: function () {if (wx.cloud) {wx.cloud.init({env: "treeworld-2g5yvz9s899bf4a6",})}wx.getSystemInfo({success: e => {this.globalData.StatusBar = e.statusBarHeight;let capsule = wx.getMenuButtonBoundingClientRect();if (capsule) {this.globalData.Custom = capsule;this.globalData.CustomBar = capsule.bottom + capsule.top - e.statusBarHeight;} else {this.globalData.CustomBar = e.statusBarHeight + 50;}}})this.userInfo()},access_token: null,logout: function () {wx.removeStorageSync('access_token');this.access_token = null;},loginFirst: function () {var that = this;wx.hideLoading();wx.showModal({title: '请先绑定',content: '你需要绑定仓库才能操作',showCancel: true,confirmText: "确定",cancelText: "取消",success(res) {}});},getUserInfo: function (callback) {var that = this;if (that.access_token) {wx.request({url: that.config.apiUrl + "api/v5/user",method: "GET",data: {access_token: that.access_token,},success: function (result) {if (result.data.hasOwnProperty('id')) {that.userInfo = result.data;callback(true);} else {callback(false);}}});} else {that.access_token = wx.getStorageSync("access_token");if (that.access_token) {that.getUserInfo(callback);} else {callback(false);}}},userInfo: function () {const db = wx.cloud.database({env: "treeworld-2g5yvz9s899bf4a6"})db.collection('user').get({success: function (res) {if (res.data.length > 0) {console.log(res.data)wx.setStorageSync('userid', res.data[0]._id)wx.setStorageSync('openid', res.data[0]._openid)db.collection('user').doc("" + res.data[0]._id).update({data: {endtime: util.getCurrentTime()}})wx.setStorageSync('access_token', res.data[0].gitee_token);// wx.setStorageSync('access_token', res.data[0].gitee_token);} else {db.collection('user').add({data: {addtime: util.getCurrentTime()},success: function (res) {wx.setStorageSync('userid', res._id)}})}}})},config: {apiUrl: "https://gitee.com/", //通用API地址},loadFont() {wx.loadFontFace({family: 'Roboto',// source: 'url(https://static.hamm.cn/font/Roboto.ttf)',source: 'url(https://static.hamm.cn/font/Gotham-Book.woff2)',});},globalData: {key: '31c76e2a2d784c129e5518817054b111',type: 0,requestUrl: {weather: 'https://free-api.heweather.com/s6/weather',},},})
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。