feat(升级中心): 实现备用更新方案并优化版本检查逻辑

This commit is contained in:
2025-12-26 17:11:58 +08:00
parent e76e6da008
commit e5415a8784
10 changed files with 245 additions and 53 deletions

View File

@@ -1,6 +1,7 @@
import type { IRequestOptions } from '../types'
import { useUserStore } from '@/stores/user'
import { APP_INFO } from '@/api/config'
import { getCurrentVersion } from '@/uni_modules/uni-upgrade-center-app/utils/call-check-version'
export function requestInterceptor(options: IRequestOptions): IRequestOptions {
const headers = { ...(options.headers || {}) }
@@ -21,9 +22,12 @@ export function requestInterceptor(options: IRequestOptions): IRequestOptions {
headers['Content-Type'] = 'application/json;charset=UTF-8'
}
getCurrentVersion().then((version_code: string) => {
headers['version_code'] = version_code || ''
})
headers['appType'] = APP_INFO.TYPE
headers['version_code'] = APP_INFO.VERSION_CODE || '1.0.0'
return {
...options,
header: headers,