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

View File

@ -80,17 +80,17 @@ export function login(username, password) {
/**
* 搜索孔夫子商品品相统计全新/古旧等
* @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}>}
*/
export function searchFacet(keyword, options = {}) {
const { phpsessid = '', userArea = '1006000000' } = options
const { phpsessid = '', userArea = '1006000000', dataType = 0 } = options
return new Promise((resolve, reject) => {
uni.request({
url: 'https://search.kongfz.com/pc-gw/search-web/client/pc/product/keyword/normal/facet',
method: 'GET',
data: {
dataType: 0,
dataType: dataType,
keyword: keyword,
page: 1,
userArea: userArea