feat:getStoreXinFaDeviceDetail
This commit is contained in:
@@ -283,4 +283,10 @@ public class RedisConstant {
|
||||
public static final String SUBMIT_BUILD_KEY = "submit_build_key_";
|
||||
|
||||
public static final String GET_AI_MODULE = "get_ai_module_";
|
||||
|
||||
public static final String HUOMA_STORE_DEVICE_RESOURCE_KEY = "huoma_store_device_resource";
|
||||
|
||||
public static final String HUO_MA_STORE_ID = "huo_ma_store_id";
|
||||
|
||||
public static final String HUO_MA_TOKEN= "huo_ma_token:{0}";
|
||||
}
|
||||
|
||||
@@ -0,0 +1,62 @@
|
||||
package com.cool.store.utils;
|
||||
|
||||
import java.util.regex.Matcher;
|
||||
import java.util.regex.Pattern;
|
||||
|
||||
/**
|
||||
* @Author suzhuhong
|
||||
* @Date 2025/11/4 17:34
|
||||
* @Version 1.0
|
||||
*/
|
||||
public class BrowserVersionUtils {
|
||||
|
||||
|
||||
/**
|
||||
* 检测是否为旧版Chrome浏览器(版本小于60)
|
||||
* @param userAgent 浏览器User-Agent字符串
|
||||
* @return true-是旧版Chrome,false-不是旧版Chrome
|
||||
*/
|
||||
public static boolean isOldChromeBrowser(String userAgent) {
|
||||
if (userAgent == null || userAgent.isEmpty()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// 检查是否是Chrome浏览器
|
||||
if (!userAgent.contains("Chrome")) {
|
||||
return false; // 不是Chrome浏览器
|
||||
}
|
||||
|
||||
// 提取Chrome版本号
|
||||
Integer chromeVersion = extractChromeVersion(userAgent);
|
||||
|
||||
if (chromeVersion == null) {
|
||||
return false; // 无法提取版本号
|
||||
}
|
||||
|
||||
// 判断版本是否小于60
|
||||
return chromeVersion < 60;
|
||||
}
|
||||
|
||||
/**
|
||||
* 从User-Agent中提取Chrome主版本号
|
||||
* @param userAgent 浏览器User-Agent字符串
|
||||
* @return Chrome主版本号,如果无法提取返回null
|
||||
*/
|
||||
public static Integer extractChromeVersion(String userAgent) {
|
||||
// 正则表达式匹配 Chrome/版本号 模式
|
||||
Pattern pattern = Pattern.compile("Chrome/(\\d+)");
|
||||
Matcher matcher = pattern.matcher(userAgent);
|
||||
|
||||
if (matcher.find()) {
|
||||
try {
|
||||
return Integer.parseInt(matcher.group(1));
|
||||
} catch (NumberFormatException e) {
|
||||
System.err.println("版本号格式错误: " + matcher.group(1));
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user