ufo-product-api.js 2.34 KB
const rp = require('request-promise');

module.exports.getUfoSpecialSizeProducts = async() => {
  return rp({
    uri : 'http://erp-pre.yohops.com/erp-gateway-web/spiderUfo/querySpecialSizeProducts',
    method: 'POST',
    headers: {
      'Content-Type': 'application/json; charset=utf-8'
    },
  });
};

module.exports.getsSizeData = async() => {
  return rp({
    uri : 'http://erp-pre.yohops.com/erp-gateway-web/spiderUfo/querySizeList',
    method: 'POST',
    headers: {
      'Content-Type': 'application/json; charset=utf-8'
    },
  });
};

module.exports.handleChannelSkuCompare = async(data) => {
  try {
    return rp({
      uri: 'http://erp-pre.yohops.com/erp-gateway-web/spiderUfo/handleChannelSkuCompare',
      method: 'POST',
      headers: {
        'Content-Type': 'application/json; charset=utf-8'
      },
      body: JSON.stringify(data)
    });
  } catch (error) {
    return Promise.reject(new Error(`更新channel_sku_compare表错误: ${JSON.stringify(data)}, ${error.message}`));
  }
};

module.exports.queryAllChannelProductRelations = async() => {
  try {
    return rp({
      uri: 'http://erp-pre.yohops.com/erp-gateway-web/spiderUfo/queryAllChannelProductRelations',
      method: 'POST',
      headers: {
        'Content-Type': 'application/json; charset=utf-8'
      },
      body: JSON.stringify({status: 1, productSign: 1})
    });
  } catch (error) {
    return Promise.reject(new Error(`获取绑定关系错误: ${error.message}`));
  }
};


module.exports.queryTopSellProductRelations = async() => {
  try {
    return rp({
      uri: 'http://erp-pre.yohops.com/erp-gateway-web/spiderUfo/queryAllChannelProductRelations',
      method: 'POST',
      headers: {
        'Content-Type': 'application/json; charset=utf-8'
      },
      body: JSON.stringify({status: 1, productSign: 1})
    });
  } catch (error) {
    return Promise.reject(new Error(`获取绑定关系错误: ${error.message}`));
  }
};

module.exports.queryNormalSellProductRelations = async(data) => {
  try {
    return rp({
      uri: 'http://erp-pre.yohops.com/erp-gateway-web/spiderUfo/queryChannelProductRelationsPages',
      method: 'POST',
      headers: {
        'Content-Type': 'application/json; charset=utf-8'
      },
      body: JSON.stringify(data)
    });
  } catch (error) {
    return Promise.reject(new Error(`获取绑定关系错误: ${error.message}`));
  }
};