|
@@ -17,10 +17,9 @@ const helpers = require(`${library}/helpers`); |
|
@@ -17,10 +17,9 @@ const helpers = require(`${library}/helpers`); |
17
|
const detailAPI = require('./detail-main-api');
|
17
|
const detailAPI = require('./detail-main-api');
|
18
|
const commentAPI = require('./detail-comment-api');
|
18
|
const commentAPI = require('./detail-comment-api');
|
19
|
const consultAPI = require('./detail-consult-api');
|
19
|
const consultAPI = require('./detail-consult-api');
|
20
|
-const hotAreaAPI = require('./detail-hotarea-api');
|
|
|
21
|
|
20
|
|
|
|
21
|
+const hotAreaService = require('./detail-hotarea-api');
|
22
|
const brandService = require('./brand-service');
|
22
|
const brandService = require('./brand-service');
|
23
|
-
|
|
|
24
|
const favoriteBrandService = require('./favorite-brand-service');
|
23
|
const favoriteBrandService = require('./favorite-brand-service');
|
25
|
const favoriteProductService = require('./favorite-product-service');
|
24
|
const favoriteProductService = require('./favorite-product-service');
|
26
|
|
25
|
|
|
@@ -1440,63 +1439,4 @@ module.exports.showMainAsync = (data) => { |
|
@@ -1440,63 +1439,4 @@ module.exports.showMainAsync = (data) => { |
1440
|
/**
|
1439
|
/**
|
1441
|
* 获取某一个商品的热区数据
|
1440
|
* 获取某一个商品的热区数据
|
1442
|
*/
|
1441
|
*/
|
1443
|
-module.exports.indexHotAreaAsync = (pid) => {
|
|
|
1444
|
- return co(function *() {
|
|
|
1445
|
- let data = yield hotAreaAPI.indexAsync(pid);
|
|
|
1446
|
-
|
|
|
1447
|
- if (!data.code && !(data.code === 200) && !data.data) {
|
|
|
1448
|
- return [];
|
|
|
1449
|
- }
|
|
|
1450
|
-
|
|
|
1451
|
- return data.data.reduce((result, area) => {
|
|
|
1452
|
- let item = {};
|
|
|
1453
|
-
|
|
|
1454
|
- if (area.imageUrl) {
|
|
|
1455
|
- item.img = helpers.getForceSourceUrl(area.imageUrl);
|
|
|
1456
|
- }
|
|
|
1457
|
-
|
|
|
1458
|
- item.list = area.infos.reduce((acc, cur, index) => {
|
|
|
1459
|
- if (!cur.product || !cur.product.goodsList) {
|
|
|
1460
|
- return acc;
|
|
|
1461
|
- }
|
|
|
1462
|
-
|
|
|
1463
|
- let point = {
|
|
|
1464
|
- label: index + 1,
|
|
|
1465
|
- top: cur.top,
|
|
|
1466
|
- left: cur.left,
|
|
|
1467
|
- height: cur.height,
|
|
|
1468
|
- width: cur.width
|
|
|
1469
|
- };
|
|
|
1470
|
-
|
|
|
1471
|
- let goods = _.head(cur.product.goodsList);
|
|
|
1472
|
-
|
|
|
1473
|
- // 封面图
|
|
|
1474
|
- point.img = helpers.getForceSourceUrl(goods.colorImage, 60, 60);
|
|
|
1475
|
-
|
|
|
1476
|
- // 商品相关信息
|
|
|
1477
|
- point.product = {
|
|
|
1478
|
- salePrice: cur.product.productPriceBo.formatSalesPrice,
|
|
|
1479
|
- marketPrice: cur.product.productPriceBo.formatMarketPrice,
|
|
|
1480
|
- productName: cur.product.productName,
|
|
|
1481
|
- href: helpers.getUrlBySkc(
|
|
|
1482
|
- _.head(goods.goodsImagesList).productId,
|
|
|
1483
|
- _.head(goods.goodsImagesList).goodsId,
|
|
|
1484
|
- cur.product.cnAlphabet
|
|
|
1485
|
- )
|
|
|
1486
|
- };
|
|
|
1487
|
- acc.push(point);
|
|
|
1488
|
-
|
|
|
1489
|
- return acc;
|
|
|
1490
|
- }, []);
|
|
|
1491
|
-
|
|
|
1492
|
- if (_.isEmpty(item)) {
|
|
|
1493
|
- return result;
|
|
|
1494
|
- } else {
|
|
|
1495
|
- result.push(item);
|
|
|
1496
|
- return result;
|
|
|
1497
|
- }
|
|
|
1498
|
-
|
|
|
1499
|
- }, []);
|
|
|
1500
|
-
|
|
|
1501
|
- })();
|
|
|
1502
|
-}; |
1442
|
+module.exports.indexHotAreaAsync = hotAreaService.indexAsync; |