优化代码

This commit is contained in:
wuxw 2020-07-11 22:45:53 +08:00
parent 4690b401ea
commit cba4f958ec
2 changed files with 8 additions and 2 deletions

View File

@ -14,6 +14,8 @@ const factory = require("../factory/index.js");
* 获取请后台服务时的头信息 * 获取请后台服务时的头信息
*/ */
const getHeaders = function() { const getHeaders = function() {
let _wAppId = uni.getStorageSync(constant.mapping.W_APP_ID);
return { return {
"app-id": constant.app.appId, "app-id": constant.app.appId,
"transaction-id": util.core.wxuuid(), "transaction-id": util.core.wxuuid(),
@ -21,7 +23,8 @@ const getHeaders = function() {
"sign": '1234567', "sign": '1234567',
"user-id": '-1', "user-id": '-1',
"cookie": '_java110_token_=' + wx.getStorageSync('token'), "cookie": '_java110_token_=' + wx.getStorageSync('token'),
"Accept": '*/*' "Accept": '*/*',
"w-app-id":_wAppId
}; };
}; };
/** /**

View File

@ -20,6 +20,8 @@ class LoginFactory {
} // 检查本地 storage 中是否有登录态标识 } // 检查本地 storage 中是否有登录态标识
getHeaders() { getHeaders() {
let _wAppId = uni.getStorageSync(constant.mapping.W_APP_ID);
return { return {
"app-id": constant.app.appId, "app-id": constant.app.appId,
"transaction-id": util.core.wxuuid(), "transaction-id": util.core.wxuuid(),
@ -27,7 +29,8 @@ class LoginFactory {
"sign": '1234567', "sign": '1234567',
"user-id": '-1', "user-id": '-1',
"cookie": '_java110_token_=' + wx.getStorageSync('token'), "cookie": '_java110_token_=' + wx.getStorageSync('token'),
"Accept": '*/*' "Accept": '*/*',
"w-app-id":_wAppId
}; };
}; };