feat(mini): v4.0.8 客服卡片主包落地、定位误报修复,合伙人微信内预览保存海报
Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -1,13 +1,18 @@
|
||||
import Taro from '@tarojs/taro';
|
||||
import { fetchClientConfig } from './pay-wechat';
|
||||
|
||||
/** 与 package.json version 同步,供服务端 minClientVersion 比对 */
|
||||
export const APP_VERSION = '3.5.16';
|
||||
/** 与 package.json version 同步(Taro defineConstants 注入),供 minClientVersion 比对 */
|
||||
export const APP_VERSION =
|
||||
(typeof TARO_APP_VERSION !== 'undefined' && String(TARO_APP_VERSION).trim()) || '4.0.4';
|
||||
|
||||
export const APP_VERSION_LABEL = `v${APP_VERSION}`;
|
||||
export const APP_VERSION_LABEL = `v${APP_VERSION.replace(/^v/i, '')}`;
|
||||
|
||||
function normalizeVersion(v: string): string {
|
||||
return String(v || '').trim().replace(/^v/i, '');
|
||||
}
|
||||
|
||||
function parseSemver(v: string): number[] {
|
||||
return v.split('.').map((n) => parseInt(n, 10) || 0);
|
||||
return normalizeVersion(v).split('.').map((n) => parseInt(n, 10) || 0);
|
||||
}
|
||||
|
||||
export function compareSemver(a: string, b: string): number {
|
||||
@@ -89,7 +94,7 @@ async function enforceMinClientVersion(min: string) {
|
||||
export async function checkClientVersionGate() {
|
||||
try {
|
||||
const config = await fetchClientConfig();
|
||||
const min = config.minClientVersion?.trim();
|
||||
const min = normalizeVersion(config.minClientVersion ?? '');
|
||||
if (min && compareSemver(APP_VERSION, min) < 0) {
|
||||
await enforceMinClientVersion(min);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user