fix: 将状态码判断字段从code换为http status

This commit is contained in:
chenjinsong
2023-08-27 20:34:24 +08:00
parent dc6b8e067c
commit 4a20d39fa2
13 changed files with 50 additions and 49 deletions

View File

@@ -263,17 +263,18 @@ export default {
},
uploadSuccess (response) {
this.uploadLoading = false
this.uploaded = response.code === 200
if (response.code === 200) {
this.uploaded = true
/* this.uploaded = response.code === 200
if (response.code === 200) { */
this.$message.success(this.$t('tip.success'))
this.showAddUpdateDialog = false
axios.get(api.knowledgeBaseLog + '/' + this.updateKnowledge.knowledgeId, { params: { pageSize: 999 } }).then(res => {
this.updateHistoryList = res.data.data.list
this.currentVersion = this.updateHistoryList[0].commitVersion + 1
})
} else {
/* } else {
this.$message.error(this.$t('tip.uploadFailed', { msg: response.message }))
}
} */
},
beforeUpload (file) {
this.uploadLoading = true

View File

@@ -108,7 +108,7 @@ export default {
let basicInfoError = ''
if (tagData) {
const res = tagData.data
if (res.code === 200) {
if (tagData.status === 200) {
Object.keys(res.data).forEach(k => {
if (k !== 'userDefinedTags' && res.data[k]) {
Object.keys(res.data[k]).forEach(k2 => {
@@ -132,7 +132,7 @@ export default {
}
if (basicInfoData) {
const res = basicInfoData.data
if (res.code === 200) {
if (basicInfoData.status === 200) {
switch (this.entity.entityType) {
case 'ip': {
if (res.data.asn) {

View File

@@ -223,7 +223,7 @@ export default {
axios.get(`${api.entity.throughput}/${this.entity.entityType}`, { params: params }).then(response => {
const res = response.data
if (res.code === 200) {
if (response.status === 200) {
this.isNoData = res.data.result.length === 0
this.showError = false
if (this.isNoData) {

View File

@@ -120,7 +120,7 @@ export default {
const performance = axios.get(`${api.entity.performance}/${this.entityType}`, { params: params })
Promise.all([informationAggregation, openPort, security, performance]).then(response => {
if (response[0].data.code === 200) {
if (response[0].status === 200) {
const list = []
response[0].data.data.result.forEach(r => {
Object.keys(r).forEach(k => {
@@ -148,13 +148,13 @@ export default {
this.initSetTag(entityDetailTabsName.informationAggregation, list.length)
}
if (response[1].data.code === 200) {
if (response[1].status === 200) {
this.initSetTag(entityDetailTabsName.openPort, response[1].data.data.result.length)
}
if (response[2].data.code === 200) {
if (response[2].status === 200) {
this.initSetTag(entityDetailTabsName.securityEvent, response[2].data.data.result.length)
}
if (response[3].data.code === 200) {
if (response[3].status === 200) {
this.initSetTag(entityDetailTabsName.performanceEvent, response[3].data.data.result.length)
}
})
@@ -186,22 +186,22 @@ export default {
switch (this.entity.entityType) {
case 'ip': {
const len1 = res0.code === 200 ? res0.data.result.length : 0
const len2 = res1.code === 200 ? res1.data.result.length : 0
const len1 = res[0].status === 200 ? res0.data.result.length : 0
const len2 = res[1].status === 200 ? res1.data.result.length : 0
this.initSetTag(entityDetailTabsName.relatedEntity, len1 + len2)
break
}
case 'domain': {
const res2 = res[2].data
const len1 = res0.code === 200 ? res0.data.result.length : 0
const len2 = res1.code === 200 ? res1.data.result.length : 0
const len3 = res2.code === 200 ? res2.data.result.length : 0
const len1 = res[0].status === 200 ? res0.data.result.length : 0
const len2 = res[1].status === 200 ? res1.data.result.length : 0
const len3 = res[2].status === 200 ? res2.data.result.length : 0
this.initSetTag(entityDetailTabsName.relatedEntity, len1 + len2 + len3)
break
}
case 'app': {
const len1 = res0.code === 200 ? res0.data.result.length : 0
const len2 = res1.code === 200 ? res1.data.result.length : 0
const len1 = res[0].status === 200 ? res0.data.result.length : 0
const len2 = res[1].status === 200 ? res1.data.result.length : 0
this.initSetTag(entityDetailTabsName.relatedEntity, len1 + len2)
break
}

View File

@@ -192,7 +192,7 @@ export default {
const res = []
res[0] = response[0].data
res[1] = response[1].data
if (res[0].code === 200) {
if (response[0].status === 200) {
this.showError1 = false
const linkData = res[0].data.result
@@ -252,7 +252,7 @@ export default {
this.errorMsg1 = this.errorMsgHandler(res[0])
}
if (res[1].code === 200) {
if (response[1].status === 200) {
this.showError2 = false
const nextHopData = res[1].data.result

View File

@@ -163,9 +163,9 @@ export default {
}
}
this.loading = true
axios.get(api.linkMonitor.totalTrafficAnalysis, { params: params }).then((res) => {
res = res.data
if (res.code === 200) {
axios.get(api.linkMonitor.totalTrafficAnalysis, { params: params }).then(response => {
const res = response.data
if (response.status === 200) {
this.showError = false
this.isNoData = res.data.result.length === 0
if (this.isNoData) {

View File

@@ -112,9 +112,9 @@ export default {
url = n === 0 ? api.linkMonitor.quadrupleIngressAnalysis : api.linkMonitor.quadrupleEgressAnalysis
}
this.toggleLoading(true)
axios.get(url, { params: params }).then(res => {
res = res.data
if (res.code === 200) {
axios.get(url, { params }).then(response => {
const res = response.data
if (response.status === 200) {
this.showError = false
if (n === 0) {
this.ingress = res.data.result.length === 0

View File

@@ -142,9 +142,9 @@ export default {
}
}
this.loading = true
axios.get(api.linkMonitor.networkAnalysis, { params: params }).then(res => {
res = res.data
if (res.code === 200) {
axios.get(api.linkMonitor.networkAnalysis, { params: params }).then(response => {
const res = response.data
if (response.status === 200) {
this.showError = false
this.isNoData = res.data.result.length === 0
const data = {

View File

@@ -263,7 +263,7 @@ export default {
}
})
}
if (res[0].data.code === 200 && res[1].data.code === 200) {
if (res[0].status === 200 && res[1].status === 200) {
this.showError = false
const prevData = res[0].data.data.result
const data = res[1].data.data.result
@@ -468,9 +468,9 @@ export default {
}
if (parseFloat(this.appTypeTab) === 0) {
params.type = 'overviewProvide'
axios.get(api.dict, { params: params }).then(res => {
res = res.data
if (res.code === 200 && res.data.list) {
axios.get(api.dict, { params: params }).then(response => {
const res = response.data
if (response.status === 200 && res.data.list) {
res.data.list = res.data.list.filter(l => !this.appData.some(pd => pd.type === 'provider' && pd.name === l.value))
this.pageObj.pages = res.data.pages
res.data.list.forEach(t => {
@@ -494,9 +494,9 @@ export default {
})
} else if (parseFloat(this.appTypeTab) === 1) {
params.type = 'overviewApp'
axios.get(api.dict, { params: params }).then(res => {
res = res.data
if (res.code === 200) {
axios.get(api.dict, { params: params }).then(response => {
const res = response.data
if (response.status === 200) {
res.data.list = res.data.list.filter(l => !this.appData.some(pd => pd.type === 'app' && pd.name === l.value))
this.pageObj.pages = res.data.pages
res.data.list.forEach(t => {

View File

@@ -174,7 +174,7 @@ export default {
axios.get(api.netWorkOverview.totalTrafficAnalysis, { params: params }).then(response => {
const res = response.data
if (res.code === 200) {
if (response.status === 200) {
this.isNoData = res.data.result.length === 0
this.showError = false
if (this.isNoData) {

View File

@@ -444,7 +444,7 @@ export default {
}
const requestUrl = this.getCurUrl()
axios.get(requestUrl, { params: queryParams }).then(response => {
if (response.data.code === 200) {
if (response.status === 200) {
this.showError = false
this.errorMsg = ''
this.chartData = response.data.data.result
@@ -926,7 +926,7 @@ export default {
this.customTableTitles.forEach(tableColumn => {
if (tableColumn.columnType === tableColumnType.chainRatio && tableColumn.isInMainUrl && tableDataTmp && tableDataTmp.length > 0) {
axios.get(self.gerCycleUrl(), { params: queryParams }).then(response => {
if (response.data.code === 200) {
if (response.status === 200) {
tableColumn.showError = false
tableColumn.errorMsg = ''
cycleTotalList = response.data.data.result
@@ -992,7 +992,7 @@ export default {
this.customTableTitles.forEach(tableColumn => {
if (tableColumn.columnType === tableColumnType.chainRatio && !tableColumn.isInMainUrl) {
axios.get(self.gerColumnUrl(tableColumn), { params: queryParams }).then(response => {
if (response.data.code === 200) {
if (response.status === 200) {
if (!tableColumn.showError) {
tableColumn.showError = false
tableColumn.errorMsg = ''
@@ -1032,7 +1032,7 @@ export default {
cycle: tableColumn.cycle
}
axios.get(self.gerColumnUrl(tableColumn), { params: queryCycleParams }).then(response => {
if (response.data.code === 200) {
if (response.status === 200) {
if (!tableColumn.showError) {
tableColumn.showError = false
tableColumn.errorMsg = ''

View File

@@ -155,7 +155,7 @@ export default {
]
axios.get(`${api.detection.detail}/${this.drawerInfo.ruleId}`).then(res => {
if (res.data.code === 200) {
if (res.status === 200) {
this.detailData = res.data.data
}
}).catch(err => {

View File

@@ -276,7 +276,7 @@ export default {
}
axios.get(`${url}?resource=${this.entity.entityValue}`).then(responese => {
const res = responese.data
if (res.code === 200) {
if (responese.status === 200) {
Object.keys(res.data).forEach(k => {
if (k !== 'userDefinedTags' && res.data[k]) {
Object.keys(res.data[k]).forEach(k2 => {