From b920b4a7e70ffdeb7308131cb3d6a10dff9e3451 Mon Sep 17 00:00:00 2001
From: 石广澎 <shiguangpeng@163.com>
Date: 星期三, 08 五月 2024 11:22:08 +0800
Subject: [PATCH] feat(支付): 请求头内放置客户端类型
---
common/http.interceptor.js | 20 ++++++++++++++++++++
common/config.js | 8 ++++----
main.js | 4 ++--
3 files changed, 26 insertions(+), 6 deletions(-)
diff --git a/common/config.js b/common/config.js
index fb786cc..7abfc07 100644
--- a/common/config.js
+++ b/common/config.js
@@ -11,10 +11,10 @@
}
// 鏀粯娴嬭瘯
const payTest = {
- webURL: 'https://jmy.jinmingyuan.com/payTest',
- baseURL: 'http://1.14.252.104:7101',
- sftpURL: 'https://echftp.jinmingyuan.com',
- imgUrl: 'https://echftp.jinmingyuan.com/platform/app/',
+ webURL: 'https://jmy.jinmingyuan.com/scanPay',
+ baseURL: 'http://u2cgg5.natappfree.cc',
+ sftpURL: 'https://yqzx.jinmingyuan.com/file',
+ imgUrl: 'https://yqzx.jinmingyuan.com/file/platform/app/',
wx_appid: 'wxad8cc511da676bd4',
ali_appid:'2021003199690698'
}
diff --git a/common/http.interceptor.js b/common/http.interceptor.js
index 5371580..f12595f 100644
--- a/common/http.interceptor.js
+++ b/common/http.interceptor.js
@@ -3,6 +3,25 @@
config,
DEBUG
} from '@/common/config.js';
+function appType() {
+ let appType = 0
+ // #ifdef MP-WEIXIN
+ appType = 3 // 寰俊灏忕▼搴�
+ // #endif
+ // #ifdef MP-ALIPAY
+ appType = 1 // 鏀粯瀹濆皬绋嬪簭
+ // #endif
+ // #ifdef H5
+ var ua = window.navigator.userAgent.toLowerCase();
+ if (ua.match(/MicroMessenger/i) == 'micromessenger') {
+ appType = 4; //鏄井淇″叕浼楀彿
+ }
+ if (ua.match(/AlipayClient/i) == 'alipayclient') {
+ appType = 2; //鏀粯瀹濈敓娲诲彿
+ }
+ // #endif
+ return appType
+}
module.exports = (vm) => {
uni.$u.http.setConfig((x) => {
return x = {
@@ -28,6 +47,7 @@
} else {
delete x.header[ACCESSTOKEN]
}
+ x.header['CLIENT-TYPE'] = appType()
return x;
}, x => {
return Promise.reject(x)
diff --git a/main.js b/main.js
index 1fe1c3f..72ef9f7 100644
--- a/main.js
+++ b/main.js
@@ -1,7 +1,7 @@
import App from './App'
import Vue from 'vue'
-/* import Vconsole from 'vconsole';
-new Vconsole(); */
+import Vconsole from 'vconsole';
+new Vconsole();
import uView from '@/uni_modules/uview-ui'
Vue.use(uView)
--
Gitblit v1.9.1