固定ios下载appid
This commit is contained in:
+4
-1
@@ -14,12 +14,15 @@ export const bottonclick = (param: donwloadParam) => {
|
|||||||
return useHttp.post(`${STAT_API}/bottonclick`, param, {})
|
return useHttp.post(`${STAT_API}/bottonclick`, param, {})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// iOS H5 描述文件的 appId 写死
|
||||||
|
const H5_CONFIG_APP_ID = 2
|
||||||
|
|
||||||
// iOS H5 描述文件:返回 .mobileconfig 原文(非 JSON),不走 useHttp
|
// iOS H5 描述文件:返回 .mobileconfig 原文(非 JSON),不走 useHttp
|
||||||
export const downloadH5 = async (data: H5param): Promise<string> => {
|
export const downloadH5 = async (data: H5param): Promise<string> => {
|
||||||
const res = await fetch(`${STAT_API}/h5/config`, {
|
const res = await fetch(`${STAT_API}/h5/config`, {
|
||||||
method: 'POST',
|
method: 'POST',
|
||||||
headers: { 'Content-Type': 'application/json' },
|
headers: { 'Content-Type': 'application/json' },
|
||||||
body: JSON.stringify(data),
|
body: JSON.stringify({ ...data, appId: H5_CONFIG_APP_ID }),
|
||||||
})
|
})
|
||||||
if (!res.ok) throw new Error('获取描述文件失败 ' + res.status)
|
if (!res.ok) throw new Error('获取描述文件失败 ' + res.status)
|
||||||
return res.text()
|
return res.text()
|
||||||
|
|||||||
@@ -25,7 +25,7 @@ export type donwloadParam = {
|
|||||||
packageType?: number // 1 企业签 / 2 商店包 / 3 TF
|
packageType?: number // 1 企业签 / 2 商店包 / 3 TF
|
||||||
}
|
}
|
||||||
export type H5param = {
|
export type H5param = {
|
||||||
appId: number
|
appId?: number // 请求时固定为 2,见 api/btn.ts downloadH5
|
||||||
dc?: string
|
dc?: string
|
||||||
pc?: string
|
pc?: string
|
||||||
[key: string]: number | string | undefined
|
[key: string]: number | string | undefined
|
||||||
|
|||||||
@@ -106,7 +106,7 @@ export function useAppDownload() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
async function downloadMobileConfig() {
|
async function downloadMobileConfig() {
|
||||||
const paramData: H5param = { appId: APP_ID }
|
const paramData: H5param = {}
|
||||||
if (route.query.dc) paramData.dc = String(route.query.dc)
|
if (route.query.dc) paramData.dc = String(route.query.dc)
|
||||||
if (route.query.pc) paramData.pc = String(route.query.pc)
|
if (route.query.pc) paramData.pc = String(route.query.pc)
|
||||||
const content = await downloadH5(paramData)
|
const content = await downloadH5(paramData)
|
||||||
|
|||||||
Reference in New Issue
Block a user