已售统计接入dataType=1的facet接口

This commit is contained in:
97694732@qq.com 2026-06-03 16:27:01 +08:00
parent e062725f2d
commit 767c0c3704
2 changed files with 10 additions and 9 deletions

View File

@ -993,11 +993,12 @@ export default {
// 2. - // 2. -
const phpsessid = this.kongfzToken || uni.getStorageSync('kongfz_phpsessid') || '' const phpsessid = this.kongfzToken || uni.getStorageSync('kongfz_phpsessid') || ''
// + // + +
Promise.all([ Promise.all([
searchProducts(this.isbn, { phpsessid }), searchProducts(this.isbn, { phpsessid }),
searchFacet(this.isbn, { phpsessid }) searchFacet(this.isbn, { phpsessid, dataType: 0 }),
]).then(([productsData, facetData]) => { searchFacet(this.isbn, { phpsessid, dataType: 1 })
]).then(([productsData, onSaleFacet, soldFacet]) => {
this.isLoading = false this.isLoading = false
if (productsData && productsData.total > 0) { if (productsData && productsData.total > 0) {
// 12 // 12
@ -1018,9 +1019,9 @@ export default {
// 使facet // 使facet
this.marketData = { this.marketData = {
onSale: productsData ? productsData.total : 0, onSale: productsData ? productsData.total : 0,
old: facetData ? facetData.oldCount : 0, old: onSaleFacet ? onSaleFacet.oldCount : 0,
new: facetData ? facetData.newCount : 0, new: onSaleFacet ? onSaleFacet.newCount : 0,
sold: 0 sold: soldFacet ? (soldFacet.oldCount + soldFacet.newCount) : 0
} }
}).catch(() => { }).catch(() => {
this.isLoading = false this.isLoading = false

View File

@ -80,17 +80,17 @@ export function login(username, password) {
/** /**
* 搜索孔夫子商品品相统计全新/古旧等 * 搜索孔夫子商品品相统计全新/古旧等
* @param {string} keyword ISBN或书名 * @param {string} keyword ISBN或书名
* @param {object} options {phpsessid, userArea} * @param {object} options {phpsessid, userArea, dataType} dataType=0在售 / 1已售
* @returns {Promise<{newCount: number, oldCount: number, totalFound: number}>} * @returns {Promise<{newCount: number, oldCount: number, totalFound: number}>}
*/ */
export function searchFacet(keyword, options = {}) { export function searchFacet(keyword, options = {}) {
const { phpsessid = '', userArea = '1006000000' } = options const { phpsessid = '', userArea = '1006000000', dataType = 0 } = options
return new Promise((resolve, reject) => { return new Promise((resolve, reject) => {
uni.request({ uni.request({
url: 'https://search.kongfz.com/pc-gw/search-web/client/pc/product/keyword/normal/facet', url: 'https://search.kongfz.com/pc-gw/search-web/client/pc/product/keyword/normal/facet',
method: 'GET', method: 'GET',
data: { data: {
dataType: 0, dataType: dataType,
keyword: keyword, keyword: keyword,
page: 1, page: 1,
userArea: userArea userArea: userArea