支付宝兼容

This commit is contained in:
2026-03-09 09:07:58 +08:00
parent 069677957e
commit b3836b8bf2
31 changed files with 2382 additions and 307 deletions
+9 -2
View File
@@ -1,8 +1,15 @@
import {
URL,
appid
appid,
ZFBappid
} from './url'
// 根据运行平台选择正确的小程序 appid(后端通常依赖该 header 做平台识别)
let platformAppid = appid
// #ifdef MP-ALIPAY
platformAppid = ZFBappid
// #endif
// 获取多语言翻译文本
const getLoadingText = () => {
try {
@@ -31,7 +38,7 @@ const request = (option) => {
header: {
"Content-Type": option.headers && option.headers["Content-Type"] ? option.headers["Content-Type"] : (option.method && option.method.toUpperCase() === 'POST' ? 'application/json' : 'application/x-www-form-urlencoded'),
...option.headers,
'appid': appid,
'appid': platformAppid,
'Authorization': "Bearer " + uni.getStorageSync('token'),
'Clientid': uni.getStorageSync('client_id'),
'Content-Language': (uni.getStorageSync('language') || 'zh-CN').replace(/-/g, '_')