| 1234567891011121314151617181920212223242526272829303132333435 |
- let v = wx.getAccountInfoSync()
- let appVersion = wx.getStorageSync('appVersion')
- let {
- envVersion
- } = v.miniProgram
- if (appVersion != envVersion) {
- wx.clearStorage({
- success: (res) => {
- wx.setStorageSync('appVersion', envVersion)
- },
- })
- }
- let apiUrl = `${envVersion == 'release'?'https://interface.huihenduo.com.cn/hhd-pat/':'https://interface.huihenduo.com.cn/hhd-pat-dev/'}`
- function api(url, data, method) {
- return new Promise((resolve, reject) => {
- wx.request({
- url: `${apiUrl}/${url}`,
- method,
- data,
- dataType: 'json',
- header: {
- 'content-type': 'application/json'
- },
- success: resolve,
- fail: reject
- })
- })
- }
- module.exports = {
- apiUrl,
- api
- }
|