const isOnline = function () {
    return process.env.NODE_ENV !== 'development';
}
export default function () {
    //CRM API
    let domainUrl = "";
    domainUrl = "http://192.168.5.46:5003";
    let locationName = window.location.hostname;
    //旅游ERPApi
    let domainPostUrl = ""
    domainPostUrl = "http://192.168.5.46";
    if (isOnline()) {
        if (window.location.host.indexOf('fcrmyx.oytour.com') != -1) {
            domainUrl = "http://crm.oytour.com"
            domainPostUrl = "http://reborn.oytour.com"
        } else {
            domainUrl = "http://testcrm.oytour.com"
            domainPostUrl = "http://testapi.oytour.com"
        }
    }
    let erpRoutingUrl = "";
    var storageUser = this.getLocalStorage();
    if (locationName.indexOf('oytour') !== -1 || locationName.indexOf('testb2b.oytour.com') !== -1) {
        erpRoutingUrl = "http://admin.oytour.com/#/";
        if (storageUser && storageUser.ERPUrl) {
            erpRoutingUrl = storageUser.ERPUrl + "/#/";
        }
    } else {
        erpRoutingUrl = "http://localhost:8080/#/";
        if (storageUser && storageUser.ERPUrl) {
            erpRoutingUrl = storageUser.ERPUrl + "/#/";
        }
    }

    var obj = {
        //主地址
        DomainUrl: domainUrl,
        DownLoadContractUrl: domainPostUrl,
        //阿里服务器地址
        AliUrl: "https://reborndev.oss-cn-hangzhou.aliyuncs.com",
        //CRMApi地址 
        PostUrl: domainUrl,
        //旅游ERPApi地址
        ERPApiUrl: domainPostUrl + "/api/common/post",
        ERPApiUrlFile: domainPostUrl + "/api/file/GetFileFromWebApi",
        javaUrl: locationName.indexOf('testb2b') == -1 ? "http://efficient.oytour.com" : locationName.indexOf('testb2b.oytour.com') !== -1 ? "http://47.96.12.235:9001" : "http://192.168.10.215:9000",
        ViittoFileUrl: locationName.indexOf('oytour') !== -1 || locationName.indexOf('testb2b.oytour.com') !== -1 ? "http://staticfile.oytour.com" : 'http://192.168.10.214:8130',
        UploadUrl: locationName.indexOf('oytour') !== -1 || locationName.indexOf('testb2b.oytour.com') !== -1 ? "http://uploadfile.oytour.com" : "http://192.168.10.214:8120",
        erpRoutingUrl: erpRoutingUrl
    };
    return obj;
}