每次 callBase 时传入 _clientInfo 参数

This commit is contained in:
陆柯 2023-10-08 16:20:22 +08:00
parent baaeb0a485
commit 8f4575c87b

View File

@ -168,6 +168,9 @@ export default {
const thisRoute = getCurrentPages()?.pop?.()?.route || 'VueApp' // 立刻保存 route因为在调用后台后可能已切换到了其他页面。 const thisRoute = getCurrentPages()?.pop?.()?.route || 'VueApp' // 立刻保存 route因为在调用后台后可能已切换到了其他页面。
const startTime = new Date().toJSON() const startTime = new Date().toJSON()
let url = undefined let url = undefined
let { uniPlatform, deviceType, osName } = uni.getSystemInfoSync()
apiWhat._clientInfo = { uniPlatform, deviceType, osName }
apiWhat._passtoken = uni.getStorageSync('_passtoken')
let result = {} let result = {}
if (baseType === 'UNICLOUD_OBJECT') { if (baseType === 'UNICLOUD_OBJECT') {
const uniObj = uniCloud.importObject(apiWho) const uniObj = uniCloud.importObject(apiWho)
@ -183,7 +186,6 @@ export default {
data: { data: {
apiTodo, apiTodo,
apiWhat, apiWhat,
_passtoken: uni.getStorageSync('_passtoken'),
// uniIdToken // uniCloud自动getStorageSync('uni_id_token')并传递为 uniIdToken也可自行组装传入 uniIdToken // uniIdToken // uniCloud自动getStorageSync('uni_id_token')并传递为 uniIdToken也可自行组装传入 uniIdToken
}, },
}) })
@ -208,8 +210,8 @@ export default {
url = this.make_server_url(`${apiVersion}/${apiWho}/${apiTodo}`) url = this.make_server_url(`${apiVersion}/${apiWho}/${apiTodo}`)
let [error, { statusCode, header, errMsg, data: resultServer = {} } = {}] = await uni.request({ let [error, { statusCode, header, errMsg, data: resultServer = {} } = {}] = await uni.request({
method: httpMethod, method: httpMethod,
url: url, url,
data: { ...apiWhat, _passtoken: uni.getStorageSync('_passtoken') }, data: apiWhat,
timeout, timeout,
}) })
if (error) { if (error) {