import { isSupportHtml5Plus } from '@/utils/platform'
import appService, { imService as appImService } from "./app-ajax"
import webService, { imService as webImService} from "./web-ajax"

// 采用本地http://192.168.131.xx服务进行调试时，未避免跨域开启下面的配置
let forceCrossDomain = false

let service = webService
let imService = webImService

let originAnchor = document.createElement('a');
    originAnchor.href = window.location.href;
    
let crossDomain = originAnchor.protocol === 'file:'
let wkWebkit = window.mui && window.mui.os.ios && window.webkit && window.webkit.messageHandlers

if(isSupportHtml5Plus && (crossDomain || wkWebkit || forceCrossDomain)) {
    service = appService
    imService = appImService
}


export default service
export {
    imService,
}
