1234567891011121314151617181920212223242526272829303132 |
- // 产品名映射
- function productListNameMapping (data) {
- const nameMapping = {
- 'com.brother.pdfreaderpro.mac.product_1': 'PDF Reader Pro for Mac',
- 'com.brother.pdfreaderpro.windows.product_1': 'PDF Reader Pro for Windows',
- 'com.brother.pdfreaderpro.mac.product_3': 'PDF Reader Pro for Mac (With PDF to Office Pack)',
- 'com.brother.pdfreaderpro.windows.product_3': 'PDF Reader Pro for Windows (With PDF to Office Pack)',
- 'com.brother.pdfreaderpro.cross.platform.product_3': 'PDF Reader Pro Cross-Platform (With PDF to Office Pack)'
- }
- if (!data[0]) return []
- return data.map((item) => {
- const code = item.code || item.productCode
- if (code && Object.prototype.hasOwnProperty.call(nameMapping, code)) {
- if (item.name) item.name = nameMapping[code]
- if (item.productName) item.productName = nameMapping[code]
- }
- const codes = item.codes || item.productCodes
- if (codes) {
- const multipleCodes = codes.split(',')
- const multipleNames = multipleCodes.map((code) => nameMapping[code])
- if (multipleNames.length > 0) {
- if (item.names) item.names = multipleNames.join(',')
- if (item.productNames) item.productNames = multipleNames.join(',')
- }
- }
- return item
- })
- }
- export { productListNameMapping }
|