PageSourceSearch

https://www.eugeniaeyewear.com/src/api/page.js

js eugeniaeyewear.com collected 2026-10-08 07:09:28 UTC 26,025 bytes, 640 lines download raw bytes

1import apiAddress from '../constant/apiAddress.js'
2import { PageConfig, getPageConfigByPath, checkSystemPage, getPageType, getPageCode, checkDetail, getListContentType } from '../../config/index.js'
3
4const mapPageSortType = {
5  1: 'favorite asc',
6  2: 'favorite desc',
7  3: 'order asc',
8  4: 'order desc',
9  5: 'id desc',
10}
11
12export function getPageData(ctx, params) {
13  const pageUrl = params.url_path.replace(/^\/|\.html$/g, '').replace('/', '_') || 'index'
14  return new Promise((resolve, reject) => {
15    const pageCfg = getPageConfigByPath(pageUrl)
16    if (
17      (pageCfg && (pageCfg.code < 200 || pageCfg.code === 352)) ||
18      params.url_path.indexOf('/coupon_detail') === 0 ||
19      params.url_path.indexOf('/reduction_detail') === 0
20    ) {
21      // 返回所有处理好的结果
22      resolve({
23        id: 0,
24        page_id: 0,
25        page_type: 'not_found',
26        page_url: params.url_path.replace('.html', ''),
27        content_type: 0,
28        content_id: 0,
29        category_id: 0,
30        design_page_id: 0,
31        support_languages: []
32      })
33    } else {
34      // if (ctx.state.cache && ctx.state.cache.getApiData('content_detail')) {
35      //   resolve(getTemplateData(ctx.state.cache.getApiData('content_detail')['data']))
36      // }
37      let cacheRes, cacheParams, originalPageSize, result
38      let offset = 0
39      const match = params['url_path'].match(/[_-]list(\d+)\.html$/)
40      if (ctx.state.cache && match && match[1]) {
41        // 第一页不走缓存
42        cacheParams = { url_path: params.url_path.replace(/([_-]list\d+|)\.html$/, '') }
43        cacheRes = ctx.state.cache.getApiData('page_category_list', cacheParams, true)
44        if (cacheRes) {
45          if (ctx.query.force !== 'html' && parseInt(match[1]) > Math.ceil(cacheRes.data.content.total / cacheRes.data.content.original_page_size)) {
46            result = {
47              id: 0,
48              page_id: 0,
49              page_type: 'not_found',
50              page_url: params.url_path.replace('.html', ''),
51              content_type: 0,
52              content_id: 0,
53              category_id: 0,
54              design_page_id: 0,
55              support_languages: []
56            }
57          } else if (ctx.query.force === 'html' && cacheRes.expired_at > parseInt(Date.now() / 1000)) {
58            // 缓存静态化分页批量生成
59            originalPageSize = cacheRes.data.content.original_page_size
60            offset = (match[1] - 1) * originalPageSize - (cacheRes.data.content.page_number - 1) * cacheRes.data.content.page_size
61            cacheRes.data.content = {
62              ...cacheRes.data.content,
63              list: offset >= 0 ? cacheRes.data.content.list.slice(offset, offset + originalPageSize) : [],
64              page_size: originalPageSize,
65              page_number: match[1],
66              page_count: Math.ceil(cacheRes.data.content.total / originalPageSize)
67            }
68            const needPage = Math.ceil(1000 / originalPageSize)
69            params['force_page_size'] = needPage * originalPageSize
70            params['page_number'] = Math.ceil(match[1] / needPage)
71          }
72        }
73      }
74
75      if (result) {
76        resolve(result)
77      } else if (cacheRes && cacheRes.data.content.list.length === originalPageSize) {
78        resolve(cacheRes.data)
79      } else {
80        ctx.state.request(ctx, {
81          name: '页面数据',
82          url: apiAddress.pageContentData,
83          method: 'POST',
84          params
85        })
86          .then(async res => {
87            // if (ctx.state.cache) ctx.state.cache.fillApiData(res, 'content_detail')
88            res.data.page_type = (/\/product[_-]lives(|[_-]list\d+)\.html/.test(params.url_path) || res.data.page_type != 'not_found') ? res.data.page_type : '404'
89
90            if (cacheParams && res.data.content.list && res.data.content.list.length) {
91              res.data.content.original_page_size = originalPageSize || res.data.content.page_size
92              ctx.state.cache.fillApiData(res, 'page_category_list', cacheParams, true)
93              if (originalPageSize) {
94                offset = (match[1] - 1) * originalPageSize - (res.data.content.page_number - 1) * res.data.content.page_size
95                res.data.content = {
96                  ...res.data.content,
97                  list: res.data.content.list.slice(offset, originalPageSize + offset),
98                  page_size: originalPageSize,
99                  page_number: match[1] || 1,
100                  page_count: Math.ceil(res.data.content.total / originalPageSize)
101                }
102              }
103            }
104            if (Array.isArray(res?.data?.content?.list)) {
105              const page_number = res.data.content.page_number || 1
106              const page_size = originalPageSize || res.data.content.page_size
107              res.data.content.list.forEach((item, i) => {
108                res.data.content.list[i].seq = Math.max((page_number - 1) * page_size, 0) + i + 1
109              })
110            }
111            resolve(res.data)
112          })
113          .catch(error => reject(error))
114      }
115    }
116  })
117}
118
119export function getCategoryData(ctx, params) {
120  return new Promise((resolve, reject) => {
121    if (ctx.state.cache && ctx.state.cache.getApiData('page_category_detail')) {
122      resolve({ category: ctx.state.cache.getApiData('page_category_detail')['data'] })
123    } else {
124      let data = {}
125      ctx.state.request(ctx, {
126        name: '页面栏目数据',
127        url: apiAddress.pageCategoryData,
128        method: 'POST',
129        params
130      })
131        .then(async res => {
132          data.category = res.data || {}
133          if (ctx.state.cache) ctx.state.cache.fillApiData(res, 'page_category_detail')
134
135          resolve(data)
136        })
137        .catch(error => reject(error))
138    }
139  })
140}
141
142// 获取产品搭配
143export function getProductMatchData(ctx, params) {
144  return new Promise((resolve, reject) => {
145    let data = []
146    ctx.state.request(ctx, {
147      name: '产品搭配数据',
148      url: apiAddress.matchProducts,
149      method: 'GET',
150      params
151    })
152      .then(async res => {
153        data = res.data || []
154        resolve(data)
155      })
156      .catch(error => reject(error))
157  })
158}
159
160export function setPageData(ctx, res) {
161  const resCategory = res.category || {}
162  const resContent = res.content || {}
163  const resPage = res
164  let url = resCategory && resCategory.page_url || ''
165  if (!url && /\/product[_-]lives([_-]list\d+|)\.html$/.test(res.url_path)) {
166    url = res.url_path.replace(/([_-]list\d+|)\.html$/, '')
167  }
168  const page_base_url = globalThis.Server.getRinseHref(`${url}`, ctx.state.site)
169  // b2b ai产品不显示去原产品购买
170  const original_page_url_suffix = ctx.state.site.is_shop ? (resContent.original_page_url_suffix || '') : ''
171  // ai,聚合产品不显示价格
172  if (resContent.list && resContent.list.length > 0) {
173    resContent.list.forEach(p => {
174      if (p.content_type && p.content_type !== 2 && p.price) {
175        p.price.const_max = 0
176        p.price.cost_min = 0
177        p.price.selling_max = 0
178        p.price.selling_min = 0
179      }
180    })
181  }
182
183  let supportLanguages = ctx.state.site.language_list
184  if (resPage['content_type'] && resPage['content_type'] > 1 && (resPage['content_type'] < 20 || resPage['content_type'] === 103) && res.support_languages) {
185    res.support_languages.push('en')
186    supportLanguages = ctx.state.site.language_list.filter(item => res.support_languages.includes(item.code))
187  }
188  const currentLanguageObj = supportLanguages.find(val => val.code === (ctx.state.site.language_code || 'en'))
189  const language_title = currentLanguageObj ? currentLanguageObj.title : ''
190  let pageData = {
191    language_list: supportLanguages,
192    language_title,
193
194    page_id: resPage.id || 0,
195    page_type: resPage.page_type,
196    content_type: resPage.content_type || 0,
197    design_page_id: resPage.design_page_id || 0,
198    content_id: resPage.content_id || 0,
199    parents: resCategory.parents || [],
200    page_url: res.url_path || '',
201
202    page_category_id: resCategory.id || 0,
203    page_title: resCategory.title || '',
204    page_description: resCategory.summary || '',
205    page_url_suffix: res.url_path,
206    page_source: resCategory.source || '',
207    page_base_url: page_base_url,
208    page_sort_code: resCategory.sort_list || 0,
209    page_generate_status: resCategory.generate_status || 0,
210    page_sort_type: mapPageSortType[resCategory.sort_list] || '',
211
212    keywords: resContent.keywords || '',
213    meta_keywords: resPage.content_type === 1 ? resCategory.meta_keywords || '' : resContent.meta_keywords || '',
214    meta_description: resPage.content_type === 1 ? resCategory.meta_description || '' : resContent.meta_description || '',
215    meta_title: resPage.content_type === 1 ? resCategory.meta_title || '' : resContent.meta_title || '',
216    page_open_type: resCategory.open_type,
217
218    list: resContent.list || [],
219    page_count: resContent.page_count || 0,
220    page_number: resContent.page_number || 0,
221    page_total: resContent.total || 0,
222    page_size: resContent.page_size || 0,
223    original_page_url_suffix,
224
225    album_list: resContent.album_list || [],
226    detail_title: resContent.title || '',
227    detail_max_price: resContent.price_max || '',
228    detail_min_price: resContent.price_min || '',
229    detail_max_cost_price: resContent.cost_max || '',
230    detail_min_cost_price: resContent.cost_min || '',
231    detail_create_time: resContent.create_time || '',
232    detail_update_time: resContent.update_time || '',
233    detail_subtitle: resContent.subtitle || '',
234    detail_summary: resContent.summary || '',
235    detail_profile: resContent.profile || '',
236    detail_renew_time: resContent.renew_time || '',
237    detail_add_time: ([4, 5, 6, 7, 8].includes(resPage.content_type) ? resContent.show_time : '') || resContent.add_time || '',
238    detail_reads: resContent.reads || '',
239    detail_thumb: resContent.thumb || '',
240    detail_abstract: resContent.abstract || '', // ai文章摘要
241    detail_video_url: resContent.src_url_prefix || resContent.src_url || resContent.video_url || '',
242    m3u8_url: resContent.m3u8_url || '',
243    details_file_info:resContent.file_info||{duration:0},
244    detail_description: resContent.description || '',
245    detail_knowledge: resContent.knowledge || [],
246    detail_question: resContent.question || [],
247    detail_tags: resContent.product_tag || [],
248    detail_template_status: resContent.template_status || 0,
249    detail_css_name: resContent.css_name, // 富文本内容需要的样式文件名称
250    relate_product: resContent.relate_product || [],
251    tradeInfo_list: [],
252    attrParam_list: [],
253    attr_list: resContent.attr_list || [],
254    attr_linkage_title_list: resContent.attr_linkage_title_list || [],
255    // pattern: resContent.pattern || [],
256    // pattern_attr_list: resContent.pattern_attr_list || [],
257    linkage_attr_list: resContent.attr_linkage_list || [],
258    next_page_info: resContent.next_page_info,
259    prep_page_info: resContent.prep_page_info,
260    chart_img: resContent.chart_list || [],
261    recommended_title: resContent.recommended || '',
262    shipment_method: resContent.shipment_method,
263    platform_relate: resContent.platform_relate || [],
264    platform_open_type: resContent.platform_open_type || 1,
265    module1_content: resContent.module1_content||'',
266    module2_content: resContent.module2_content||'',
267    moq: resContent.moq || 1,
268    h_tag_directory:resContent.h_tag_directory||[],
269    // template_id: resContent.page_id || 0, // ai文章-模板(第几套)
270    template_id: resContent.template_id || 1, // ai文章-模板(运营要求都改用第一套)
271    article_list: resContent.article_list, // 综合聚合页推荐文章
272    product_list: resContent.product_list, // 综合聚合页推荐产品
273    video_list: resContent.video_list, // 综合聚合页推荐产品
274    edit_mode: resContent.edit_mode || 1, // 详情编辑模式
275
276    effect: {}, // 网页样式效果
277    logo_url: ctx.state.site.logo_url || 'https://img.yfisher.com/logo2xyf.png', // 页面上实际使用的LOGO
278    product_summary: resContent.product_summary,
279    article_summary: resContent.article_summary,
280    about: resContent.about,
281    transfer_product_id: resContent.transfer_product_id,
282    tags: resContent.tags || [],
283    browse_count: resContent.browse_count || 0,
284    forward_count: resContent.forward_count || 0,
285    like_count: resContent.like_count || 0,
286    followers: resContent.followers || 0,
287    thumb_alt: resContent.thumb_alt || '',
288    struct_data: resPage.struct_data || [], // 结构化数据参数
289    match_products: resPage.match_products || [],
290    serialNumber: resContent.number || '', // 产品详情页的产品编号
291    content_tag_info: {
292      tag_list: resContent.tag_list || [],   // 文章视频详情的标签
293      tag_id: resContent.tag_id || 0,   // 标签详情的标签id
294      tag_title: resContent.title,  // 标签详情的标签名称
295      tag_summary: resContent.summary,  // 标签详情的标签描述
296      tag_views: resContent.views,  // 标签详情的浏览量
297      tag_contents: resContent.contents  // 标签详情的内容量
298    },
299    faq_category_id: resContent.page_category_faq?.map(val => val.page_category_id),
300    store_info: res.content || {
301      address: '',
302      contacts: '',
303      country: '',
304      email: '',
305      map_url: '',
306      phone: '',
307      photos: [],
308      province: '',
309      reception_time: [],
310      summary: '',
311      title: '',
312    },
313    detail: res.content || {
314      address: '',
315      contacts: '',
316      country: '',
317      email: '',
318      map_url: '',
319      phone: '',
320      photos: [],
321      province: '',
322      reception_time: [],
323      summary: '',
324      title: '',
325    },
326
327  }
328
329  // 如果是系统页,就直接改掉page_type
330  let url_path = ctx.path
331  // 如果是子目录形式, 路径中去掉小语种前缀
332  if (ctx.state.site.domain_mode === 2) {
333    //主语种
334    if (ctx.state.site.language_code === 'en') url_path = ctx.path
335    // 其它语种去掉前缀
336    else url_path = ctx.path.replace(ctx.state.site.lang_prefix, '')
337  }
338
339  pageData.page_type = getPageType(url_path, ctx.state.site.site_type, pageData.page_type)
340  pageData.page_code = getPageCode(pageData.page_type)
341  // 拿第一个xx
342  setOther(pageData, resContent)
343  // 获取产品列表页数据
344  // 处理list
345  setPageDetailList(pageData)
346  // 面包屑
347  setNaveInfo(pageData)
348  // 处理平台导流
349  setPlatForm(pageData)
350
351  // 替换域名
352  pageData.logo_url = globalThis.Server.replaceImgDomain(pageData.logo_url, ctx.state.site.prefix_domain, ctx.state.site.is_replace_domain)
353  pageData.detail_video_url = globalThis.Server.replaceImgDomain(pageData.detail_video_url, ctx.state.site.prefix_domain, ctx.state.site.is_replace_domain)
354  pageData.detail_thumb = globalThis.Server.replaceImgDomain(pageData.detail_thumb, ctx.state.site.prefix_domain, ctx.state.site.is_replace_domain)
355
356  return pageData
357
358  /** 平台层流处理 */
359  function setPlatForm(pageData) {
360    const platFormTypeInfo = {
361      1: 'amazon', 2: 'shopee', 3: 'alibaba', 4: 'gmarket', 5: 'lazada',
362      6: 'ebay', 7: 'mercadolibre', 8: 'aliexpress', 9: 'wish', 10: '11street', 11: 'tagert', 12: 'walmart'
363    }
364    pageData.platform_relate = pageData.platform_relate.map(item => {
365      let targetType = Number(pageData.platform_open_type) === 1 ? '_self' : '_blank'
366      // 如果链接为空不能打开新页面
367      if (item.link === '')
368        targetType = '_self'
369      return {
370        name: platFormTypeInfo[item.type] || '',
371        link: item.link || 'javascript:;',
372        targetType
373      }
374    })
375  }
376
377  /** 一些详情设置 */
378  function setOther(pageData, resContent) {
379    if (pageData?.page_type === 'article_detail') {
380      pageData.h_tag_directory = resContent.h_tag_directory || []
381    }
382    // 产品要求有h标签用第四套模板
383    if (pageData?.page_type === 'ai_article_detail') {
384      if(pageData.h_tag_directory&&pageData?.h_tag_directory?.length>0){
385        pageData.template_id = 4
386      }
387    }
388    // 过滤特殊字符
389    pageData.detail_title_text = pageData.detail_title.replace(/\"/g, '')
390
391    if (typeof pageData.detail_description === 'string') {
392      pageData.detail_description = [{ detail: [{ description: pageData.detail_description }] }]
393    }
394    // 取第一张图片
395    const firstImg = pageData.detail_description[0].detail[0] ? pageData.detail_description[0].detail[0].description.match(/<img.*?src=\"([^\"]+)\"/) : ''
396    pageData.detail_first_img = firstImg ? firstImg[1] : ''
397
398    pageData.detail_max_price = pageData.detail_max_price / 100
399    pageData.detail_min_price = pageData.detail_min_price / 100
400    pageData.detail_max_cost_price = pageData.detail_max_cost_price / 100
401    pageData.detail_min_cost_price = pageData.detail_min_cost_price / 100
402
403    // 处理content_type
404    if (pageData.content_type === 'about' || pageData.content_type === 'contact') {
405      pageData.content_type += '_us'
406    }
407    // 处理attr_list
408    pageData.attr_list = pageData.attr_list.filter(item => item.is_show)
409    pageData.attr_list = pageData.attr_list.map(item => {
410      return {
411        type: item.type || 0,
412        input_type: item.input_type || 0,
413        label: item.sign || '',
414        value: item.content || ''
415      }
416    })
417    pageData.tradeInfo_list = pageData.attr_list.filter(item => item.type === 1)
418    pageData.attrParam_list = pageData.attr_list.filter(item => item.type === 2)
419    // 处理图集
420    pageData.album_list = pageData.album_list.map((item, index) => {
421      const video_url = item.album_type === 2 ? item.attach : ''
422      if (resContent.thumb && resContent.watermark_thumb && !index) {
423        // 当产品有水印图时,与主图匹配替换水印图
424        item.attach = resContent.watermark_thumb
425        item.cover_url = resContent.watermark_thumb
426      }
427      return {
428        content: item.content || '',
429        video_url: video_url,
430        img: item.album_type === 2 ? item.cover_url : item.attach ? item.attach : '',
431        album_type: item.album_type // 1 图片, 2 视频
432      }
433    })
434    pageData.album_list = pageData.album_list.filter(item => item.img.indexOf('?_type_') < 0 && item.album_type < 3)
435
436    // 3d模型数据处理
437    const data3d = resContent['3d_display_list']
438    if (data3d && data3d.constructor === Object) pageData['3d_display_list'] = resContent['3d_display_list']
439    // ai的list
440    if (pageData.page_type === 'ai_article_detail' || pageData.page_type === 'polymerize_article_detail' || pageData.page_type === 'ai_product_detail' || pageData.page_type === 'polymerize_product_detail' || pageData.page_type === 'polymerize_multiple_detail') {
441      pageData.list = resContent.polymerize_list || []
442    }
443    // 视频详情主图 不同字段
444    if (pageData.page_type === 'video_detail') {
445      pageData.detail_thumb = resContent.thumb_prefix || ''
446    }
447    // 处理综合聚合页模板推荐产品文章
448    if (pageData.product_list && pageData.product_list.length) {
449      pageData.product_list.forEach(_val => {
450        _val.img = _val.thumb
451        _val.href = _val.page_url_suffix
452      })
453    }
454    if (pageData.article_list && pageData.article_list.length) {
455      pageData.article_list.forEach(_val => {
456        _val.hover_img = _val.thumb
457        _val.img = _val.thumb
458        _val.href = _val.page_url_suffix
459      })
460    }
461    if (pageData.video_list && pageData.video_list.length) {
462      pageData.video_list.forEach(_val => {
463        _val.img = _val.thumb_prefix
464        _val.cover_url = _val.src_url_prefix
465      })
466    }
467
468    if (pageData.content_type == 8 || pageData.content_type == 7 || pageData.content_type == 6) {
469      pageData.page_title = pageData.detail_title
470      pageData.page_description = pageData.detail_description[0].detail[0].description
471    }
472    if (pageData.content_type == 9) {
473      pageData.page_title = pageData.keywords
474      pageData.page_description = pageData.detail_description[0].detail[0].description
475    }
476    pageData.file_status = resContent.file_status
477    pageData.file_list = []
478    if (resContent.file_list) {
479      pageData.file_list = resContent.file_list.map(val => {
480        return {
481          ...val,
482          img: viewCover(val),
483          download_switch: resContent.download_switch,
484          is_product_file: 1
485        }
486      })
487    }
488  }
489  function viewCover(item) {
490    const extend = item.extension
491    const xlsType = ['xlsx', 'xls', 'csv']
492    const docType = ['doc', 'docx']
493    const pdfType = ['pdf']
494    const pptType = ['ppt', 'pptx']
495    const zipType = ['rar', 'zip']
496    const txtType = ['txt']
497    if (xlsType.includes(extend)) return 'https://img.yfisher.com/icon/format-xls.svg'
498    else if (docType.includes(extend)) return 'https://img.yfisher.com/icon/format-doc.svg'
499    else if (pdfType.includes(extend)) return 'https://img.yfisher.com/icon/format-pdf.svg'
500    else if (pptType.includes(extend)) return 'https://img.yfisher.com/icon/format-ppt.svg'
501    else if (extend == 'zip') return 'https://img.yfisher.com/icon/format-zip.svg'
502    else if (extend == 'rar') return 'https://img.yfisher.com/icon/format-rar.svg'
503    else if (extend == 'bmp') return 'https://img.yfisher.com/icon/format-bmp.svg'
504    else if (extend == 'gif') return 'https://img.yfisher.com/icon/format-gif.svg'
505    else if (extend == 'jpg') return 'https://img.yfisher.com/icon/format-jpg.svg'
506    else if (extend == 'png') return 'https://img.yfisher.com/icon/format-png.svg'
507    else if (txtType.includes(extend)) return 'https://img.yfisher.com/icon/format-txt.svg'
508    else return 'https://img.yfisher.com/icon/format-unknown.svg'
509  }
510
511  /** 面包屑 */
512  function setNaveInfo(pageData) {
513    const isDetail = checkDetail(pageData.page_type)
514    // 是否在面包屑最后一段使用h1
515    pageData.isDetail = isDetail
516
517    pageData.parents = pageData.parents.map((item, index) => {
518      return {
519        id: item.id || 0,
520        title: item.title || '',
521        href: item.page_url_suffix || ctx.path
522      }
523    })
524
525    // 内容详情追加
526    if (isDetail) {
527      pageData.parents.push({ id: pageData.page_category_id, title: pageData.detail_title, href: pageData.page_url_suffix })
528    }
529
530    // 面包屑插入第一个 公司名称或首页
531    let home_bread = ctx.state.site.company_brand_name || ctx.state.site.company_name_short || ctx.state.site.home_name || ctx.state.$t('home')
532    pageData.parents.unshift({ id: 0, title: home_bread, href: '/' })
533    // 系统页在面包屑后面再插入
534    if (checkSystemPage(pageData.page_type)) {
535      const title_mapping = { search: 'Search' }
536      let title = pageData.page_type.replace('_', ' ')
537      pageData.parents.push({ id: 0, title: ctx.state.$t(title_mapping[title] ? title_mapping[title] : title), href: ctx.path })
538    }
539    // 搜索页额外追加一个关键词
540    if (pageData.page_type === 'search' && ctx.query.keyword) {
541      const filter = { '<': '&lt;', '>': '&gt;', '&': '&amp;', '"': '&quot;' }
542      ctx.query.keyword = ctx.query.keyword.replace(/[<>&"]/g, c => filter[c])
543      const href = `${ctx.path}?keyword=${ctx.query.keyword}`
544      pageData.parents.push({ id: 0, title: ctx.query.keyword, href })
545    }
546  }
547
548  /** 页面Page.list 处理 */
549  function setPageDetailList(pageData) {
550    const contentListObject = new globalThis.Server.ContentList()
551    // 部分页面的特殊处理
552    switch (pageData.page_type) {
553      case 'polymerize_product_detail':
554        // 产品聚合
555        pageData.list.forEach(item => item.description = item.attr)
556        break
557      case 'video_list':
558        // 视频列表
559        pageData.list.forEach(item => {
560          item.img = item.watermark_thumb || item.thumb_prefix
561          item.cover_url = item.src_url_prefix
562          return item
563        })
564        break
565      case 'polymerize_article_detail':
566        // 文章聚合页列表描述用description字段
567        pageData.list.forEach(item => item.description = item.description && item.description.replace(/<[^<>]+>/g, ''))
568        break
569    }
570    // 按各页面的配置决定list的类型
571    pageData.list = contentListObject.init({
572      type: getListContentType(pageData.page_type),
573      data: pageData.list,
574      mapValue: { tab: 'page_content' }
575    }).data
576  }
577
578  /*
579  function getProductList(resContent) {
580    // ai,聚合产品不显示价格
581    let list = []
582    if (resContent.list && resContent.list.length > 0) {
583      list = resContent.list.map(p => {
584        if (p.content_type && p.content_type !== 2 && p.price) {
585          p.price.const_max = 0
586          p.price.cost_min = 0
587          p.price.selling_max = 0
588          p.price.selling_min = 0
589        }
590        return p
591      })
592    }
593    return list
594  }
595  */
596}
597
598export function getPartnerLink(ctx, params) {
599  const pageUrl = params.url_path.replace(/^\/|\.html$/g, '').replace('/', '_') || 'index'
600  return new Promise((resolve, reject) => {
601    const pageCfg = getPageConfigByPath(pageUrl)
602    if (params.url_path.replace('.html', '') !== '/' && (pageCfg && pageCfg.code < 200)) {
603      // 返回所有处理好的结果
604      resolve({})
605    } else {
606      if (ctx.state.cache && ctx.state.cache.getApiData('partner_link')) {
607        resolve(ctx.state.cache.getApiData('partner_link')['data'])
608      } else {
609        ctx.state.request(ctx, {
610          name: '友情链接',
611          url: apiAddress.partnerLink,
612          method: 'GET',
613          params
614        })
615          .then(res => {
616            if (ctx.state.cache) ctx.state.cache.fillApiData(res, 'partner_link')
617            resolve(res.data)
618          })
619          .catch(error => {
620            reject(error)
621          })
622      }
623    }
624  })
625}
626
627/** 获取文档型页面 */
628export function getDocumentPage(ctx, params) {
629  return new Promise((resolve, reject) => {
630    ctx.state.request(ctx, {
631      name: '隐私条款',
632      url: '/site-policy/detail',
633      params
634    })
635      .then(res => {
636        resolve(res.data)
637      })
638      .catch(error => reject(error))
639  })
640}

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.