Commit f57f7a87 authored by 何虹's avatar 何虹 💬

读写分离加到头上

parent 3353ab96
......@@ -2003,8 +2003,8 @@ class Control {
if (!dbCode) {
parms.dbCode = urlParam.dbCode || ''
}
if (!userId && userId !== 0) {
parms.userId = -2
if (!userId) {
parms.userId = -1
}
if (!configType && configType !== 0) {
parms.configType = -2
......@@ -2056,7 +2056,7 @@ class Control {
*/
webChartConfigQuery (data) {
this.packParamHandle(data)
const { appCode, pageName, controlName, userId, dbName, dbCode,configType } = data
const { appCode, pageName, controlName, userId, dbName, dbCode, configType } = data
const postData = {
exec_sql: `EXEC dbo.spappWebChartConfig_Query @sAppCode='${appCode}',@sPage='${pageName}',@sControl='${controlName}',@iUserId='${userId}',@iConfigType='${configType}'`,
db_name: dbName,
......@@ -22014,6 +22014,15 @@ class RestFul {
parms.appCode = this.requestClient.appCode //|| urlParam.appCode
}
}
mergeHeaderQueryMaster (isQueryMaster) {
if (isQueryMaster) {
return {
'x-db_router_type': 'master'
}
} else {
return {}
}
}
query (data) {
this.packParamHandle(data)
const { tableName, appCode, group, parms, bodyData, isQueryMaster } = data
......@@ -22021,9 +22030,7 @@ class RestFul {
if (group) { // 非标准保存
url = `${url}${group}/`
}
const header = {
isQueryMaster: isQueryMaster ? 1 : 0
}
const header = this.mergeHeaderQueryMaster(isQueryMaster)
if (bodyData) {
return this.requestClient.put(url, bodyData, parms, header)
} else {
......@@ -22046,9 +22053,7 @@ class RestFul {
if (group) {
url_ = `${url_}${group}/`
}
const header = {
isQueryMaster: isQueryMaster ? 1 : 0
}
const header = this.mergeHeaderQueryMaster(isQueryMaster)
if (bodyData) {
return this.requestClient.put(url_, bodyData, parms, header)
} else {
......@@ -22062,9 +22067,8 @@ class RestFul {
if (group) { // 非标准保存
url = `${url}${group}/`
}
return this.requestClient.put(url, bodyData, parms, {
isQueryMaster: isQueryMaster ? 1 : 0
})
const header = this.mergeHeaderQueryMaster(isQueryMaster)
return this.requestClient.put(url, bodyData, parms, header)
}
queryList (data) {
......@@ -22075,9 +22079,7 @@ class RestFul {
url_ = `${url_}${group}/`
}
parms.fuzzy = 1
const header = {
isQueryMaster: isQueryMaster ? 1 : 0
}
const header = this.mergeHeaderQueryMaster(isQueryMaster)
if (bodyData) {
return this.requestClient.put(url_, bodyData, parms, header)
} else {
......
This source diff could not be displayed because it is too large. You can view the blob instead.
......@@ -11,6 +11,15 @@ class RestFul {
parms.appCode = this.requestClient.appCode //|| urlParam.appCode
}
}
mergeHeaderQueryMaster (isQueryMaster) {
if (isQueryMaster) {
return {
'x-db_router_type': 'master'
}
} else {
return {}
}
}
query (data) {
this.packParamHandle(data)
const { tableName, appCode, group, parms, bodyData, isQueryMaster } = data
......@@ -18,9 +27,7 @@ class RestFul {
if (group) { // 非标准保存
url = `${url}${group}/`
}
const header = {
isQueryMaster: isQueryMaster ? 1 : 0
}
const header = this.mergeHeaderQueryMaster(isQueryMaster)
if (bodyData) {
return this.requestClient.put(url, bodyData, parms, header)
} else {
......@@ -43,9 +50,7 @@ class RestFul {
if (group) {
url_ = `${url_}${group}/`
}
const header = {
isQueryMaster: isQueryMaster ? 1 : 0
}
const header = this.mergeHeaderQueryMaster(isQueryMaster)
if (bodyData) {
return this.requestClient.put(url_, bodyData, parms, header)
} else {
......@@ -59,9 +64,8 @@ class RestFul {
if (group) { // 非标准保存
url = `${url}${group}/`
}
return this.requestClient.put(url, bodyData, parms, {
isQueryMaster: isQueryMaster ? 1 : 0
})
const header = this.mergeHeaderQueryMaster(isQueryMaster)
return this.requestClient.put(url, bodyData, parms, header)
}
queryList (data) {
......@@ -72,9 +76,7 @@ class RestFul {
url_ = `${url_}${group}/`
}
parms.fuzzy = 1
const header = {
isQueryMaster: isQueryMaster ? 1 : 0
}
const header = this.mergeHeaderQueryMaster(isQueryMaster)
if (bodyData) {
return this.requestClient.put(url_, bodyData, parms, header)
} else {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment