Initial commit

This commit is contained in:
admin
2025-12-09 02:45:30 +08:00
commit 0bbb3d0a47
303 changed files with 22764 additions and 0 deletions

View File

@@ -0,0 +1,25 @@
const app = getApp()
function unwrap(data) {
if (data && typeof data === 'object' && 'code' in data && 'data' in data) {
return data.data
}
return data
}
function request({ url, method = 'GET', data = {}, header = {} }) {
return new Promise((resolve, reject) => {
wx.request({
url: `${app.globalData.baseUrl}${url.startsWith('/') ? '' : '/'}${url}`,
method,
data,
header,
success: (res) => {
resolve(unwrap(res.data))
},
fail: (err) => reject(err)
})
})
}
module.exports = { request }