Commit d9003905 authored by Allen Bai's avatar Allen Bai

feat: 修改接口

parent eb24e074
...@@ -59,8 +59,7 @@ function getIPCByDomain(domain: string, env: string) { ...@@ -59,8 +59,7 @@ function getIPCByDomain(domain: string, env: string) {
url: `${getRequestUrl(env)}&domainUrl=${encodeURIComponent(domain)}`, url: `${getRequestUrl(env)}&domainUrl=${encodeURIComponent(domain)}`,
method: 'GET', method: 'GET',
success(res) { success(res) {
console.log('当前域名的IPC备案为', res) resolve(JSON.parse(res || '{}'))
resolve(res || res.domainBeianInfo)
}, },
error(err) { error(err) {
reject(err) reject(err)
...@@ -135,19 +134,14 @@ async function mountIPCFooter(opts: IPCFooterOptions = {}) { ...@@ -135,19 +134,14 @@ async function mountIPCFooter(opts: IPCFooterOptions = {}) {
let IPCNumberString = '' let IPCNumberString = ''
try { try {
IPCNumberString = (await getIPCByDomain(opts.domain || location.host, opts.env || getEnv())) as string let res = await getIPCByDomain(opts.domain || location.host, opts.env || getEnv())
IPCNumberString = (res as any).domainBeianInfo as string
} catch (err) { } catch (err) {
console.log('备案号获取失败') console.log('备案号获取失败')
} }
// 预发环境的接口取不到ipc备案信息
// 所以,预发的备案信息写死
if ((opts.env || getEnv()) == 'pre' && !IPCNumberString) {
IPCNumberString = '预发IPC备案号-写死'
}
let hostName = window.location.hostname let hostName = window.location.hostname
if (hostName === '127.0.0.1' || hostName === 'localhost') { if ((hostName === '127.0.0.1' || hostName === 'localhost') && !IPCNumberString) {
IPCNumberString = '本地开发IPC备案号-写死' IPCNumberString = '本地开发IPC备案号-写死'
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment