api-domain.js 4.35 KB
const _ = require('lodash');

// api调用列表
let domainApis = {
    erp: {
        login: '/erp-shop-web/account/profile/login',
        getPurview: '/erp-shop-web/account/menu/query_by_pid',
        allotPurchaseList: '/erp-shop-web/purchase/list',
        allotDelivery: '/erp-shop-web/purchase/delivery',
        allotExpressList: '/erp-shop-web/purchase/expressList',
        allotExpressDetail: '/erp-shop-web/purchase/expressDetail',
        allotWarehouseInfo: '/erp-shop-web/purchase/queryBySupplierId',
        allotStockOut: '/erp-shop-web/purchase/stockOut',
        allotExpressNumList: '/erp-shop-web/purchase/queryExpressListByExpressNumber',
        allotExpressCompList: '/erp-shop-web/express/getExpressList',
        allotExportList: '/erp-shop-web/export/exportForPurchaseForm',
        allotPrintExpressDetail: '/erp-shop-web/purchase/queryExpressListByExpressNumber',
        jitProductList: '/erp-shop-web/product/jitProductList',
        getJitStorageListBySkn: '/erp-shop-web/product/getJitStorageListBySkn',
        importJitStorage: '/erp-shop-web/product/importJitStorage'
    },
    platform: {
        queryShopsByAdminPid: '/SellerShopController/queryShopsByAdminPid',
        getSellerBrandInfo: '/SellerProductController/getSellerBrandInfo',
        getSellerSortInfo: '/SellerProductController/getSellerSortInfo',
        querySellerProductColors: '/SellerProductController/querySellerProductColors',
        querySortSize: '/SellerSortSizeController/querySortSize',
        addProduct: '/SellerProductController/addProduct',
        queryProductParamBySortId: '/SellerStandardController/queryProductParamBySortId',
        selectAttributes: '/SellerProductAttributeController/selectAttributes',
        querySellerProductMaterial: '/SellerProductController/querySellerProductMaterial',
        updateSellerProductNetSaleInfo: '/SellerProductController/updateSellerProductNetSaleInfo',
        querySellerProductList: '/SellerProductController/querySellerProductList',
        productOutSale: '/SellerSknStatusController/productOutSale',
        productOnSale: '/SellerSknStatusController/productOnSale',
        queryProdSizeList: '/SellerProductSize/queryProdSizeList',
        saveProdSizeInfo: '/SellerProductSize/saveProdSizeInfo',
        getSellerAllSortInfo: '/SellerProductController/getSellerAllSortInfo',
        exportSellerProductList: '/SellerProductController/exportSellerProductList',
        updateSellerPrice: '/SellerPriceController/updateSellerPrice',
        updateProduct: '/SellerProductController/updateProduct',
        getProduct: '/SellerProductController/getProduct',
        getShopDetailById: '/SellerShopController/getShopDetailById',
        updateShopBaseInfoById: '/SellerShopController/updateShopBaseInfoById',
        uploads: '/fileupload/uploads',
        findBusinessShopsDecorator: '/ShopsDecoratorRest/findBusinessShopsDecorator',
        getShopsCategoryList: '/SellerShopController/getShopsCategoryList',
        addOrUpdateShopsCategory: '/SellerShopController/addOrUpdateShopsCategory',
        deleteShopsCategory: '/SellerShopController/deleteShopsCategory',
        getAllProduct: '/SellerShopController/getAllProduct',
        getBindProductCount: '/SellerShopController/getBindProductCount',
        getBindProduct: '/SellerShopController/getBindProduct',
        addCategoryLinkProduct: '/SellerShopController/addCategoryLinkProduct',
        deleteCategoryLinkProduct: '/SellerShopController/deleteCategoryLinkProduct',
        getRemoteImageUrlBySku: '/product/getRemoteImageUrlBySku'
    },
    shop: {
        login: '/loginInter'
    }
};

// 域名列表
const domains = {
    erp: 'http://192.168.103.82:9098',
    platform: 'http://192.168.102.210:8088/platform',
    shop: 'http://192.168.102.211:30016'
};

const isProd = process.env.NODE_ENV === 'production';
const isTest = (process.env.NODE_ENV || '').indexOf('test') >= 0;

if (isTest) {
    domains.erp = 'http://192.168.103.82:9098';
    domains.platform = 'http://192.168.102.210:8088/platform';
    domains.shop = 'http://192.168.102.211:30016';
}

if (isProd) {
    domains.erp = 'http://gw.erp.yohoops.org';
    domains.platform = 'http://api.platform.yohoops.org/platform';
    domains.shop = 'http://shops.yohobuy.com';
}

_.each(domainApis, (apis, domainName) => {
    _.each(apis, (url, api) => {
        apis[api] = _.get(domains, domainName, '') + url;
    });
});

module.exports = domainApis;