Authored by htoooth

refactor hotarea

1 -'use strict';  
2 -  
3 -  
4 -const library = '../../../library';  
5 -const API = require(`${library}/api`).API;  
6 -const sign = require(`${library}/sign`);  
7 -const log = require(`${library}/logger`);  
8 -  
9 -const api = new API();  
10 -  
11 -module.exports.getProductBannerAsync = function(pid) {  
12 - return api.get('', sign.apiSign({  
13 - method: 'web.productBanner.data',  
14 - product_id: pid  
15 - })).catch(log.error);  
16 -};  
17 -  
18 -module.exports.sizeInfoAsync = function(skn) {  
19 - return api.get('', sign.apiSign({  
20 - method: 'h5.product.intro',  
21 - productskn: skn  
22 - })).catch(log.error);  
23 -};  
24 -  
25 -module.exports.getProductComfortAsync = function(pid) {  
26 - return api.get('', sign.apiSign({  
27 - method: 'web.productComfort.data',  
28 - product_id: pid  
29 - })).catch(log.error);  
30 -};  
31 -  
32 -module.exports.getProductModelCardAsync = function(pid) {  
33 - return api.get('', sign.apiSign({  
34 - method: 'web.productModelcard.list',  
35 - product_id: pid  
36 - })).catch(log.error);  
37 -};  
38 -  
39 -module.exports.getProductModelTryAsync = function(skn) {  
40 - return api.get('', sign.apiSign({  
41 - method: 'web.productModelTry.data',  
42 - product_skn: skn  
43 - })).catch(log.error);  
44 -};  
45 -  
46 -/**  
47 - * 获得产品信息  
48 - * @param pid  
49 - * @returns {Promise.<type>}  
50 - */  
51 -module.exports.getProductInfo = function(pid) {  
52 - return api.get('', sign.apiSign({  
53 - method: 'h5.product.data',  
54 - productId: pid  
55 - })).catch(console.log);  
56 -};  
57 -  
58 -  
59 -  
60 -  
61 - 1 +'use strict';
  2 +
  3 +
  4 +const library = '../../../library';
  5 +const API = require(`${library}/api`).API;
  6 +const sign = require(`${library}/sign`);
  7 +const log = require(`${library}/logger`);
  8 +
  9 +const api = new API();
  10 +
  11 +module.exports.getProductBannerAsync = function(pid) {
  12 + return api.get('', sign.apiSign({
  13 + method: 'web.productBanner.data',
  14 + product_id: pid
  15 + })).catch(log.error);
  16 +};
  17 +
  18 +module.exports.sizeInfoAsync = function(skn) {
  19 + return api.get('', sign.apiSign({
  20 + method: 'h5.product.intro',
  21 + productskn: skn
  22 + })).catch(log.error);
  23 +};
  24 +
  25 +module.exports.getProductComfortAsync = function(pid) {
  26 + return api.get('', sign.apiSign({
  27 + method: 'web.productComfort.data',
  28 + product_id: pid
  29 + })).catch(log.error);
  30 +};
  31 +
  32 +module.exports.getProductModelCardAsync = function(pid) {
  33 + return api.get('', sign.apiSign({
  34 + method: 'web.productModelcard.list',
  35 + product_id: pid
  36 + })).catch(log.error);
  37 +};
  38 +
  39 +module.exports.getProductModelTryAsync = function(skn) {
  40 + return api.get('', sign.apiSign({
  41 + method: 'web.productModelTry.data',
  42 + product_skn: skn
  43 + })).catch(log.error);
  44 +};
  45 +
  46 +/**
  47 + * 获得产品信息
  48 + * @param pid
  49 + * @returns {Promise.<type>}
  50 + */
  51 +module.exports.getProductInfo = function(pid) {
  52 + return api.get('', sign.apiSign({
  53 + method: 'h5.product.data',
  54 + productId: pid
  55 + })).catch(console.log);
  56 +};
  57 +
  58 +
  59 +
  60 +
  61 +