1. 动态UA

This commit is contained in:
QAIU
2024-12-16 19:01:55 +08:00
parent 5af402c0c5
commit 672f100c7c
3 changed files with 7 additions and 1 deletions

View File

@@ -77,7 +77,11 @@ public class ShareLinkInfo {
public String getCacheKey() {
// 将type和shareKey组合成一个字符串作为缓存key
return type + ":" + shareKey;
String key = type + ":" + shareKey;
if (type.equals("p115")) {
key += ("_" + otherParam.get("UA").toString().hashCode());
}
return key;
}
public ShareLinkInfo setOtherParam(Map<String, Object> otherParam) {

View File

@@ -59,6 +59,7 @@ public class ParserApi {
.apiLink(getDownLink(parserCreate, true))
.shareLinkInfo(shareLinkInfo).build();
// 解析次数统计
shareLinkInfo.getOtherParam().put("UA",request.headers().get("user-agent"));
cacheManager.getShareKeyTotal(shareLinkInfo.getCacheKey()).onSuccess(res -> {
if (res != null) {
build.setCacheHitTotal(res.get("hit_total") == null ? 0: res.get("hit_total"));

View File

@@ -63,6 +63,7 @@ cache:
mne: 30
mqq: 30
mkg: 30
p115: 5
# httpClient静态代理服务器配置(外网代理)
proxy: