(function () {
    'use strict';

    var protocol = window.location.protocol;
    var apiHost = protocol + '//api.xyqb.com/';
    var xyqbUserUIHost = protocol + '//passport.xyqb.com/';
    var authHost = protocol + '//auth.xyqb.com/';
    var bankCardReturnToken = 'BIND_RETURN_ONLINE';
    var repayReturnToken = 'REPAY_RETURN_ONLINE';
    var rebindRepayReturnToken = 'REBIND_RETURN_ONLINE';

    var activityUI= protocol +'//activity.xyqb.com/';
    var qiniuHost= protocol +'//ohsx2fi5w.bkt.clouddn.com/';
    var btHost= protocol +'//bt.xyqb.com/';
    var shuntHost = protocol + '//flow.xyqb.com/';
    var h5Host = protocol + '//h5.xyqb.com/';

    var xyqbApp = angular.module('xyqbUiApp');

    xyqbApp.value('ApiBaseUrl', apiHost);
    xyqbApp.value('AuthBaseUrl', authHost);
    xyqbApp.value('ActivityUI', activityUI);
    xyqbApp.value('QiniuHostUrl', qiniuHost);
    xyqbApp.value('BtBaseUrl', btHost);
    xyqbApp.value('ShuntBaseUrl', shuntHost);
    xyqbApp.value('XyqbUserUI', xyqbUserUIHost);
    xyqbApp.value('h5BaseUrl', h5Host);
    
    if (location.host === '58.xyqb.com') {
        bankCardReturnToken = '58BIND_RETURN_ONLINE';
        repayReturnToken = '58REPAY_RETURN_ONLINE';
        rebindRepayReturnToken = '58REBIND_RETURN_ONLINE';

        xyqbApp.value('BindCardToken', bankCardReturnToken);
        xyqbApp.value('RepayToken', repayReturnToken);
        xyqbApp.value('RebindToken', rebindRepayReturnToken);
    } else {
        xyqbApp.value('BindCardToken', bankCardReturnToken);
        xyqbApp.value('RepayToken', repayReturnToken);
        xyqbApp.value('RebindToken', rebindRepayReturnToken);
    }
})();

