|
@@ -19,6 +19,7 @@ const helpers = require(`${library}/helpers`); |
|
@@ -19,6 +19,7 @@ const helpers = require(`${library}/helpers`); |
19
|
const detailAPI = require('./detail-main-api');
|
19
|
const detailAPI = require('./detail-main-api');
|
20
|
const commentAPI = require('./detail-comment-api');
|
20
|
const commentAPI = require('./detail-comment-api');
|
21
|
const consultAPI = require('./detail-consult-api');
|
21
|
const consultAPI = require('./detail-consult-api');
|
|
|
22
|
+const hotAreaAPI = require('./detail-hotarea-api');
|
22
|
const brandAPI = require('./brand-api');
|
23
|
const brandAPI = require('./brand-api');
|
23
|
const favoriteAPI = require('./favorite-api');
|
24
|
const favoriteAPI = require('./favorite-api');
|
24
|
const shopAPI = require('./shop-api');
|
25
|
const shopAPI = require('./shop-api');
|
|
@@ -76,9 +77,6 @@ function getMultiDataByResourceName(resourceName) { |
|
@@ -76,9 +77,6 @@ function getMultiDataByResourceName(resourceName) { |
76
|
|
77
|
|
77
|
/**
|
78
|
/**
|
78
|
* 获取商品的喜欢
|
79
|
* 获取商品的喜欢
|
79
|
- * @param uid
|
|
|
80
|
- * @param pid
|
|
|
81
|
- * @param bid
|
|
|
82
|
*/
|
80
|
*/
|
83
|
const getProductFavoriteData = (uid, pid, bid) => {
|
81
|
const getProductFavoriteData = (uid, pid, bid) => {
|
84
|
return co(function*() {
|
82
|
return co(function*() {
|
|
@@ -233,7 +231,6 @@ const getActivityDataByProductBaseInfo = (data) => { |
|
@@ -233,7 +231,6 @@ const getActivityDataByProductBaseInfo = (data) => { |
233
|
/**
|
231
|
/**
|
234
|
* 获取商品咨询和评论数据
|
232
|
* 获取商品咨询和评论数据
|
235
|
* @param data
|
233
|
* @param data
|
236
|
- * @returns {{}}
|
|
|
237
|
*/
|
234
|
*/
|
238
|
const getConsultCommentDataByProductInfo = (data) => {
|
235
|
const getConsultCommentDataByProductInfo = (data) => {
|
239
|
|
236
|
|
|
@@ -262,7 +259,6 @@ const getConsultCommentDataByProductInfo = (data) => { |
|
@@ -262,7 +259,6 @@ const getConsultCommentDataByProductInfo = (data) => { |
262
|
|
259
|
|
263
|
/**
|
260
|
/**
|
264
|
* 获取品牌数据
|
261
|
* 获取品牌数据
|
265
|
- * @param data
|
|
|
266
|
*/
|
262
|
*/
|
267
|
const getBrandDataByProductBaseInfo = (data) => {
|
263
|
const getBrandDataByProductBaseInfo = (data) => {
|
268
|
|
264
|
|
|
@@ -325,8 +321,6 @@ const getBrandDataByProductBaseInfo = (data) => { |
|
@@ -325,8 +321,6 @@ const getBrandDataByProductBaseInfo = (data) => { |
325
|
|
321
|
|
326
|
/**
|
322
|
/**
|
327
|
* 获得sku商品数据
|
323
|
* 获得sku商品数据
|
328
|
- * @param data
|
|
|
329
|
- * @returns {{defaultImage: number, skuGoods: number, totalStorageNum: number}}
|
|
|
330
|
*/
|
324
|
*/
|
331
|
const getSkuDataByProductBaseInfo = (data) => {
|
325
|
const getSkuDataByProductBaseInfo = (data) => {
|
332
|
let totalStorageNum = 0;
|
326
|
let totalStorageNum = 0;
|
|
@@ -517,7 +511,6 @@ const getFashionTopGoodsStatus = (uid, showStatus, isBeginSale) => { |
|
@@ -517,7 +511,6 @@ const getFashionTopGoodsStatus = (uid, showStatus, isBeginSale) => { |
517
|
|
511
|
|
518
|
/**
|
512
|
/**
|
519
|
* 获取分类导航列表
|
513
|
* 获取分类导航列表
|
520
|
- * @returns {Promise.<{}>}
|
|
|
521
|
*/
|
514
|
*/
|
522
|
// controller item.php 32;
|
515
|
// controller item.php 32;
|
523
|
function getSortNavAsync(smallSortId, gender) {
|
516
|
function getSortNavAsync(smallSortId, gender) {
|
|
@@ -1339,9 +1332,6 @@ const getSizeInfoAsync = (productSkn, maxSortId)=> { |
|
@@ -1339,9 +1332,6 @@ const getSizeInfoAsync = (productSkn, maxSortId)=> { |
1339
|
|
1332
|
|
1340
|
/**
|
1333
|
/**
|
1341
|
* 获取评论
|
1334
|
* 获取评论
|
1342
|
- * @param pid
|
|
|
1343
|
- * @param page
|
|
|
1344
|
- * @param size
|
|
|
1345
|
*/
|
1335
|
*/
|
1346
|
module.exports.indexCommentAsync = (pid, page, size) => {
|
1336
|
module.exports.indexCommentAsync = (pid, page, size) => {
|
1347
|
return co(function *() {
|
1337
|
return co(function *() {
|
|
@@ -1403,14 +1393,14 @@ module.exports.indexConsultAsync = (uid, pid, page, size) => { |
|
@@ -1403,14 +1393,14 @@ module.exports.indexConsultAsync = (uid, pid, page, size) => { |
1403
|
|
1393
|
|
1404
|
/**
|
1394
|
/**
|
1405
|
* 添加咨询
|
1395
|
* 添加咨询
|
1406
|
- * @param uid
|
|
|
1407
|
- * @param pid
|
|
|
1408
|
- * @param content
|
|
|
1409
|
*/
|
1396
|
*/
|
1410
|
module.exports.createConsultAsync = (uid, pid, content) => {
|
1397
|
module.exports.createConsultAsync = (uid, pid, content) => {
|
1411
|
return consultAPI.createAsync(uid, pid, content);
|
1398
|
return consultAPI.createAsync(uid, pid, content);
|
1412
|
}
|
1399
|
}
|
1413
|
|
1400
|
|
|
|
1401
|
+/**
|
|
|
1402
|
+ * 获取某一个商品详情主页面
|
|
|
1403
|
+ */
|
1414
|
module.exports.showMainAsync = (data) => {
|
1404
|
module.exports.showMainAsync = (data) => {
|
1415
|
|
1405
|
|
1416
|
return co(function * () {
|
1406
|
return co(function * () {
|
|
@@ -1442,3 +1432,62 @@ module.exports.showMainAsync = (data) => { |
|
@@ -1442,3 +1432,62 @@ module.exports.showMainAsync = (data) => { |
1442
|
return result;
|
1432
|
return result;
|
1443
|
})();
|
1433
|
})();
|
1444
|
};
|
1434
|
};
|
|
|
1435
|
+
|
|
|
1436
|
+/**
|
|
|
1437
|
+ * 获取某一个商品的热区数据
|
|
|
1438
|
+ */
|
|
|
1439
|
+module.exports.indexHotAreaAsync = (pid) => {
|
|
|
1440
|
+ return co(function *() {
|
|
|
1441
|
+ let data = yield hotAreaAPI.indexAsync(pid);
|
|
|
1442
|
+
|
|
|
1443
|
+ if (data.code && data.code === 200 && data.data) {
|
|
|
1444
|
+ return data.data.reduce((result, area) => {
|
|
|
1445
|
+ let item = {};
|
|
|
1446
|
+
|
|
|
1447
|
+ if (area.imageUrl) {
|
|
|
1448
|
+ item.img = helpers.getForceSourceUrl(area.imageUrl);
|
|
|
1449
|
+ }
|
|
|
1450
|
+
|
|
|
1451
|
+ item.list = area.infos.reduce((acc, cur, index) => {
|
|
|
1452
|
+ if (!cur.product || !cur.product.goodsList) {
|
|
|
1453
|
+ return acc;
|
|
|
1454
|
+ }
|
|
|
1455
|
+
|
|
|
1456
|
+ let point = {
|
|
|
1457
|
+ label: index + 1,
|
|
|
1458
|
+ top: cur.top,
|
|
|
1459
|
+ left: cur.left,
|
|
|
1460
|
+ height: cur.height,
|
|
|
1461
|
+ width: cur.width
|
|
|
1462
|
+ };
|
|
|
1463
|
+
|
|
|
1464
|
+ let goods = _.head(cur.product.goodsList);
|
|
|
1465
|
+
|
|
|
1466
|
+ // 封面图
|
|
|
1467
|
+ point.img = helpers.getForceSourceUrl(goods.colorImage, 60, 60);
|
|
|
1468
|
+
|
|
|
1469
|
+ // 商品相关信息
|
|
|
1470
|
+ point.product = {
|
|
|
1471
|
+ salePrice: cur.product.productPriceBo.formatSalesPrice,
|
|
|
1472
|
+ marketPrice: cur.product.productPriceBo.formatMarketPrice,
|
|
|
1473
|
+ productName: cur.product.productName,
|
|
|
1474
|
+ href: helpers.getUrlBySkc(_.head(goods.goodsImagesList).productId,
|
|
|
1475
|
+ _.head(goods.goodsImagesList).goodsId,
|
|
|
1476
|
+ cur.product.cnAlphabet)
|
|
|
1477
|
+ };
|
|
|
1478
|
+ acc.push(point);
|
|
|
1479
|
+ }, []);
|
|
|
1480
|
+
|
|
|
1481
|
+ if (_.isEmpty(item)) {
|
|
|
1482
|
+ return result;
|
|
|
1483
|
+ } else {
|
|
|
1484
|
+ result.push(item);
|
|
|
1485
|
+ return result;
|
|
|
1486
|
+ }
|
|
|
1487
|
+
|
|
|
1488
|
+ }, []);
|
|
|
1489
|
+ }
|
|
|
1490
|
+
|
|
|
1491
|
+ return [];
|
|
|
1492
|
+ })();
|
|
|
1493
|
+} |