Revert "fix:孔夫子搜索errType=102时检测到登录过期后清除session跳转登录页"

This reverts commit ad8010bbd3.
This commit is contained in:
97694732@qq.com 2026-06-15 10:48:23 +08:00
parent ad8010bbd3
commit 9f89e5469f
2 changed files with 6 additions and 65 deletions

View File

@ -1343,23 +1343,6 @@ export default {
searchFacet(keyword, { phpsessid, dataType: 1 })
]).then(([productsData, onSaleFacet, soldFacet]) => {
this.isLoading = false
//
if (productsData.loginRequired || onSaleFacet.loginRequired || soldFacet.loginRequired) {
uni.showModal({
title: '系统提示',
content: '孔夫子登录已过期,请重新登录',
confirmText: '去登录',
success: (modalRes) => {
if (modalRes.confirm) {
uni.removeStorageSync('kongfz_phpsessid')
uni.navigateTo({ url: '/pages/login/login' })
}
}
})
return
}
if (productsData && productsData.total > 0) {
// 12
const list = (productsData.list || []).slice(0, 12)
@ -2581,23 +2564,6 @@ export default {
searchFacet(keyword, { phpsessid, dataType: 1 })
]).then(([productsData, onSaleFacet, soldFacet]) => {
this.noIsbnLoading = false
//
if (productsData.loginRequired || onSaleFacet.loginRequired || soldFacet.loginRequired) {
uni.showModal({
title: '系统提示',
content: '孔夫子登录已过期,请重新登录',
confirmText: '去登录',
success: (modalRes) => {
if (modalRes.confirm) {
uni.removeStorageSync('kongfz_phpsessid')
uni.navigateTo({ url: '/pages/login/login' })
}
}
})
return
}
//
const authorSet = new Set()
const publisherSet = new Set()
@ -2683,23 +2649,6 @@ export default {
author: this.noIsbnAuthor
}).then((productsData) => {
this.noIsbnLoading = false
//
if (productsData.loginRequired) {
uni.showModal({
title: '系统提示',
content: '孔夫子登录已过期,请重新登录',
confirmText: '去登录',
success: (modalRes) => {
if (modalRes.confirm) {
uni.removeStorageSync('kongfz_phpsessid')
uni.navigateTo({ url: '/pages/login/login' })
}
}
})
return
}
if (productsData && productsData.total > 0) {
const list = (productsData.list || []).slice(0, 12)
this.noIsbnProductList = list.map(item => {

View File

@ -113,12 +113,9 @@ export function searchFacet(keyword, options = {}) {
}
})
const totalFound = parseInt(res.data.data.totalFoundText || res.data.data.matchInfo?.totalFound || 0, 10)
resolve({ newCount, oldCount, totalFound, loginRequired: false })
} else if (res.data && res.data.errType === '102') {
console.warn('孔夫子统计需要重新登录(errType=102)')
resolve({ newCount: 0, oldCount: 0, totalFound: 0, loginRequired: true })
resolve({ newCount, oldCount, totalFound })
} else {
resolve({ newCount: 0, oldCount: 0, totalFound: 0, loginRequired: false })
resolve({ newCount: 0, oldCount: 0, totalFound: 0 })
}
},
fail: (err) => {
@ -189,7 +186,7 @@ export function fetchItems(token, params = {}, onProgress) {
* 搜索孔夫子在售商品需要登录Cookie
* @param {string} keyword ISBN或书名
* @param {object} options {phpsessid, page}
* @returns {Promise<{total: number, list: Array, loginRequired: boolean}>}
* @returns {Promise<{total: number, list: Array}>}
* list中每项: {id, title, author, press, priceText, imgBigUrl, shopName, qualityText, pubDateText, postage}
*/
export function searchProducts(keyword, options = {}) {
@ -234,18 +231,13 @@ export function searchProducts(keyword, options = {}) {
if (itemResp) {
resolve({
total: itemResp.total || 0,
list: itemResp.list || [],
loginRequired: false
list: itemResp.list || []
})
} else {
resolve({ total: 0, list: [], loginRequired: false })
resolve({ total: 0, list: [] })
}
} else if (res.data && res.data.errType === '102') {
// errType 102 = 需要登录
console.warn('孔夫子搜索需要重新登录(errType=102)')
resolve({ total: 0, list: [], loginRequired: true })
} else {
resolve({ total: 0, list: [], loginRequired: false })
resolve({ total: 0, list: [] })
}
},
fail: (err) => {