支付宝兼容
This commit is contained in:
+9
-2
@@ -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, '_')
|
||||
|
||||
Reference in New Issue
Block a user